Fixed style
Former-commit-id: bd4c0370bb3c63eddb9a7b36b0e8f6938c48b4ae
This commit is contained in:
parent
80a5d0b0b9
commit
4b86683d23
|
@ -44,7 +44,7 @@ $users = get_parameter('users', '');
|
|||
$elements = get_parameter('elements', []);
|
||||
$is_users = $users === 'users';
|
||||
if (get_parameter('get_selection_two_ways_form', 0)) {
|
||||
$info_selec = ($is_users) ? notifications_get_user_source_not_configured($source) : notifications_get_group_source_not_configured($source);
|
||||
$info_selec = ($is_users === true) ? notifications_get_user_source_not_configured($source) : notifications_get_group_source_not_configured($source);
|
||||
|
||||
echo notifications_print_two_ways_select(
|
||||
$info_selec,
|
||||
|
@ -133,7 +133,10 @@ function add_source_dialog(users, source_id) {
|
|||
if (previous_dialog !== null) previous_dialog.remove();
|
||||
// Create or recreate the content.
|
||||
var not_dialog = document.createElement('div');
|
||||
not_dialog.setAttribute('class', 'global_config_notifications_dialog_add_wrapper');
|
||||
not_dialog.setAttribute(
|
||||
'class',
|
||||
'global_config_notifications_dialog_add_wrapper'
|
||||
);
|
||||
not_dialog.setAttribute('id', dialog_id);
|
||||
document.body.appendChild(not_dialog);
|
||||
$("#" + dialog_id).dialog({
|
||||
|
@ -182,7 +185,8 @@ function notifications_modify_two_ways_element (id, source_id, operation) {
|
|||
|
||||
// Add elements to database and close dialog
|
||||
function notifications_add_source_element_to_database(id, source_id) {
|
||||
var index = 'selected-' + notifications_two_ways_element_get_sufix (id, source_id);
|
||||
var index = 'selected-' +
|
||||
notifications_two_ways_element_get_sufix (id, source_id);
|
||||
var select = document.getElementById(index);
|
||||
var selected = [];
|
||||
for (var i = select.options.length - 1; i >= 0; i--) {
|
||||
|
@ -205,7 +209,11 @@ function notifications_add_source_element_to_database(id, source_id) {
|
|||
out_select.appendChild(select.options[i]);
|
||||
}
|
||||
// Close the dialog
|
||||
$("#" + notifications_two_ways_element_get_dialog(id, source_id)).dialog("close");
|
||||
$("#" + notifications_two_ways_element_get_dialog(
|
||||
id,
|
||||
source_id
|
||||
))
|
||||
.dialog("close");
|
||||
} else {
|
||||
console.log("Cannot update element.");
|
||||
}
|
||||
|
@ -304,7 +312,9 @@ function notifications_handle_change_element(event) {
|
|||
value = element.value;
|
||||
break;
|
||||
default:
|
||||
console.error("Unregonized action (insert on db)", action.bit, '.');
|
||||
console.error(
|
||||
"Unregonized action (insert on db)", action.bit, '.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -641,18 +641,59 @@ function notifications_print_source_select_box(
|
|||
$delete_title = ($id === 'users') ? __('Delete users') : __('Delete groups');
|
||||
|
||||
// Generate the HTML.
|
||||
$html_select = "<div class='global-config-notification-single-selector'>";
|
||||
$html_select .= ' <div>';
|
||||
$html_select .= ' <h4>'.$title.'</h4>';
|
||||
// Put a true if empty sources to avoid to sow the 'None' value.
|
||||
$html_select .= html_print_select(empty($info_selec) ? true : $info_selec, 'multi-'.$id.'-'.$source_id.'[]', 0, false, '', '', true, true, true, '', $disabled);
|
||||
$html_select .= ' </div>';
|
||||
$html_select .= " <div class='global-notifications-icons'>";
|
||||
$html_select .= html_print_image('images/input_add.png', true, ['title' => $add_title, 'onclick' => 'add_source_dialog("'.$id.', "'.$source_id.'")"']);
|
||||
$html_select .= html_print_image('images/input_delete.png', true, ['title' => $delete_title, 'onclick' => 'remove_source_elements("'.$id.'", "'.$source_id.'")"']);
|
||||
$html_select .= ' </div>';
|
||||
$html_select .= '</div>';
|
||||
return $html_select;
|
||||
return sprintf(
|
||||
"
|
||||
<div class='global-config-notification-single-selector'>
|
||||
<div>
|
||||
<h4>%s</h4>
|
||||
%s
|
||||
</div>
|
||||
<div class='global-notifications-icons'>
|
||||
%s
|
||||
%s
|
||||
</div>
|
||||
</div>
|
||||
",
|
||||
$title,
|
||||
// Put a true if empty sources to avoid to sow the 'None' value.
|
||||
html_print_select(
|
||||
empty($info_selec) ? true : $info_selec,
|
||||
'multi-'.$id.'-'.$source_id.'[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
'',
|
||||
$disabled
|
||||
),
|
||||
html_print_image(
|
||||
'images/input_add.png',
|
||||
true,
|
||||
[
|
||||
'title' => $add_title,
|
||||
'onclick' => sprintf(
|
||||
"add_source_dialog('%s', '%s')",
|
||||
$id,
|
||||
$source_id
|
||||
),
|
||||
]
|
||||
),
|
||||
html_print_image(
|
||||
'images/input_delete.png',
|
||||
true,
|
||||
[
|
||||
'title' => $delete_title,
|
||||
'onclick' => sprintf(
|
||||
"remove_source_elements('%s', '%s')",
|
||||
$id,
|
||||
$source_id
|
||||
),
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -668,17 +709,79 @@ function notifications_print_source_select_box(
|
|||
*/
|
||||
function notifications_print_two_ways_select($info_selec, $users, $source_id)
|
||||
{
|
||||
$html_select = "<div class='global_config_notifications_dialog_add'>";
|
||||
$html_select .= html_print_select(empty($info_selec) ? true : $info_selec, 'all-multi-'.$users.'-'.$source_id.'[]', 0, false, '', '', true, true, true, '');
|
||||
$html_select .= "<div class='global_config_notifications_two_ways_form_arrows'>";
|
||||
$html_select .= html_print_image('images/darrowright.png', true, ['title' => $add_title, 'onclick' => 'notifications_modify_two_ways_element("'.$users.'", "'.$source_id.'", "add")']);
|
||||
$html_select .= html_print_image('images/darrowleft.png', true, ['title' => $add_title, 'onclick' => 'notifications_modify_two_ways_element("'.$users.'", "'.$source_id.'", "remove")']);
|
||||
$html_select .= '</div>';
|
||||
$html_select .= html_print_select(true, 'selected-multi-'.$users.'-'.$source_id.'[]', 0, false, '', '', true, true, true, '');
|
||||
$html_select .= '</div>';
|
||||
$html_select .= html_print_button(__('Add'), 'Add', false, 'notifications_add_source_element_to_database("'.$users.'", "'.$source_id.'")', "class='sub add'", true);
|
||||
|
||||
return $html_select;
|
||||
return sprintf(
|
||||
"
|
||||
<div class='global_config_notifications_dialog_add'>
|
||||
%s
|
||||
<div class='global_config_notifications_two_ways_form_arrows'>
|
||||
%s
|
||||
%s
|
||||
</div>
|
||||
%s
|
||||
</div>
|
||||
%s
|
||||
",
|
||||
html_print_select(
|
||||
empty($info_selec) ? true : $info_selec,
|
||||
'all-multi-'.$users.'-'.$source_id.'[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
''
|
||||
),
|
||||
html_print_image(
|
||||
'images/darrowright.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Add elements'),
|
||||
'onclick' => sprintf(
|
||||
"notifications_modify_two_ways_element('%s', '%s', 'add')",
|
||||
$users,
|
||||
$source_id
|
||||
),
|
||||
]
|
||||
),
|
||||
html_print_image(
|
||||
'images/darrowleft.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Remove elements'),
|
||||
'onclick' => sprintf(
|
||||
"notifications_modify_two_ways_element('%s', '%s', 'remove')",
|
||||
$users,
|
||||
$source_id
|
||||
),
|
||||
]
|
||||
),
|
||||
html_print_select(
|
||||
true,
|
||||
'selected-multi-'.$users.'-'.$source_id.'[]',
|
||||
0,
|
||||
false,
|
||||
'',
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
''
|
||||
),
|
||||
html_print_button(
|
||||
__('Add'),
|
||||
'Add',
|
||||
false,
|
||||
sprintf(
|
||||
"notifications_add_source_element_to_database('%s', '%s')",
|
||||
$users,
|
||||
$source_id
|
||||
),
|
||||
"class='sub add'",
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue