Browse Source

.......... [DEV-699] reverted all changes

branches/release/4.0
Michael Veksler 8 years ago
parent
commit
1c4c4042b9
  1. 1
      .gitattributes
  2. 56
      ChangeLog
  3. 2
      configure.ac
  4. 5
      create/src/schema.tmpl
  5. 6
      frontends/php/app/controllers/CControllerProblemView.php
  6. 4
      frontends/php/app/views/monitoring.problem.view.php
  7. 4
      frontends/php/include/actions.inc.php
  8. 5
      frontends/php/include/classes/api/services/CAction.php
  9. 118
      frontends/php/include/classes/api/services/CEvent.php
  10. 54
      frontends/php/include/classes/api/services/CProblem.php
  11. 8
      frontends/php/include/classes/widgets/CWidgetFormProblems.php
  12. 6
      frontends/php/include/defines.inc.php
  13. 9
      frontends/php/include/html.inc.php
  14. 4
      frontends/php/include/views/configuration.maintenance.edit.php
  15. 4
      frontends/php/include/views/configuration.services.edit.php
  16. 472
      frontends/php/js/class.calendar.js
  17. 2
      frontends/php/js/common.js
  18. 2
      frontends/php/js/gtlc.js
  19. 13
      frontends/php/jsLoader.php
  20. 4
      frontends/php/report2.php
  21. 55
      frontends/php/styles/blue-theme.css
  22. 55
      frontends/php/styles/dark-theme.css
  23. 57
      frontends/php/styles/hc-dark.css
  24. 59
      frontends/php/styles/hc-light.css
  25. 5
      frontends/php/tests/selenium/testFormAdministrationGeneralIconMapping.php
  26. 131
      frontends/php/tests/unit/include/classes/api/services/method_getTagsWhereConditionTest.php
  27. 10
      include/dbcache.h
  28. 8
      include/zbxalgo.h
  29. 10
      include/zbxregexp.h
  30. 57
      sass/stylesheets/sass/screen.scss
  31. 2
      src/libs/zbxalgo/evaluate.c
  32. 14
      src/libs/zbxalgo/vectorimpl.h
  33. 173
      src/libs/zbxcommon/misc.c
  34. 53
      src/libs/zbxdbcache/dbconfig.c
  35. 34
      src/libs/zbxdbhigh/db.c
  36. 56
      src/libs/zbxdbhigh/discovery.c
  37. 6
      src/libs/zbxdbhigh/lld.c
  38. 104
      src/libs/zbxdbhigh/lld_host.c
  39. 1
      src/libs/zbxdbhigh/lld_item.c
  40. 40
      src/libs/zbxdbhigh/proxy.c
  41. 236
      src/libs/zbxdbhigh/template_item.c
  42. 114
      src/libs/zbxdbupgrade/dbupgrade_3050.c
  43. 33
      src/libs/zbxmodules/modules.c
  44. 35
      src/libs/zbxregexp/zbxregexp.c
  45. 22
      src/libs/zbxserver/evalfunc.c
  46. 37
      src/libs/zbxserver/expression.c
  47. 4
      src/libs/zbxsysinfo/linux/proc.c
  48. 155
      src/zabbix_agent/active.c
  49. 36
      src/zabbix_agent/logfiles.c
  50. 2
      src/zabbix_agent/logfiles.h
  51. 53
      src/zabbix_agent/procstat.c
  52. 39
      src/zabbix_server/discoverer/discoverer.c
  53. 22
      src/zabbix_server/escalator/escalator.c
  54. 82
      src/zabbix_server/operations.c
  55. 14
      src/zabbix_server/poller/checks_calculated.c
  56. 5
      src/zabbix_server/poller/checks_simple.c
  57. 4
      src/zabbix_server/poller/checks_simple.h
  58. 166
      src/zabbix_server/poller/checks_simple_vmware.c
  59. 3
      src/zabbix_server/poller/checks_simple_vmware.h
  60. 27
      src/zabbix_server/poller/poller.c
  61. 6
      src/zabbix_server/snmptrapper/snmptrapper.c
  62. 215
      src/zabbix_server/trapper/active.c
  63. 15
      src/zabbix_server/trapper/trapper.c
  64. 125
      src/zabbix_server/vmware/vmware.c
  65. 8
      src/zabbix_server/vmware/vmware.h
  66. 1
      tests/libs/Makefile.am
  67. 12
      tests/libs/zbxcommon/Makefile.am
  68. 133
      tests/libs/zbxcommon/calculate_item_nextcheck.c
  69. 305
      tests/libs/zbxcommon/calculate_item_nextcheck.yaml
  70. 1
      tests/zbxmockassert.c
  71. 2
      tests/zbxmockassert.h
  72. 4
      tests/zbxmockdata.c
  73. 2
      tests/zbxmockdata.h
  74. 2
      tests/zbxmockexit.c
  75. 1
      tests/zbxmocktest.c
  76. 138
      tests/zbxmocktime.c
  77. 5
      tests/zbxmockutil.h

1
.gitattributes

@ -350,7 +350,6 @@ src/zabbix_server/taskmanager/Makefile.am -text
src/zabbix_server/taskmanager/proxy_tasks.c -text src/zabbix_server/taskmanager/proxy_tasks.c -text
src/zabbix_server/taskmanager/taskmanager.c -text src/zabbix_server/taskmanager/taskmanager.c -text
src/zabbix_server/taskmanager/taskmanager.h -text src/zabbix_server/taskmanager/taskmanager.h -text
tests/libs/zbxcommon/calculate_item_nextcheck.yaml -text
tests/libs/zbxcommon/replace_key_params_dyn.yaml -text tests/libs/zbxcommon/replace_key_params_dyn.yaml -text
tests/libs/zbxcommshigh/zbx_tcp_recv_ext.yaml -text tests/libs/zbxcommshigh/zbx_tcp_recv_ext.yaml -text
tests/libs/zbxcommshigh/zbx_tcp_recv_ext_zlib.yaml -text tests/libs/zbxcommshigh/zbx_tcp_recv_ext_zlib.yaml -text

56
ChangeLog

@ -1,18 +1,8 @@
Changes for 4.0.0alpha8 Changes for 4.0.0alpha8
New features: New features:
..F....... [ZBXNEXT-4312] reworked date picker; implemented keyboard interaction (miks)
..F....PS. [ZBXNEXT-2365] added additional auto-registration operations and re-running of auto-registration actions if host metadata is modified (ashubin, vso)
Bug fixes: Bug fixes:
...G...... [ZBX-12250] fixed logrt[] item to analyze log file from start if no log files match and no log files were seen before (Andris)
.......PS. [ZBX-13765] fixed discovered host status update if it was down and a service was discovered on that host (Andris)
...G...... [ZBX-12070] fixed "proc.num" and "proc.mem" items calculation of values when zabbix_agentd called in test mode (Sergejs)
........S. [ZBX-14423] fixed use of initialized variable during application discovery (vso)
.......PS. [ZBX-12990] improved "vmware.hv.datastore.size" through usage the performance counters (MVekslers)
A.F.I..... [ZBXNEXT-4540] fixed problems filter with same tags not being joined with OR condition (Ivo, Sasha)
..F....... [ZBXNEXT-4576] unified dashboard widget content margins (Andzs, ashubin)
.......PS. [ZBX-12965] - fixed scheduled check calculation during daylight saving changes (wiper)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes for 4.0.0alpha7 Changes for 4.0.0alpha7
@ -334,23 +324,6 @@ Bug fixes:
....I..... [ZBX-12793] fixed system compiler checks during source configuration (abs) ....I..... [ZBX-12793] fixed system compiler checks during source configuration (abs)
...G...... [ZBX-11970] fixed style for some enumerators and structure type declarations (abs, Andris) ...G...... [ZBX-11970] fixed style for some enumerators and structure type declarations (abs, Andris)
--------------------------------------------------------------------------------
Changes for 3.4.11rc1
New features:
Bug fixes:
...G...... [ZBX-12250] fixed logrt[] item to analyze log file from start if no log files match and no log files were seen before (Andris)
.......PS. [ZBX-13765] fixed discovered host status update if it was down and a service was discovered on that host (Andris)
...G...... [ZBX-12070] fixed "proc.num" and "proc.mem" items calculation of values when zabbix_agentd called in test mode (Sergejs)
........S. [ZBX-14423] fixed use of initialized variable during application discovery (vso)
.......PS. [ZBX-12990] improved "vmware.hv.datastore.size" through usage the performance counters (MVekslers)
--------------------------------------------------------------------------------
Changes for 3.4.10
3.4.10rc1 was released as 3.4.10 without any changes
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes for 3.4.10rc1 Changes for 3.4.10rc1
@ -1593,23 +1566,6 @@ A......... [ZBX-10049] fixed optional field validation in drule.update API metho
..F....PS. [ZBX-10076] fixed text information containing non-ASCII characters being saved incorrectly to IBM DB2 database in case of system locale misconfiguration (gleb, Oleg) ..F....PS. [ZBX-10076] fixed text information containing non-ASCII characters being saved incorrectly to IBM DB2 database in case of system locale misconfiguration (gleb, Oleg)
..F....... [ZBX-9989] optimized SQL queries for graphs building (Gunars, Sasha) ..F....... [ZBX-9989] optimized SQL queries for graphs building (Gunars, Sasha)
--------------------------------------------------------------------------------
Changes for 3.0.19rc1
New features:
Bug fixes:
...G...... [ZBX-12250] fixed logrt[] item to analyze log file from start if no log files match and no log files were seen before (Andris)
...G...... [ZBX-12070] fixed "proc.num" and "proc.mem" items calculation of values when zabbix_agentd called in test mode (Sergejs)
........S. [ZBX-14423] fixed use of initialized variable during application discovery (vso)
.......PS. [ZBX-12990] improved "vmware.hv.datastore.size" through usage the performance counters (MVekslers)
.......PS. [ZBX-13765] fixed discovered host status update if it was down and a service was discovered on that host (Andris)
--------------------------------------------------------------------------------
Changes for 3.0.18
3.0.18rc1 was released as 3.0.18 without any changes
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes for 3.0.18rc1 Changes for 3.0.18rc1
@ -3541,18 +3497,6 @@ A......... [ZBX-4772] fixed possibility to pass incorrect host status value (Ivo
...G...... [ZBX-7412] fixed alias parsing; colon symbols are now supported in alias parameters (Juris) ...G...... [ZBX-7412] fixed alias parsing; colon symbols are now supported in alias parameters (Juris)
........S. [ZBX-7204] fixed timestamp order of events generated during network discovery (igors) ........S. [ZBX-7204] fixed timestamp order of events generated during network discovery (igors)
--------------------------------------------------------------------------------
Changes for 2.2.23rc1
New features:
Bug fixes:
--------------------------------------------------------------------------------
Changes for 2.2.22
2.2.22rc1 was released as 2.2.22 without any changes
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes for 2.2.22rc1 Changes for 2.2.22rc1

2
configure.ac

@ -1704,7 +1704,6 @@ dnl *****************************************************************
AC_CHECK_FILE(tests, [AC_CONFIG_FILES( AC_CHECK_FILE(tests, [AC_CONFIG_FILES(
tests/Makefile tests/Makefile
tests/libs/Makefile tests/libs/Makefile
tests/libs/zbxcommon/Makefile
tests/libs/zbxconf/Makefile tests/libs/zbxconf/Makefile
tests/libs/zbxdbcache/Makefile tests/libs/zbxdbcache/Makefile
tests/libs/zbxdbhigh/Makefile tests/libs/zbxdbhigh/Makefile
@ -1714,6 +1713,7 @@ AC_CHECK_FILE(tests, [AC_CONFIG_FILES(
tests/libs/zbxsysinfo/linux/Makefile tests/libs/zbxsysinfo/linux/Makefile
tests/libs/zbxsysinfo/common/Makefile tests/libs/zbxsysinfo/common/Makefile
tests/libs/zbxcommshigh/Makefile tests/libs/zbxcommshigh/Makefile
tests/libs/zbxcommon/Makefile
tests/libs/zbxalgo/Makefile tests/libs/zbxalgo/Makefile
) )
AC_DEFINE([HAVE_TESTS], [1], ["Define to 1 if tests directory is present"]) AC_DEFINE([HAVE_TESTS], [1], ["Define to 1 if tests directory is present"])

5
create/src/schema.tmpl

@ -1140,8 +1140,7 @@ FIELD |listen_ip |t_varchar(39) |'' |NOT NULL |0
FIELD |listen_port |t_integer |'0' |NOT NULL |0 FIELD |listen_port |t_integer |'0' |NOT NULL |0
FIELD |listen_dns |t_varchar(255) |'' |NOT NULL |0 FIELD |listen_dns |t_varchar(255) |'' |NOT NULL |0
FIELD |host_metadata |t_varchar(255) |'' |NOT NULL |0 FIELD |host_metadata |t_varchar(255) |'' |NOT NULL |0
INDEX |1 |host
INDEX |2 |proxy_hostid
INDEX |1 |proxy_hostid,host
TABLE|proxy_autoreg_host|id|0 TABLE|proxy_autoreg_host|id|0
FIELD |id |t_serial | |NOT NULL |0 FIELD |id |t_serial | |NOT NULL |0
@ -1621,4 +1620,4 @@ FIELD |itemid |t_id | |NOT NULL |0 |-|items
TABLE|dbversion|| TABLE|dbversion||
FIELD |mandatory |t_integer |'0' |NOT NULL | FIELD |mandatory |t_integer |'0' |NOT NULL |
FIELD |optional |t_integer |'0' |NOT NULL | FIELD |optional |t_integer |'0' |NOT NULL |
ROW |3050107 |3050107
ROW |3050101 |3050101

6
frontends/php/app/controllers/CControllerProblemView.php

@ -52,7 +52,7 @@ class CControllerProblemView extends CController {
'filter_age_state' => 'in 1', 'filter_age_state' => 'in 1',
'filter_age' => 'int32', 'filter_age' => 'int32',
'filter_inventory' => 'array', 'filter_inventory' => 'array',
'filter_evaltype' => 'in '.TAG_EVAL_TYPE_AND_OR.','.TAG_EVAL_TYPE_OR,
'filter_evaltype' => 'in '.TAG_EVAL_TYPE_AND.','.TAG_EVAL_TYPE_OR,
'filter_tags' => 'array', 'filter_tags' => 'array',
'filter_show_tags' => 'in '.PROBLEMS_SHOW_TAGS_NONE.','.PROBLEMS_SHOW_TAGS_1.','.PROBLEMS_SHOW_TAGS_2.','.PROBLEMS_SHOW_TAGS_3, 'filter_show_tags' => 'in '.PROBLEMS_SHOW_TAGS_NONE.','.PROBLEMS_SHOW_TAGS_1.','.PROBLEMS_SHOW_TAGS_2.','.PROBLEMS_SHOW_TAGS_3,
'filter_maintenance' => 'in 1', 'filter_maintenance' => 'in 1',
@ -143,7 +143,7 @@ class CControllerProblemView extends CController {
CProfile::updateArray('web.problem.filter.inventory.field', $filter_inventory['fields'], PROFILE_TYPE_STR); CProfile::updateArray('web.problem.filter.inventory.field', $filter_inventory['fields'], PROFILE_TYPE_STR);
CProfile::updateArray('web.problem.filter.inventory.value', $filter_inventory['values'], PROFILE_TYPE_STR); CProfile::updateArray('web.problem.filter.inventory.value', $filter_inventory['values'], PROFILE_TYPE_STR);
CProfile::update('web.problem.filter.evaltype', $this->getInput('filter_evaltype', TAG_EVAL_TYPE_AND_OR),
CProfile::update('web.problem.filter.evaltype', $this->getInput('filter_evaltype', TAG_EVAL_TYPE_AND),
PROFILE_TYPE_INT PROFILE_TYPE_INT
); );
@ -295,7 +295,7 @@ class CControllerProblemView extends CController {
'age' => CProfile::get('web.problem.filter.age', 14), 'age' => CProfile::get('web.problem.filter.age', 14),
'inventories' => $inventories, 'inventories' => $inventories,
'inventory' => $filter_inventory, 'inventory' => $filter_inventory,
'evaltype' => CProfile::get('web.problem.filter.evaltype', TAG_EVAL_TYPE_AND_OR),
'evaltype' => CProfile::get('web.problem.filter.evaltype', TAG_EVAL_TYPE_AND),
'tags' => $filter_tags, 'tags' => $filter_tags,
'show_tags' => CProfile::get('web.problem.filter.show_tags', PROBLEMS_SHOW_TAGS_3), 'show_tags' => CProfile::get('web.problem.filter.show_tags', PROBLEMS_SHOW_TAGS_3),
'maintenance' => CProfile::get('web.problem.filter.maintenance', 1), 'maintenance' => CProfile::get('web.problem.filter.maintenance', 1),

4
frontends/php/app/views/monitoring.problem.view.php

@ -221,8 +221,8 @@ if ($data['action'] == 'problem.view') {
$filter_tags_table->addRow( $filter_tags_table->addRow(
(new CCol( (new CCol(
(new CRadioButtonList('filter_evaltype', (int) $data['filter']['evaltype'])) (new CRadioButtonList('filter_evaltype', (int) $data['filter']['evaltype']))
->addValue(_('And/Or'), TAG_EVAL_TYPE_AND_OR)
->addValue(_('Or'), TAG_EVAL_TYPE_OR)
->addValue(_('AND'), TAG_EVAL_TYPE_AND)
->addValue(_('OR'), TAG_EVAL_TYPE_OR)
->setModern(true) ->setModern(true)
))->setColSpan(4) ))->setColSpan(4)
); );

4
frontends/php/include/actions.inc.php

@ -1083,12 +1083,8 @@ function getAllowedOperations($eventsource) {
OPERATION_TYPE_MESSAGE, OPERATION_TYPE_MESSAGE,
OPERATION_TYPE_COMMAND, OPERATION_TYPE_COMMAND,
OPERATION_TYPE_HOST_ADD, OPERATION_TYPE_HOST_ADD,
OPERATION_TYPE_HOST_REMOVE,
OPERATION_TYPE_GROUP_ADD, OPERATION_TYPE_GROUP_ADD,
OPERATION_TYPE_GROUP_REMOVE,
OPERATION_TYPE_TEMPLATE_ADD, OPERATION_TYPE_TEMPLATE_ADD,
OPERATION_TYPE_TEMPLATE_REMOVE,
OPERATION_TYPE_HOST_ENABLE,
OPERATION_TYPE_HOST_DISABLE, OPERATION_TYPE_HOST_DISABLE,
OPERATION_TYPE_HOST_INVENTORY OPERATION_TYPE_HOST_INVENTORY
]; ];

5
frontends/php/include/classes/api/services/CAction.php

@ -1578,9 +1578,8 @@ class CAction extends CApiService {
], ],
EVENT_SOURCE_AUTO_REGISTRATION => [ EVENT_SOURCE_AUTO_REGISTRATION => [
OPERATION_TYPE_MESSAGE, OPERATION_TYPE_COMMAND, OPERATION_TYPE_GROUP_ADD, OPERATION_TYPE_MESSAGE, OPERATION_TYPE_COMMAND, OPERATION_TYPE_GROUP_ADD,
OPERATION_TYPE_GROUP_REMOVE, OPERATION_TYPE_TEMPLATE_ADD, OPERATION_TYPE_TEMPLATE_REMOVE,
OPERATION_TYPE_HOST_ADD, OPERATION_TYPE_HOST_REMOVE, OPERATION_TYPE_HOST_ENABLE,
OPERATION_TYPE_HOST_DISABLE, OPERATION_TYPE_HOST_INVENTORY
OPERATION_TYPE_TEMPLATE_ADD, OPERATION_TYPE_HOST_ADD, OPERATION_TYPE_HOST_DISABLE,
OPERATION_TYPE_HOST_INVENTORY
], ],
EVENT_SOURCE_INTERNAL => [OPERATION_TYPE_MESSAGE] EVENT_SOURCE_INTERNAL => [OPERATION_TYPE_MESSAGE]
], ],

118
frontends/php/include/classes/api/services/CEvent.php

@ -87,7 +87,7 @@ class CEvent extends CApiService {
'eventid_from' => null, 'eventid_from' => null,
'eventid_till' => null, 'eventid_till' => null,
'acknowledged' => null, 'acknowledged' => null,
'evaltype' => TAG_EVAL_TYPE_AND_OR,
'evaltype' => TAG_EVAL_TYPE_AND,
'tags' => null, 'tags' => null,
'filter' => null, 'filter' => null,
'search' => null, 'search' => null,
@ -376,7 +376,55 @@ class CEvent extends CApiService {
// tags // tags
if ($options['tags'] !== null && $options['tags']) { if ($options['tags'] !== null && $options['tags']) {
$sqlParts['where'][] = self::getTagsWhereCondition($options['tags']);
$where = '';
$cnt = count($options['tags']);
foreach ($options['tags'] as $tag) {
if (!array_key_exists('value', $tag)) {
$tag['value'] = '';
}
if ($tag['value'] !== '') {
if (!array_key_exists('operator', $tag)) {
$tag['operator'] = TAG_OPERATOR_LIKE;
}
switch ($tag['operator']) {
case TAG_OPERATOR_EQUAL:
$tag['value'] = ' AND et.value='.zbx_dbstr($tag['value']);
break;
case TAG_OPERATOR_LIKE:
default:
$tag['value'] = str_replace('!', '!!', $tag['value']);
$tag['value'] = str_replace('%', '!%', $tag['value']);
$tag['value'] = str_replace('_', '!_', $tag['value']);
$tag['value'] = '%'.mb_strtoupper($tag['value']).'%';
$tag['value'] = ' AND UPPER(et.value) LIKE'.zbx_dbstr($tag['value'])." ESCAPE '!'";
}
}
elseif ($tag['operator'] == TAG_OPERATOR_EQUAL) {
$tag['value'] = ' AND et.value='.zbx_dbstr($tag['value']);
}
if ($where !== '') {
$where .= ($options['evaltype'] == TAG_EVAL_TYPE_OR) ? ' OR ' : ' AND ';
}
$where .= 'EXISTS ('.
'SELECT NULL'.
' FROM event_tag et'.
' WHERE e.eventid=et.eventid'.
' AND et.tag='.zbx_dbstr($tag['tag']).$tag['value'].
')';
}
// Add closing parenthesis if there are more than one OR statements.
if ($options['evaltype'] == TAG_EVAL_TYPE_OR && $cnt > 1) {
$where = '('.$where.')';
}
$sqlParts['where'][] = $where;
} }
// time_from // time_from
@ -441,70 +489,6 @@ class CEvent extends CApiService {
return $result; return $result;
} }
/**
* Returns SQL condition for tag filters.
*
* @param array $tags
* @param int $evaltype
* @param bool $is_events
*
* @return array
*/
public static function getTagsWhereCondition(array $tags, $evaltype, $is_events = true) {
$alias = $is_events ? 'et' : 'pt';
$parent_alias = $is_events ? 'e' : 'p';
$table = $is_events ? 'event_tag' : 'problem_tag';
$values_by_tag = [];
foreach ($tags as $tag) {
$operator = array_key_exists('operator', $tag) ? $tag['operator'] : TAG_OPERATOR_LIKE;
$value = array_key_exists('value', $tag) ? $tag['value'] : '';
if (!array_key_exists($tag['tag'], $values_by_tag) || is_array($values_by_tag[$tag['tag']])) {
if ($operator == TAG_OPERATOR_EQUAL) {
$values_by_tag[$tag['tag']][] = $alias.'.value='.zbx_dbstr($value);
}
elseif ($value !== '') {
$value = str_replace('!', '!!', $value);
$value = str_replace('%', '!%', $value);
$value = str_replace('_', '!_', $value);
$value = '%'.mb_strtoupper($value).'%';
$values_by_tag[$tag['tag']][] = 'UPPER('.$alias.'.value) LIKE '.zbx_dbstr($value)." ESCAPE '!'";
}
// ($value === '') - all other conditions can be omitted
else {
$values_by_tag[$tag['tag']] = false;
}
}
}
$sql_where = [];
foreach ($values_by_tag as $tag => $values) {
if (!is_array($values) || count($values) == 0) {
$values = '';
}
elseif (count($values) == 1) {
$values = ' AND '.$values[0];
}
else {
$values = $values ? ' AND ('.implode(' OR ', $values).')' : '';
}
$sql_where[] = 'EXISTS ('.
'SELECT NULL'.
' FROM '.$table.' '.$alias.
' WHERE '.$parent_alias.'.eventid='.$alias.'.eventid'.
' AND '.$alias.'.tag='.zbx_dbstr($tag).$values.
')';
}
$sql_where = implode(($evaltype == TAG_EVAL_TYPE_OR) ? ' OR ' : ' AND ', $sql_where);
return (count($values_by_tag) > 1 && $evaltype == TAG_EVAL_TYPE_OR) ? '('.$sql_where.')' : $sql_where;
}
/** /**
* Validates the input parameters for the get() method. * Validates the input parameters for the get() method.
* *
@ -533,7 +517,7 @@ class CEvent extends CApiService {
} }
$evaltype_validator = new CLimitedSetValidator([ $evaltype_validator = new CLimitedSetValidator([
'values' => [TAG_EVAL_TYPE_AND_OR, TAG_EVAL_TYPE_OR]
'values' => [TAG_EVAL_TYPE_AND, TAG_EVAL_TYPE_OR]
]); ]);
if (!$evaltype_validator->validate($options['evaltype'])) { if (!$evaltype_validator->validate($options['evaltype'])) {
self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect evaltype value.')); self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect evaltype value.'));

54
frontends/php/include/classes/api/services/CProblem.php

@ -66,7 +66,7 @@ class CProblem extends CApiService {
'eventid_from' => null, 'eventid_from' => null,
'eventid_till' => null, 'eventid_till' => null,
'acknowledged' => null, 'acknowledged' => null,
'evaltype' => TAG_EVAL_TYPE_AND_OR,
'evaltype' => TAG_EVAL_TYPE_AND,
'tags' => null, 'tags' => null,
'recent' => null, 'recent' => null,
'filter' => null, 'filter' => null,
@ -273,7 +273,55 @@ class CProblem extends CApiService {
// tags // tags
if ($options['tags'] !== null && $options['tags']) { if ($options['tags'] !== null && $options['tags']) {
$sqlParts['where'][] = CEvent::getTagsWhereCondition($options['tags'], $options['evaltype'], false);
$where = '';
$cnt = count($options['tags']);
foreach ($options['tags'] as $tag) {
if (!array_key_exists('value', $tag)) {
$tag['value'] = '';
}
if ($tag['value'] !== '') {
if (!array_key_exists('operator', $tag)) {
$tag['operator'] = TAG_OPERATOR_LIKE;
}
switch ($tag['operator']) {
case TAG_OPERATOR_EQUAL:
$tag['value'] = ' AND pt.value='.zbx_dbstr($tag['value']);
break;
case TAG_OPERATOR_LIKE:
default:
$tag['value'] = str_replace('!', '!!', $tag['value']);
$tag['value'] = str_replace('%', '!%', $tag['value']);
$tag['value'] = str_replace('_', '!_', $tag['value']);
$tag['value'] = '%'.mb_strtoupper($tag['value']).'%';
$tag['value'] = ' AND UPPER(pt.value) LIKE'.zbx_dbstr($tag['value'])." ESCAPE '!'";
}
}
elseif ($tag['operator'] == TAG_OPERATOR_EQUAL) {
$tag['value'] = ' AND pt.value='.zbx_dbstr($tag['value']);
}
if ($where !== '') {
$where .= ($options['evaltype'] == TAG_EVAL_TYPE_OR) ? ' OR ' : ' AND ';
}
$where .= 'EXISTS ('.
'SELECT NULL'.
' FROM problem_tag pt'.
' WHERE p.eventid=pt.eventid'.
' AND pt.tag='.zbx_dbstr($tag['tag']).$tag['value'].
')';
}
// Add closing parenthesis if there are more than one OR statements.
if ($options['evaltype'] == TAG_EVAL_TYPE_OR && $cnt > 1) {
$where = '('.$where.')';
}
$sqlParts['where'][] = $where;
} }
// recent // recent
@ -379,7 +427,7 @@ class CProblem extends CApiService {
} }
$evaltype_validator = new CLimitedSetValidator([ $evaltype_validator = new CLimitedSetValidator([
'values' => [TAG_EVAL_TYPE_AND_OR, TAG_EVAL_TYPE_OR]
'values' => [TAG_EVAL_TYPE_AND, TAG_EVAL_TYPE_OR]
]); ]);
if (!$evaltype_validator->validate($options['evaltype'])) { if (!$evaltype_validator->validate($options['evaltype'])) {
self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect evaltype value.')); self::exception(ZBX_API_ERROR_PARAMETERS, _('Incorrect evaltype value.'));

8
frontends/php/include/classes/widgets/CWidgetFormProblems.php

@ -83,12 +83,12 @@ class CWidgetFormProblems extends CWidgetForm {
} }
$this->fields[] = $field_severities; $this->fields[] = $field_severities;
// Tag evalype (And/Or).
// Tag evalype (AND/OR).
$field_evaltype = (new CWidgetFieldRadioButtonList('evaltype', _('Tags'), [ $field_evaltype = (new CWidgetFieldRadioButtonList('evaltype', _('Tags'), [
TAG_EVAL_TYPE_AND_OR => _('And/Or'),
TAG_EVAL_TYPE_OR => _('Or')
TAG_EVAL_TYPE_AND => _('AND'),
TAG_EVAL_TYPE_OR => _('OR')
])) ]))
->setDefault(TAG_EVAL_TYPE_AND_OR)
->setDefault(TAG_EVAL_TYPE_AND)
->setModern(true); ->setModern(true);
if (array_key_exists('evaltype', $this->data)) { if (array_key_exists('evaltype', $this->data)) {

6
frontends/php/include/defines.inc.php

@ -22,7 +22,7 @@
define('ZABBIX_VERSION', '4.0.0alpha8'); define('ZABBIX_VERSION', '4.0.0alpha8');
define('ZABBIX_API_VERSION', '4.0.0'); define('ZABBIX_API_VERSION', '4.0.0');
define('ZABBIX_EXPORT_VERSION', '4.0'); define('ZABBIX_EXPORT_VERSION', '4.0');
define('ZABBIX_DB_VERSION', 3050107);
define('ZABBIX_DB_VERSION', 3050101);
define('ZABBIX_COPYRIGHT_FROM', '2001'); define('ZABBIX_COPYRIGHT_FROM', '2001');
define('ZABBIX_COPYRIGHT_TO', '2018'); define('ZABBIX_COPYRIGHT_TO', '2018');
@ -889,8 +889,8 @@ define('EVENT_OBJECT_ITEM', 4);
define('EVENT_OBJECT_LLDRULE', 5); define('EVENT_OBJECT_LLDRULE', 5);
// Problem and event tag constants. // Problem and event tag constants.
define('TAG_EVAL_TYPE_AND_OR', 0);
define('TAG_EVAL_TYPE_OR', 2);
define('TAG_EVAL_TYPE_AND', 0);
define('TAG_EVAL_TYPE_OR', 1);
define('TAG_OPERATOR_LIKE', 0); define('TAG_OPERATOR_LIKE', 0);
define('TAG_OPERATOR_EQUAL', 1); define('TAG_OPERATOR_EQUAL', 1);

9
frontends/php/include/html.inc.php

@ -756,11 +756,16 @@ function getItemLifetimeIndicator($current_time, $ts_delete) {
* *
* @param string $name * @param string $name
* @param int|array $date unix timestamp/date array(Y,m,d,H,i) * @param int|array $date unix timestamp/date array(Y,m,d,H,i)
* @param string|null $relatedCalendar name of the calendar which must be closed when this calendar opens
* *
* @return array * @return array
*/ */
function createDateSelector($name, $date) {
$onClick = 'dateSelectorOnClick(event, this, "'.$name.'_calendar");';
function createDateSelector($name, $date, $relatedCalendar = null) {
$onClick = 'var pos = getPosition(this); pos.top += 10; pos.left += 16; CLNDR["'.$name.
'_calendar"].clndr.clndrshow(pos.top, pos.left, this);';
if ($relatedCalendar) {
$onClick .= ' CLNDR["'.$relatedCalendar.'_calendar"].clndr.clndrhide();';
}
if (is_array($date)) { if (is_array($date)) {
$y = $date['y']; $y = $date['y'];

4
frontends/php/include/views/configuration.maintenance.edit.php

@ -93,8 +93,8 @@ else {
} }
$maintenanceForm->addVar('active_till', $activeTill); $maintenanceForm->addVar('active_till', $activeTill);
$maintenanceFormList->addRow(_('Active since'), createDateSelector('active_since', $fromDate));
$maintenanceFormList->addRow(_('Active till'), createDateSelector('active_till', $toDate));
$maintenanceFormList->addRow(_('Active since'), createDateSelector('active_since', $fromDate, 'active_till'));
$maintenanceFormList->addRow(_('Active till'), createDateSelector('active_till', $toDate, 'active_since'));
$maintenanceFormList->addRow(_('Description'), $maintenanceFormList->addRow(_('Description'),
(new CTextArea('description', $this->data['description']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH) (new CTextArea('description', $this->data['description']))->setWidth(ZBX_TEXTAREA_STANDARD_WIDTH)

4
frontends/php/include/views/configuration.services.edit.php

@ -284,11 +284,11 @@ if ($this->data['new_service_time']['type'] == SERVICE_TIME_TYPE_ONETIME_DOWNTIM
) )
->addRow( ->addRow(
(new CLabel(_('From'), 'new_service_time_from'))->setAsteriskMark(), (new CLabel(_('From'), 'new_service_time_from'))->setAsteriskMark(),
(new CDiv(createDateSelector('new_service_time_from', $fromDate)))
(new CDiv(createDateSelector('new_service_time_from', $fromDate, 'new_service_time_to')))
) )
->addRow( ->addRow(
(new CLabel(_('Till'), 'new_service_time_to'))->setAsteriskMark(), (new CLabel(_('Till'), 'new_service_time_to'))->setAsteriskMark(),
(new CDiv(createDateSelector('new_service_time_to', $toDate)))
(new CDiv(createDateSelector('new_service_time_to', $toDate, 'new_service_time_from')))
); );
} }
else { else {

472
frontends/php/js/class.calendar.js

@ -21,43 +21,14 @@
var CLNDR = new Array(); var CLNDR = new Array();
var calendar = Class.create(); var calendar = Class.create();
function getCalendarByID(clndr_id) {
var ret = null;
jQuery(CLNDR).each(function(i, obj) {
if (obj.clndr.id === clndr_id) {
ret = obj;
return;
}
});
return ret;
}
function create_calendar(time, timeobjects, id, utime_field_id, parentNodeid) { function create_calendar(time, timeobjects, id, utime_field_id, parentNodeid) {
if (typeof id === 'undefined' || id === null) {
id = 'c' + CLNDR.length;
}
if (typeof utime_field_id === 'undefined') {
id = id || CLNDR.length;
if ('undefined' == typeof(utime_field_id)) {
utime_field_id = null; utime_field_id = null;
} }
var clndr = new Object;
clndr.clndr = new calendar(id, time, timeobjects, utime_field_id, parentNodeid);
CLNDR.push(clndr);
return clndr;
}
function dateSelectorOnClick(event, elmnt, name) {
var pos = getPosition(elmnt);
// This way calendar will never overlap with selector.
pos.top += elmnt.offsetHeight;
pos.left += elmnt.offsetWidth;
getCalendarByID(name).clndr.clndrshow(pos.top, pos.left, elmnt);
event.stopPropagation();
CLNDR[id] = new Object;
CLNDR[id].clndr = new calendar(id, time, timeobjects, utime_field_id, parentNodeid);
return CLNDR[id];
} }
calendar.prototype = { calendar.prototype = {
@ -70,29 +41,23 @@ calendar.prototype = {
hour: 12, // hours hour: 12, // hours
minute: 00, // minutes minute: 00, // minutes
clndr_calendar: null, // html obj of calendar clndr_calendar: null, // html obj of calendar
clndr_month_div: null, // html obj
clndr_year_div: null, // html obj
clndr_minute: null, // html from obj
clndr_hour: null, // html from obj
clndr_days: null, // html obj clndr_days: null, // html obj
clndr_month: null, // html obj clndr_month: null, // html obj
clndr_year: null, // html obj clndr_year: null, // html obj
clndr_selectedday: null, // html obj, selected day clndr_selectedday: null, // html obj, selected day
clndr_year_wrap: null, // html obj
clndr_month_wrap: null, // html obj
clndr_monthup: null, // html bttn obj clndr_monthup: null, // html bttn obj
clndr_monthdown: null, // html bttn obj clndr_monthdown: null, // html bttn obj
clndr_yearup: null, // html bttn obj clndr_yearup: null, // html bttn obj
clndr_yeardown: null, // html bttn obj clndr_yeardown: null, // html bttn obj
clndr_now: null, // html bttn obj
clndr_done: null, // html bttn obj
clndr_utime_field: null, // html obj where unix date representation is saved clndr_utime_field: null, // html obj where unix date representation is saved
timeobjects: new Array(), // object list where will be saved date timeobjects: new Array(), // object list where will be saved date
status: false, // status of timeobjects status: false, // status of timeobjects
visible: 0, // GMenu style state visible: 0, // GMenu style state
hl_month: null, // highlighted month number
hl_year: null, // highlighted year number
hl_day: null, // highlighted days number
active_section: null, // Active calendar section. See 'sections' array. Default value set in method clndrshow.
monthname: new Array(locale['S_JANUARY'], locale['S_FEBRUARY'], locale['S_MARCH'], locale['S_APRIL'], locale['S_MAY'], locale['S_JUNE'], locale['S_JULY'], locale['S_AUGUST'], locale['S_SEPTEMBER'], locale['S_OCTOBER'], locale['S_NOVEMBER'], locale['S_DECEMBER']), monthname: new Array(locale['S_JANUARY'], locale['S_FEBRUARY'], locale['S_MARCH'], locale['S_APRIL'], locale['S_MAY'], locale['S_JUNE'], locale['S_JULY'], locale['S_AUGUST'], locale['S_SEPTEMBER'], locale['S_OCTOBER'], locale['S_NOVEMBER'], locale['S_DECEMBER']),
dayname: new Array(locale['S_SUNDAY'], locale['S_MONDAY'], locale['S_TUESDAY'], locale['S_WEDNESDAY'], locale['S_THURSDAY'], locale['S_FRIDAY'], locale['S_SATURDAY']),
sections: new Array('.calendar-year', '.calendar-month', '.calendar-date'),
initialize: function(id, stime, timeobjects, utime_field_id, parentNodeid) { initialize: function(id, stime, timeobjects, utime_field_id, parentNodeid) {
this.id = id; this.id = id;
@ -106,6 +71,10 @@ calendar.prototype = {
addListener(this.clndr_monthup, 'click', this.monthup.bindAsEventListener(this)); addListener(this.clndr_monthup, 'click', this.monthup.bindAsEventListener(this));
addListener(this.clndr_yeardown, 'click', this.yeardown.bindAsEventListener(this)); addListener(this.clndr_yeardown, 'click', this.yeardown.bindAsEventListener(this));
addListener(this.clndr_yearup, 'click', this.yearup.bindAsEventListener(this)); addListener(this.clndr_yearup, 'click', this.yearup.bindAsEventListener(this));
addListener(this.clndr_hour, 'blur', this.sethour.bindAsEventListener(this));
addListener(this.clndr_minute, 'blur', this.setminute.bindAsEventListener(this));
addListener(this.clndr_now, 'click', this.setNow.bindAsEventListener(this));
addListener(this.clndr_done, 'click', this.setDone.bindAsEventListener(this));
for (var i = 0; i < this.timeobjects.length; i++) { for (var i = 0; i < this.timeobjects.length; i++) {
if (typeof(this.timeobjects[i]) != 'undefined' && !empty(this.timeobjects[i])) { if (typeof(this.timeobjects[i]) != 'undefined' && !empty(this.timeobjects[i])) {
@ -129,16 +98,6 @@ calendar.prototype = {
if (!is_null(utime_field_id)) { if (!is_null(utime_field_id)) {
this.clndr_utime_field = utime_field_id; this.clndr_utime_field = utime_field_id;
} }
var cal_obj = this;
jQuery(this.sections).each(function(index, item) {
jQuery(item, cal_obj.clndr_calendar)
.attr({'tabindex': '0'})
.on('click', function() {
cal_obj.active_section = index;
cal_obj.focusSection();
});
});
}, },
ondateselected: function() { ondateselected: function() {
@ -158,16 +117,6 @@ calendar.prototype = {
this.clndr_calendar.hide(); this.clndr_calendar.hide();
this.visible = 0; this.visible = 0;
// Unset higlighted date.
this.hl_month = null;
this.hl_year = null;
this.hl_day = null;
jQuery(document)
.off('click', this.calendarDocumentClickHandler)
.off('keydown', this.calendarKeyDownHandler)
.off('keyup', this.calendarKeyUpHandler);
removeFromOverlaysStack(this.id.toString()); removeFromOverlaysStack(this.id.toString());
}, },
@ -176,13 +125,6 @@ calendar.prototype = {
this.clndrhide(); this.clndrhide();
} }
else { else {
// Close all opened calendars.
jQuery(CLNDR).each(function(i, cal) {
if (cal.clndr.visible == 1 && cal.clndr.id != this.id) {
cal.clndr.clndrhide();
}
});
if (this.status) { if (this.status) {
this.setSDateFromOuterObj(); this.setSDateFromOuterObj();
this.cdt.setTime(this.sdt.getTime()); this.cdt.setTime(this.sdt.getTime());
@ -190,222 +132,15 @@ calendar.prototype = {
this.syncBSDateBySDT(); this.syncBSDateBySDT();
this.setCDate(); this.setCDate();
} }
if (typeof(top) != 'undefined' && typeof(left) != 'undefined') {
var cw = jQuery(this.clndr_calendar).outerWidth();
if (document.body.clientWidth < +left + cw) {
left = document.body.clientWidth - cw;
}
if ('undefined' != typeof(top) && 'undefined' != typeof(left)) {
this.clndr_calendar.style.top = top + 'px'; this.clndr_calendar.style.top = top + 'px';
this.clndr_calendar.style.left = left + 'px'; this.clndr_calendar.style.left = left + 'px';
} }
this.clndr_calendar.show(); this.clndr_calendar.show();
this.visible = 1; this.visible = 1;
jQuery(document)
.on('keydown', {calendar: this}, this.calendarKeyDownHandler)
.on('keyup', {calendar: this}, this.calendarKeyUpHandler)
.on('click', this.calendarDocumentClickHandler);
overlayDialogueOnLoad(true, this.clndr_calendar);
addToOverlaysStack(this.id, trigger_elmnt, 'clndr'); addToOverlaysStack(this.id, trigger_elmnt, 'clndr');
this.active_section = this.sections.indexOf('.calendar-date');
this.focusSection();
}
},
calendarDocumentClickHandler: function() {
jQuery(CLNDR).each(function(i, cal) {
if (cal.clndr.visible == 1) {
cal.clndr.clndrhide();
}
});
},
/**
* This function is workaround for Firefox bug.
*
* When triggering keydown event on [space] button, event is called for both, the actual element as well as calendar
* icon elemnet, so the calendar is first closed (by handeler of actually focused element) and immediately opened
* again (by calendar icon element's handler).
*
* Workaround works as follow - it separates [enter] and [space] button in 2 handlers with similar functionality
* (since pressing [space] and [enter] does the same thing in calendar). Keyup handles the [space] click event,
* while other keyboard events are handled by keydown event.
*/
calendarKeyUpHandler: function(event) {
var cal = event.data.calendar;
if (event.which == 32) { // Space
// Enter has special meaning for each Calendar section.
var active_section = cal.sections[cal.active_section];
if (active_section === '.calendar-year' || active_section === '.calendar-month') {
cal.active_section++;
cal.focusSection();
}
else if (active_section === '.calendar-date') {
cal.setday(event, cal.hl_day, cal.hl_month, cal.hl_year);
}
return false; // Prevent page scrolling when pressing Space.
}
},
calendarKeyDownHandler: function(event) {
var cal = event.data.calendar,
hl_date;
if (cal.active_section < 0 || cal.active_section > cal.sections.length) {
cal.active_section = 0;
}
switch (event.which) {
case 37: // arrow left
case 38: // arrow up
case 39: // arrow right
case 40: // arrow down
switch (cal.sections[cal.active_section]) {
case '.calendar-date':
if (cal.hl_month === null || cal.hl_day === null || cal.hl_year === null) {
cal.hl_year = cal.year;
cal.hl_month = cal.month;
cal.hl_day = cal.day;
}
hl_date = new Date(cal.hl_year, cal.hl_month, cal.hl_day, 0, 0, 0, 0);
switch (event.which) {
case 37: // arrow left
hl_date.setDate(hl_date.getDate() - 1);
break;
case 38: // arrow up
hl_date.setDate(hl_date.getDate() - 7);
break;
case 39: // arrow right
hl_date.setDate(hl_date.getDate() + 1);
break;
case 40: // arrow down
hl_date.setDate(hl_date.getDate() + 7);
break;
}
cal.hl_year = hl_date.getFullYear();
cal.hl_month = hl_date.getMonth();
cal.hl_day = hl_date.getDate();
jQuery('td.highlighted', cal.clndr_calendar)
.removeClass('highlighted')
.attr('tabindex', '-1');
if (cal.hl_year != cal.year || cal.hl_month != cal.month) {
cal.year = cal.hl_year;
cal.month = cal.hl_month;
cal.day = cal.hl_day;
cal.syncCDT();
cal.setCDate();
}
jQuery('td[data-date='+cal.hl_day+']', cal.clndr_calendar)
.addClass('highlighted')
.attr('tabindex', '0')
.focus();
break;
case '.calendar-year':
// Arrow left or arrow down.
if (event.which == 37 || event.which == 40) {
cal.yeardown();
}
// Arrow right or arrow up.
else if (event.which == 38 || event.which == 39) {
cal.yearup();
}
break;
case '.calendar-month':
// Arrow left or arrow down.
if (event.which == 37 || event.which == 40) {
cal.monthdown();
}
// Arrow right or arrow up.
else if (event.which == 38 || event.which == 39) {
cal.monthup();
}
break;
}
// Prevent page scrolling.
event.preventDefault();
break;
case 9: // Tab
event.preventDefault();
if (event.shiftKey) {
cal.active_section--;
if (cal.active_section < 0) {
cal.active_section = cal.sections.length - 1;
}
}
else {
cal.active_section++;
if (cal.active_section >= cal.sections.length) {
cal.active_section = 0;
}
}
cal.focusSection();
break;
case 13: // Enter
// Enter has special meaning for each Calendar section.
var active_section = cal.sections[cal.active_section];
if (active_section === '.calendar-year' || active_section === '.calendar-month') {
cal.active_section++;
cal.focusSection();
}
else if (active_section === '.calendar-date') {
cal.setday(event, cal.hl_day, cal.hl_month, cal.hl_year);
}
return false;
break;
case 32: // Prevent page scrolling when pressing Space.
return false;
}
},
focusSection: function() {
var section_to_focus = this.sections[this.active_section];
jQuery('.highlighted', this.clndr_calendar).removeClass('highlighted').blur();
if (section_to_focus === '.calendar-year' || section_to_focus === '.calendar-month') {
jQuery(section_to_focus, this.clndr_calendar).addClass('highlighted').focus();
}
else if (section_to_focus === '.calendar-date') {
this.hl_year = this.hl_year || this.year;
this.hl_month = this.hl_month || this.month;
this.hl_day = this.hl_day || this.day;
/**
* Switching between months and years, date picker will highlight previously selected date. If
* selected date is in different year or month, the first date of displayed year is highleghted.
* Same happens also if the number of dates in selected month is smaller than selected date in different
* month.
*/
if (this.hl_year != this.year || this.hl_month != this.month
|| new Date(this.year, this.month + 1, 0).getDate() < this.hl_day) {
this.hl_day = 1;
}
jQuery('td[data-date='+this.hl_day+']', this.clndr_calendar)
.addClass('highlighted')
.attr('tabindex', '0')
.focus();
} }
}, },
@ -483,8 +218,8 @@ calendar.prototype = {
var result = true; var result = true;
for (var i = 0; i < this.timeobjects.length; i++) { for (var i = 0; i < this.timeobjects.length; i++) {
if ('undefined' !== this.timeobjects[i] && !empty(this.timeobjects[i])) {
if (this.timeobjects[i].tagName.toLowerCase() === 'input') {
if ('undefined' != this.timeobjects[i] && !empty(this.timeobjects[i])) {
if (this.timeobjects[i].tagName.toLowerCase() == 'input') {
val[i] = this.timeobjects[i].value; val[i] = this.timeobjects[i].value;
} }
else { else {
@ -589,16 +324,10 @@ calendar.prototype = {
this.year = now.getFullYear(); this.year = now.getFullYear();
this.hour = now.getHours(); this.hour = now.getHours();
this.minute = now.getMinutes(); this.minute = now.getMinutes();
this.hl_year = this.year;
this.hl_month = this.month;
this.hl_day = this.day;
this.syncSDT(); this.syncSDT();
this.syncBSDateBySDT(); this.syncBSDateBySDT();
this.syncCDT(); this.syncCDT();
this.setCDate(); this.setCDate();
this.active_section = this.sections.indexOf('.calendar-date');
this.focusSection();
}, },
setDone: function() { setDone: function() {
@ -606,30 +335,44 @@ calendar.prototype = {
this.ondateselected(); this.ondateselected();
}, },
setminute: function() {
var minute = parseInt(this.clndr_minute.value, 10);
if (minute > -1 && minute < 60) {
this.minute = minute;
this.syncSDT();
}
else {
this.clndr_minute.value = this.minute;
}
},
sethour: function() {
var hour = parseInt(this.clndr_hour.value, 10);
if (hour > -1 && hour < 24) {
this.hour = hour;
this.syncSDT();
}
else {
this.clndr_hour.value = this.hour;
}
},
setday: function(e, day, month, year) { setday: function(e, day, month, year) {
if (!is_null(this.clndr_selectedday)) { if (!is_null(this.clndr_selectedday)) {
this.clndr_selectedday.removeClassName('selected'); this.clndr_selectedday.removeClassName('selected');
this.clndr_selectedday.setAttribute('tabindex', '-1');
} }
var selectedday = Event.element(e); var selectedday = Event.element(e);
if (selectedday.tagName === 'SPAN') {
selectedday = selectedday.parentNode;
}
Element.extend(selectedday); Element.extend(selectedday);
this.clndr_selectedday = selectedday; this.clndr_selectedday = selectedday;
this.clndr_selectedday.addClassName('selected'); this.clndr_selectedday.addClassName('selected');
this.clndr_selectedday.setAttribute('tabindex', '0');
this.day = day; this.day = day;
this.month = month; this.month = month;
this.year = year; this.year = year;
this.hl_day = day;
this.hl_month = month;
this.hl_year = year;
this.syncSDT(); this.syncSDT();
this.syncBSDateBySDT(); this.syncBSDateBySDT();
this.syncCDT(); this.syncCDT();
this.setDone();
this.setCDate();
}, },
monthup: function() { monthup: function() {
@ -649,9 +392,6 @@ calendar.prototype = {
this.syncCDT(); this.syncCDT();
this.setCDate(); this.setCDate();
} }
this.hl_month = this.month;
this.hl_year = this.year;
}, },
monthdown: function() { monthdown: function() {
@ -671,9 +411,6 @@ calendar.prototype = {
this.syncCDT(); this.syncCDT();
this.setCDate(); this.setCDate();
} }
this.hl_month = this.month;
this.hl_year = this.year;
}, },
yearup: function() { yearup: function() {
@ -683,7 +420,6 @@ calendar.prototype = {
this.year++; this.year++;
this.syncCDT(); this.syncCDT();
this.setCDate(); this.setCDate();
this.hl_year = this.year;
}, },
yeardown: function() { yeardown: function() {
@ -693,7 +429,6 @@ calendar.prototype = {
this.year--; this.year--;
this.syncCDT(); this.syncCDT();
this.setCDate(); this.setCDate();
this.hl_year = this.year;
}, },
syncBSDateBySDT: function() { syncBSDateBySDT: function() {
@ -713,6 +448,10 @@ calendar.prototype = {
}, },
setCDate: function() { setCDate: function() {
this.clndr_minute.value = this.minute;
this.clndr_minute.onchange();
this.clndr_hour.value = this.hour;
this.clndr_hour.onchange();
this.clndr_month.textContent = this.monthname[this.month]; this.clndr_month.textContent = this.monthname[this.month];
this.clndr_year.textContent = this.year; this.clndr_year.textContent = this.year;
this.createDaysTab(); this.createDaysTab();
@ -735,8 +474,6 @@ calendar.prototype = {
for (var y = 0; y < 6; y++) { for (var y = 0; y < 6; y++) {
var tr = document.createElement('tr'); var tr = document.createElement('tr');
tr.setAttribute('role', 'presentation');
tbody.appendChild(tr); tbody.appendChild(tr);
for (var x = 0; x < 7; x++) { for (var x = 0; x < 7; x++) {
var td = document.createElement('td'); var td = document.createElement('td');
@ -746,9 +483,6 @@ calendar.prototype = {
if (cur_month != this.cdt.getMonth()) { if (cur_month != this.cdt.getMonth()) {
td.addClassName('grey'); td.addClassName('grey');
} }
else {
td.setAttribute('data-date', this.cdt.getDate());
}
if (this.sdt.getFullYear() == this.cdt.getFullYear() if (this.sdt.getFullYear() == this.cdt.getFullYear()
&& this.sdt.getMonth() == this.cdt.getMonth() && this.sdt.getMonth() == this.cdt.getMonth()
@ -757,39 +491,19 @@ calendar.prototype = {
this.clndr_selectedday = td; this.clndr_selectedday = td;
} }
td.setAttribute('aria-label', this.calendarGetReadableDate(this.cdt));
td.setAttribute('tabindex', '-1');
td.setAttribute('role', 'button');
var span = document.createElement('span');
span.setAttribute('aria-hidden', 'true');
span.appendChild(document.createTextNode(this.cdt.getDate()));
td.appendChild(span);
addListener(td, 'click', this.setday.bindAsEventListener(this, this.cdt.getDate(), this.cdt.getMonth(), this.cdt.getFullYear())); addListener(td, 'click', this.setday.bindAsEventListener(this, this.cdt.getDate(), this.cdt.getMonth(), this.cdt.getFullYear()));
td.appendChild(document.createTextNode(this.cdt.getDate()));
this.cdt.setTime(this.cdt.getTime() + 86400000); // + 1day this.cdt.setTime(this.cdt.getTime() + 86400000); // + 1day
} }
} }
}, },
calendarGetReadableDate: function(cdt) {
return cdt.getDate() + ', ' + this.dayname[cdt.getDay()] + ' ' + this.monthname[cdt.getMonth()] + ' ' +
cdt.getFullYear();
},
calendarcreate: function(parentNodeid) { calendarcreate: function(parentNodeid) {
this.clndr_calendar = document.createElement('div'); this.clndr_calendar = document.createElement('div');
Element.extend(this.clndr_calendar); Element.extend(this.clndr_calendar);
this.clndr_calendar.className = 'overlay-dialogue calendar'; this.clndr_calendar.className = 'overlay-dialogue calendar';
this.clndr_calendar.setAttribute('aria-label', locale['S_Calendar']);
this.clndr_calendar.setAttribute('role', 'application');
this.clndr_calendar.setAttribute('tabindex', '0');
this.clndr_calendar.hide(); this.clndr_calendar.hide();
this.clndr_calendar.on('click', function(event) {
event.stopPropagation();
Mirrors/php - php - Gitea: Git with a cup of tea
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
4.4 KiB

  1. <?xml version="1.0" encoding="ISO-8859-1" ?>
  2. <!DOCTYPE package SYSTEM "../pear/package.dtd">
  3. <package>
  4. <name>SQLite</name>
  5. <summary>SQLite database bindings</summary>
  6. <maintainers>
  7. <maintainer>
  8. <user>wez</user>
  9. <name>Wez Furlong</name>
  10. <email>wez@php.net</email>
  11. <role>lead</role>
  12. </maintainer>
  13. <maintainer>
  14. <user>tal</user>
  15. <name>Tal Peer</name>
  16. <email>tal@php.net</email>
  17. <role>developer</role>
  18. </maintainer>
  19. <maintainer>
  20. <user>helly</user>
  21. <name>Marcus B�rger</name>
  22. <email>helly@php.net</email>
  23. <role>lead</role>
  24. </maintainer>
  25. <maintainer>
  26. <user>iliaa</user>
  27. <name>Ilia Alshanetsky</name>
  28. <email>ilia@php.net</email>
  29. <role>developer</role>
  30. </maintainer>
  31. </maintainers>
  32. <description>
  33. SQLite is a C library that implements an embeddable SQL database engine.
  34. Programs that link with the SQLite library can have SQL database access
  35. without running a separate RDBMS process.
  36. This extension allows you to access SQLite databases from within PHP.
  37. Windows binary available from:
  38. http://snaps.php.net/win32/PECL_STABLE/php_sqlite.dll
  39. </description>
  40. <license>PHP</license>
  41. <release>
  42. <state>stable</state>
  43. <version>2.0-dev</version>
  44. <date>TBA</date>
  45. <notes>
  46. Added:
  47. OO API (Marcus).
  48. </notes>
  49. <filelist>
  50. <file role="src" name="config.m4"/>
  51. <file role="src" name="config.w32"/>
  52. <file role="src" name="sqlite.c"/>
  53. <file role="src" name="sqlite.dsp"/>
  54. <file role="src" name="php_sqlite.h"/>
  55. <file role="src" name="php_sqlite.def"/>
  56. <file role="doc" name="CREDITS"/>
  57. <file role="doc" name="README"/>
  58. <file role="doc" name="TODO"/>
  59. <file role="doc" name="sqlite.php"/>
  60. <file role="test" name="tests/sqlite_001.phpt"/>
  61. <file role="test" name="tests/sqlite_002.phpt"/>
  62. <file role="test" name="tests/sqlite_003.phpt"/>
  63. <file role="test" name="tests/sqlite_004.phpt"/>
  64. <file role="test" name="tests/sqlite_005.phpt"/>
  65. <file role="test" name="tests/sqlite_006.phpt"/>
  66. <file role="test" name="tests/sqlite_007.phpt"/>
  67. <file role="test" name="tests/sqlite_008.phpt"/>
  68. <file role="test" name="tests/sqlite_009.phpt"/>
  69. <file role="test" name="tests/sqlite_010.phpt"/>
  70. <file role="test" name="tests/sqlite_011.phpt"/>
  71. <file role="test" name="tests/sqlite_012.phpt"/>
  72. <file role="test" name="tests/sqlite_013.phpt"/>
  73. <file role="test" name="tests/sqlite_014.phpt"/>
  74. <file role="test" name="tests/sqlite_015.phpt"/>
  75. <file role="test" name="tests/sqlite_016.phpt"/>
  76. <file role="test" name="tests/sqlite_017.phpt"/>
  77. <file role="test" name="tests/blankdb.inc"/>
  78. <dir name="libsqlite">
  79. <file role="doc" name="README"/>
  80. <file role="src" name="VERSION"/>
  81. <dir name="src">
  82. <file role="src" name="attach.c"/>
  83. <file role="src" name="auth.c"/>
  84. <file role="src" name="btree.c"/>
  85. <file role="src" name="btree_rb.c"/>
  86. <file role="src" name="build.c"/>
  87. <file role="src" name="copy.c"/>
  88. <file role="src" name="delete.c"/>
  89. <file role="src" name="encode.c"/>
  90. <file role="src" name="expr.c"/>
  91. <file role="src" name="func.c"/>
  92. <file role="src" name="hash.c"/>
  93. <file role="src" name="insert.c"/>
  94. <file role="src" name="main.c"/>
  95. <file role="src" name="opcodes.c"/>
  96. <file role="src" name="os.c"/>
  97. <file role="src" name="pager.c"/>
  98. <file role="src" name="parse.c"/>
  99. <file role="src" name="parse.y"/>
  100. <file role="src" name="pragma.c"/>
  101. <file role="src" name="printf.c"/>
  102. <file role="src" name="random.c"/>
  103. <file role="src" name="select.c"/>
  104. <file role="src" name="table.c"/>
  105. <file role="src" name="tokenize.c"/>
  106. <file role="src" name="trigger.c"/>
  107. <file role="src" name="update.c"/>
  108. <file role="src" name="util.c"/>
  109. <file role="src" name="vacuum.c"/>
  110. <file role="src" name="vdbe.c"/>
  111. <file role="src" name="where.c"/>
  112. <file role="src" name="btree.h"/>
  113. <file role="src" name="hash.h"/>
  114. <file role="src" name="opcodes.h"/>
  115. <file role="src" name="os.h"/>
  116. <file role="src" name="pager.h"/>
  117. <file role="src" name="parse.h"/>
  118. <file role="src" name="sqlite_config.w32.h"/>
  119. <file role="src" name="sqlite.h.in"/>
  120. <file role="src" name="sqliteInt.h"/>
  121. <file role="src" name="sqlite.w32.h"/>
  122. <file role="src" name="vdbe.h"/>
  123. </dir>
  124. </dir>
  125. </filelist>
  126. <deps>
  127. <dep type="php" rel="ge" version="5" />
  128. </deps>
  129. </release>
  130. </package>
  131. <!--
  132. vim:et:ts=1:sw=1
  133. -->