adding bootstrap multiselect for users/servers

This commit is contained in:
Pepijn Over 2014-08-01 15:30:01 +02:00
parent e60e647eb3
commit fb0b321380
21 changed files with 177 additions and 211 deletions

View File

@ -116,5 +116,6 @@ The following libraries are being used by PHP Server Monitor:
* jqPlot - http://www.jqplot.com
* Twitter Bootstrap - http://getbootstrap.com
* Bootstrap Multiselect - https://github.com/davidstutz/bootstrap-multiselect
* PHP Mailer - https://github.com/PHPMailer/PHPMailer
* php-pushover - https://github.com/kryap/php-pushover

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'преди минута',
'seconds_ago' => 'преди %d секунди',
'a_second_ago' => 'преди секунда',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => 'Настройки',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'omkring et minut siden',
'seconds_ago' => '%d sekunder siden',
'a_second_ago' => 'et sekund siden',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => 'Indstillinger',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'about a minute ago',
'seconds_ago' => '%d seconds ago',
'a_second_ago' => 'a second ago',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => 'Einstellungen',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'about a minute ago',
'seconds_ago' => '%d seconds ago',
'a_second_ago' => 'a second ago',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => 'Config',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'about a minute ago',
'seconds_ago' => '%d seconds ago',
'a_second_ago' => 'a second ago',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => 'Configurar',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'Il y a une minute',
'seconds_ago' => 'Il y a %d secondes',
'a_second_ago' => 'Il y a une seconde',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => 'Configuration',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'about a minute ago',
'seconds_ago' => '%d seconds ago',
'a_second_ago' => 'a second ago',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => 'Configurazione',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'about a minute ago',
'seconds_ago' => '%d seconds ago',
'a_second_ago' => 'a second ago',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => '설정',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'een minuut geleden',
'seconds_ago' => '%d seconden geleden',
'a_second_ago' => 'een seconde geleden',
'check_all' => 'Selecteer alles',
'uncheck_all' => 'Deselecteer alles',
),
'menu' => array(
'config' => 'Configuratie',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'cerca de um minuto atrás',
'seconds_ago' => '%d segundos atrás',
'a_second_ago' => 'um segundo atrás',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => 'Configuração',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => 'минуту назад',
'seconds_ago' => '%d секунд назад',
'a_second_ago' => 'секунду назад',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => 'Параметры',

View File

@ -58,8 +58,6 @@ $sm_lang = array(
'a_minute_ago' => '1分钟前',
'seconds_ago' => '%d 秒前',
'a_second_ago' => '刚刚',
'check_all' => 'Check all',
'uncheck_all' => 'Uncheck all',
),
'menu' => array(
'config' => '设置',

View File

@ -190,7 +190,7 @@ class ServerController extends AbstractServerController {
$user_idc_selected = $this->getServerUsers($this->server_id);
foreach($users as &$user) {
if(in_array($user['user_id'], $user_idc_selected)) {
$user['edit_checked'] = 'checked="checked"';
$user['edit_selected'] = 'selected="selected"';
}
}
@ -443,8 +443,6 @@ class ServerController extends AbstractServerController {
'label_yes' => psm_get_lang('system', 'yes'),
'label_no' => psm_get_lang('system', 'no'),
'label_add_new' => psm_get_lang('system', 'add_new'),
'label_check_all' => psm_get_lang('system', 'check_all'),
'label_uncheck_all' => psm_get_lang('system', 'uncheck_all'),
)
);

View File

@ -168,7 +168,7 @@ class UserController extends AbstractController {
foreach($this->servers as &$server) {
if(in_array($server['server_id'], $user_servers)) {
$server['edit_checked'] = 'checked="checked"';
$server['edit_selected'] = 'selected="selected"';
$server['class'] = 'active';
}
}
@ -329,8 +329,6 @@ class UserController extends AbstractController {
'label_edit' => psm_get_lang('system', 'edit'),
'label_delete' => psm_get_lang('system', 'delete'),
'label_add_new' => psm_get_lang('system', 'add_new'),
'label_check_all' => psm_get_lang('system', 'check_all'),
'label_uncheck_all' => psm_get_lang('system', 'uncheck_all'),
'icon_level_10' => 'icon-admin',
'icon_level_20' => 'icon-user',
)

View File

@ -13,6 +13,7 @@
<!-- Le styles -->
<link href="static/plugin/twitter-bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="static/plugin/twitter-bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="static/plugin/bootstrap-multiselect/bootstrap-multiselect.min.css" rel="stylesheet">
<link href="static/css/style.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
@ -20,6 +21,7 @@
<![endif]-->
<script type="text/javascript" src="static/plugin/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="static/plugin/twitter-bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="static/plugin/bootstrap-multiselect/bootstrap-multiselect.min.js"></script>
<script type="text/javascript" src="static/js/scripts.js"></script>
</head>
<body data-spy="scroll" data-target=".subnav" data-offset="50" class="{body_class}">

View File

@ -75,8 +75,6 @@
<form class="form-horizontal well" action="{url_save}" method="post">
<fieldset>
<legend>{titlemode}</legend>
<div class="row-fluid">
<div class="span6">
<div class="control-group">
<label class="control-label" for="label">{label_label}</label>
<div class="controls">
@ -158,27 +156,21 @@
</select>
</div>
</div>
</div>
<div class="span6">
<div class="control-group">
<label class="control-label">{label_users}</label>
<label class="control-label" for="user_id">{label_users}</label>
<div class="controls">
<select class="multiselect" multiple="multiple" id="user_id" name="user_id[]">
<!--%tpl_repeat_users-->
<label class="checkbox"><input type="checkbox" name="user_id[]" value="{user_id}" {edit_checked}> {name}</label>
<option value="{user_id}" {edit_selected}> {name}</option>
<!--%%tpl_repeat_users-->
{users}
<p><button class="btn btn-small" onclick="psm_onClickCheckboxIDCToggleAll('user_id[]', true);return false;">{label_check_all}</button>
<button class="btn btn-small" onclick="psm_onClickCheckboxIDCToggleAll('user_id[]', false);return false;">{label_uncheck_all}</button></p>
</select>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="form-actions">
<button class="btn btn-success" type="submit">{label_save}</button>
<a class="btn" href="{url_go_back}" >{label_go_back}</a>
</div>
</div>
</fieldset>
</form>
<!--%%tpl_server_update-->

View File

@ -66,8 +66,6 @@
<form class="form-horizontal well" action="{url_save}" method="post">
<fieldset>
<legend>{titlemode}</legend>
<div class="row-fluid">
<div class="span6">
<div class="control-group">
<label class="control-label" for="user_name">{label_user_name}</label>
<div class="controls">
@ -133,27 +131,21 @@
<p class="help-block">{label_pushover_device_description}</p>
</div>
</div>
</div>
<div class="span6">
<div class="control-group">
<label class="control-label">{label_servers}</label>
<label class="control-label" for="server_id">{label_servers}</label>
<div class="controls">
<select class="multiselect" multiple="multiple" id="server_id" name="server_id[]">
<!--%tpl_repeat_servers-->
<label class="checkbox"><input type="checkbox" name="server_id[]" value="{server_id}" {edit_checked}> {label}</label>
<option value="{server_id}" {edit_selected}> {label}</option>
<!--%%tpl_repeat_servers-->
{servers}
<p><button class="btn btn-small" onclick="psm_onClickCheckboxIDCToggleAll('server_id[]', true);return false;">{label_check_all}</button>
<button class="btn btn-small" onclick="psm_onClickCheckboxIDCToggleAll('server_id[]', false);return false;">{label_uncheck_all}</button></p>
</select>
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="form-actions">
<button class="btn btn-success" type="submit">{label_save}</button>
<button class="btn" onclick="history.back();return false;" >{label_go_back}</button>
</div>
</div>
</fieldset>
</form>
<!--%%tpl_user_update-->

View File

@ -40,6 +40,11 @@ $().ready(function() {
}
return false;
});
$('select.multiselect').multiselect({
includeSelectAllOption: true,
maxHeight: 400,
enableCaseInsensitiveFiltering: true
});
psm_flash_message();
psm_tooltips();

View File

@ -0,0 +1 @@
.multiselect-container{position:absolute;list-style-type:none;margin:0;padding:0}.multiselect-container .input-group{margin:5px}.multiselect-container>li{padding:0}.multiselect-container>li>a.multiselect-all label{font-weight:700}.multiselect-container>li>label.multiselect-group{margin:0;padding:3px 20px;height:100%;font-weight:700}.multiselect-container>li>a{padding:0}.multiselect-container>li>a>label{margin:0;height:100%;cursor:pointer;font-weight:400;padding:3px 20px 3px 40px}.multiselect-container>li>a>label.radio,.multiselect-container>li>a>label.checkbox{margin:0}.multiselect-container>li>a>label>input[type=checkbox]{margin-bottom:5px}.btn-group>.btn-group:nth-child(2)>.multiselect.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.form-inline .multiselect-container label.checkbox,.form-inline .multiselect-container label.radio{padding:3px 20px 3px 40px}.form-inline .multiselect-container li a label.checkbox input[type=checkbox],.form-inline .multiselect-container li a label.radio input[type=radio]{margin-left:-20px;margin-right:0}

File diff suppressed because one or more lines are too long