diff options
author | Mārtiņš Tālbergs <martins.talbergs@zabbix.com> | 2020-06-29 13:46:14 +0300 |
---|---|---|
committer | Mārtiņš Tālbergs <martins.talbergs@zabbix.com> | 2020-06-29 13:46:14 +0300 |
commit | 6e2a7deaccfee1c50c7863aac4fd1bed0fb15cc9 (patch) | |
tree | 75223d729e886ed15746b0171bdd1c08f0608b5f | |
parent | 8037cf6b7a4ab2f384b678f6843301030b4ca675 (diff) |
..F....... [ZBX-17955] renamed references from "users_medias" to "medias" in forms
-rw-r--r-- | ui/app/controllers/CControllerUserCreate.php | 4 | ||||
-rw-r--r-- | ui/app/controllers/CControllerUserEdit.php | 8 | ||||
-rw-r--r-- | ui/app/controllers/CControllerUserEditGeneral.php | 18 | ||||
-rw-r--r-- | ui/app/controllers/CControllerUserProfileEdit.php | 6 | ||||
-rw-r--r-- | ui/app/controllers/CControllerUserProfileUpdate.php | 4 | ||||
-rw-r--r-- | ui/app/controllers/CControllerUserUpdate.php | 4 | ||||
-rw-r--r-- | ui/app/views/administration.user.edit.php | 6 | ||||
-rw-r--r-- | ui/app/views/js/administration.user.edit.common.js.php | 20 | ||||
-rw-r--r-- | ui/js/common.js | 2 |
9 files changed, 36 insertions, 36 deletions
diff --git a/ui/app/controllers/CControllerUserCreate.php b/ui/app/controllers/CControllerUserCreate.php index f976275f629..ef15b7e8637 100644 --- a/ui/app/controllers/CControllerUserCreate.php +++ b/ui/app/controllers/CControllerUserCreate.php @@ -34,7 +34,7 @@ class CControllerUserCreate extends CControllerUserUpdateGeneral { 'password2' => 'required|string', 'type' => 'db users.type|in '.USER_TYPE_ZABBIX_USER.','.USER_TYPE_ZABBIX_ADMIN.','.USER_TYPE_SUPER_ADMIN, 'user_groups' => 'required|array_id|not_empty', - 'user_medias' => 'array', + 'medias' => 'array', 'lang' => 'db users.lang|in '.implode(',', $locales), 'theme' => 'db users.theme|in '.implode(',', $themes), 'autologin' => 'db users.autologin|in 0,1', @@ -89,7 +89,7 @@ class CControllerUserCreate extends CControllerUserUpdateGeneral { $user['medias'] = []; - foreach ($this->getInput('user_medias', []) as $media) { + foreach ($this->getInput('medias', []) as $media) { $user['medias'][] = [ 'mediatypeid' => $media['mediatypeid'], 'sendto' => $media['sendto'], diff --git a/ui/app/controllers/CControllerUserEdit.php b/ui/app/controllers/CControllerUserEdit.php index ddb93ff02d9..00e6950f628 100644 --- a/ui/app/controllers/CControllerUserEdit.php +++ b/ui/app/controllers/CControllerUserEdit.php @@ -45,7 +45,7 @@ class CControllerUserEdit extends CControllerUserEditGeneral { 'refresh' => 'db users.refresh', 'rows_per_page' => 'db users.rows_per_page', 'url' => 'db users.url', - 'user_medias' => 'array', + 'medias' => 'array', 'new_media' => 'array', 'enable_media' => 'int32', 'disable_media' => 'int32', @@ -106,7 +106,7 @@ class CControllerUserEdit extends CControllerUserEditGeneral { 'refresh' => $db_defaults['refresh'], 'rows_per_page' => $db_defaults['rows_per_page'], 'url' => '', - 'user_medias' => [], + 'medias' => [], 'new_media' => [], 'type' => $db_defaults['type'], 'config' => [ @@ -140,7 +140,7 @@ class CControllerUserEdit extends CControllerUserEditGeneral { $data['refresh'] = $this->user['refresh']; $data['rows_per_page'] = $this->user['rows_per_page']; $data['url'] = $this->user['url']; - $data['user_medias'] = $this->user['medias']; + $data['medias'] = $this->user['medias']; $data['type'] = $this->user['type']; $data['db_user']['alias'] = $this->user['alias']; } @@ -154,7 +154,7 @@ class CControllerUserEdit extends CControllerUserEditGeneral { ]); if ($data['form_refresh'] != 0) { $user_groups = $this->getInput('user_groups', []); - $data['user_medias'] = $this->getInput('user_medias', []); + $data['medias'] = $this->getInput('medias', []); } $data = $this->setUserMedias($data); diff --git a/ui/app/controllers/CControllerUserEditGeneral.php b/ui/app/controllers/CControllerUserEditGeneral.php index 005bd234cac..9182cbf7345 100644 --- a/ui/app/controllers/CControllerUserEditGeneral.php +++ b/ui/app/controllers/CControllerUserEditGeneral.php @@ -42,22 +42,22 @@ abstract class CControllerUserEditGeneral extends CController { */ protected function setUserMedias(array $data) { if ($this->hasInput('new_media')) { - $data['user_medias'][] = $this->getInput('new_media'); + $data['medias'][] = $this->getInput('new_media'); } elseif ($this->hasInput('enable_media')) { - if (array_key_exists($this->getInput('enable_media'), $data['user_medias'])) { - $data['user_medias'][$this->getInput('enable_media')]['active'] = MEDIA_STATUS_ACTIVE; + if (array_key_exists($this->getInput('enable_media'), $data['medias'])) { + $data['medias'][$this->getInput('enable_media')]['active'] = MEDIA_STATUS_ACTIVE; } } elseif ($this->hasInput('disable_media')) { - if (array_key_exists($this->getInput('disable_media'), $data['user_medias'])) { - $data['user_medias'][$this->getInput('disable_media')]['active'] = MEDIA_STATUS_DISABLED; + if (array_key_exists($this->getInput('disable_media'), $data['medias'])) { + $data['medias'][$this->getInput('disable_media')]['active'] = MEDIA_STATUS_DISABLED; } } $mediatypeids = []; - foreach ($data['user_medias'] as $media) { + foreach ($data['medias'] as $media) { $mediatypeids[$media['mediatypeid']] = true; } @@ -67,7 +67,7 @@ abstract class CControllerUserEditGeneral extends CController { 'preservekeys' => true ]); - foreach ($data['user_medias'] as &$media) { + foreach ($data['medias'] as &$media) { $media['name'] = $mediatypes[$media['mediatypeid']]['name']; $media['mediatype'] = $mediatypes[$media['mediatypeid']]['type']; $media['send_to_sort_field'] = is_array($media['sendto']) @@ -76,9 +76,9 @@ abstract class CControllerUserEditGeneral extends CController { } unset($media); - CArrayHelper::sort($data['user_medias'], ['name', 'send_to_sort_field']); + CArrayHelper::sort($data['medias'], ['name', 'send_to_sort_field']); - foreach ($data['user_medias'] as &$media) { + foreach ($data['medias'] as &$media) { unset($media['send_to_sort_field']); } unset($media); diff --git a/ui/app/controllers/CControllerUserProfileEdit.php b/ui/app/controllers/CControllerUserProfileEdit.php index 8b58301abaa..2a8871bdd2b 100644 --- a/ui/app/controllers/CControllerUserProfileEdit.php +++ b/ui/app/controllers/CControllerUserProfileEdit.php @@ -46,7 +46,7 @@ class CControllerUserProfileEdit extends CControllerUserEditGeneral { if (CWebUser::$data['type'] > USER_TYPE_ZABBIX_USER) { $fields += [ - 'user_medias' => 'array', + 'medias' => 'array', 'new_media' => 'array', 'enable_media' => 'int32', 'disable_media' => 'int32' @@ -122,7 +122,7 @@ class CControllerUserProfileEdit extends CControllerUserEditGeneral { ]; if (CWebUser::$data['type'] > USER_TYPE_ZABBIX_USER) { - $data['user_medias'] = $this->user['medias']; + $data['medias'] = $this->user['medias']; } // Overwrite with input variables. @@ -132,7 +132,7 @@ class CControllerUserProfileEdit extends CControllerUserEditGeneral { if (CWebUser::$data['type'] > USER_TYPE_ZABBIX_USER) { if ($data['form_refresh'] != 0) { - $data['user_medias'] = $this->getInput('user_medias', []); + $data['medias'] = $this->getInput('medias', []); } $data = $this->setUserMedias($data); diff --git a/ui/app/controllers/CControllerUserProfileUpdate.php b/ui/app/controllers/CControllerUserProfileUpdate.php index f0425710284..9dc1cff77fd 100644 --- a/ui/app/controllers/CControllerUserProfileUpdate.php +++ b/ui/app/controllers/CControllerUserProfileUpdate.php @@ -33,7 +33,7 @@ class CControllerUserProfileUpdate extends CControllerUserUpdateGeneral { 'userid' => 'fatal|required|db users.userid', 'password1' => 'string', 'password2' => 'string', - 'user_medias' => 'array', + 'medias' => 'array', 'lang' => 'db users.lang|in '.implode(',', $locales), 'theme' => 'db users.theme|in '.implode(',', $themes), 'autologin' => 'db users.autologin|in 0,1', @@ -93,7 +93,7 @@ class CControllerUserProfileUpdate extends CControllerUserUpdateGeneral { if (CWebUser::$data['type'] > USER_TYPE_ZABBIX_USER) { $user['medias'] = []; - foreach ($this->getInput('user_medias', []) as $media) { + foreach ($this->getInput('medias', []) as $media) { $user['medias'][] = [ 'mediatypeid' => $media['mediatypeid'], 'sendto' => $media['sendto'], diff --git a/ui/app/controllers/CControllerUserUpdate.php b/ui/app/controllers/CControllerUserUpdate.php index 180207ffe52..13e0f15b7f3 100644 --- a/ui/app/controllers/CControllerUserUpdate.php +++ b/ui/app/controllers/CControllerUserUpdate.php @@ -37,7 +37,7 @@ class CControllerUserUpdate extends CControllerUserUpdateGeneral { 'user_groups' => 'required|array_id|not_empty', 'password1' => 'string', 'password2' => 'string', - 'user_medias' => 'array', + 'medias' => 'array', 'lang' => 'db users.lang|in '.implode(',', $locales), 'theme' => 'db users.theme|in '.implode(',', $themes), 'autologin' => 'db users.autologin|in 0,1', @@ -101,7 +101,7 @@ class CControllerUserUpdate extends CControllerUserUpdateGeneral { $user['medias'] = []; - foreach ($this->getInput('user_medias', []) as $media) { + foreach ($this->getInput('medias', []) as $media) { $user['medias'][] = [ 'mediatypeid' => $media['mediatypeid'], 'sendto' => $media['sendto'], diff --git a/ui/app/views/administration.user.edit.php b/ui/app/views/administration.user.edit.php index 02bcba6ee95..6ffc2393bd6 100644 --- a/ui/app/views/administration.user.edit.php +++ b/ui/app/views/administration.user.edit.php @@ -219,13 +219,13 @@ $tabs->addTab('userTab', _('User'), $user_form_list); // Media tab. if ($data['action'] === 'user.edit' || CWebUser::$data['type'] > USER_TYPE_ZABBIX_USER) { $media_form_list = new CFormList('userMediaFormList'); - $user_form->addVar('user_medias', $data['user_medias']); + $user_form->addVar('medias', $data['medias']); $media_table_info = (new CTable()) ->setAttribute('style', 'width: 100%;') ->setHeader([_('Type'), _('Send to'), _('When active'), _('Use if severity'), ('Status'), _('Action')]); - foreach ($data['user_medias'] as $index => $media) { + foreach ($data['medias'] as $index => $media) { if ($media['active'] == MEDIA_STATUS_ACTIVE) { $status = (new CLink(_('Enabled'), '#')) ->onClick('return create_var("'.$user_form->getName().'","disable_media",'.$index.', true);') @@ -289,7 +289,7 @@ if ($data['action'] === 'user.edit' || CWebUser::$data['type'] > USER_TYPE_ZABBI ->onClick('javascript: removeMedia('.$index.');') ]) ))->addClass(ZBX_STYLE_NOWRAP) - ]))->setId('user_medias_'.$index) + ]))->setId('medias_'.$index) ); } diff --git a/ui/app/views/js/administration.user.edit.common.js.php b/ui/app/views/js/administration.user.edit.common.js.php index 7a736b4c7ca..35979752d74 100644 --- a/ui/app/views/js/administration.user.edit.common.js.php +++ b/ui/app/views/js/administration.user.edit.common.js.php @@ -27,17 +27,17 @@ <script type="text/javascript"> function removeMedia(index) { // table row - jQuery('#user_medias_' + index).remove(); + jQuery('#medias_' + index).remove(); // hidden variables - jQuery('#user_medias_' + index + '_mediaid').remove(); - jQuery('#user_medias_' + index + '_mediatype').remove(); - jQuery('#user_medias_' + index + '_mediatypeid').remove(); - jQuery('#user_medias_' + index + '_period').remove(); - jQuery('#user_medias_' + index + '_sendto').remove(); - removeVarsBySelector(null, 'input[id^="user_medias_' + index + '_sendto_"]'); - jQuery('#user_medias_' + index + '_severity').remove(); - jQuery('#user_medias_' + index + '_active').remove(); - jQuery('#user_medias_' + index + '_name').remove(); + jQuery('#medias_' + index + '_mediaid').remove(); + jQuery('#medias_' + index + '_mediatype').remove(); + jQuery('#medias_' + index + '_mediatypeid').remove(); + jQuery('#medias_' + index + '_period').remove(); + jQuery('#medias_' + index + '_sendto').remove(); + removeVarsBySelector(null, 'input[id^="medias_' + index + '_sendto_"]'); + jQuery('#medias_' + index + '_severity').remove(); + jQuery('#medias_' + index + '_active').remove(); + jQuery('#medias_' + index + '_name').remove(); } function autologoutHandler() { diff --git a/ui/js/common.js b/ui/js/common.js index 1167f9ef2f2..abc336e37a1 100644 --- a/ui/js/common.js +++ b/ui/js/common.js @@ -656,7 +656,7 @@ function addSelectedValues(object, parentid) { */ function add_media(formname, media, mediatypeid, sendto, period, active, severity) { var form = window.document.forms[formname]; - var media_name = (media > -1) ? 'user_medias[' + media + ']' : 'new_media'; + var media_name = (media > -1) ? 'medias[' + media + ']' : 'new_media'; window.create_var(form, media_name + '[mediatypeid]', mediatypeid); if (typeof sendto === "object") { |