Repository navigation
Expand file tree
/
Copy pathalert_addapps.php
More file actions
88 lines (88 loc) · 2.42 KB
/
Copy pathalert_addapps.php
File metadata and controls
88 lines (88 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
require('../../global.php');
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>添加应用</title>
<?php include('sysapp/global_css.php'); ?>
</head>
<body>
<ul class="nav nav-tabs" style="margin-top:5px;margin-bottom:0">
<?php
$category = $db->select('tb_app_category', '*', array(
'issystem' => 0
));
if($category != NULL){
foreach($category as $c){
echo '<li class="dropdown"><a href="#category_'.$c['tbid'].'" data-toggle="tab">'.$c['name'].'</a></li>';
}
}
?>
</ul>
<div class="tab-content">
<?php
if($category != NULL){
foreach($category as $c){
echo '<div class="alert_addapps tab-pane fade" id="category_'.$c['tbid'].'">';
foreach($db->select('tb_app', array('tbid', 'name', 'icon'), array(
'app_category_id' => $c['tbid']
)) as $v){
echo '<div class="app" title="'.$v['name'].'" appid="'.$v['tbid'].'">';
echo '<img src="../../'.$v['icon'].'" alt="'.$v['name'].'" title="'.$v['name'].'">';
echo '<div class="name">'.$v['name'].'</div>';
echo '<span class="selected"></span>';
echo '</div>';
}
echo '</div>';
}
}
?>
</div>
<input type="hidden" id="value_1">
<?php include('sysapp/global_js.php'); ?>
<script>
$(function(){
$('.nav-tabs a:first').tab('show');
var dialog = window.parent.dialog.get(window);
if(dialog.data.appsid != ''){
$('#value_1').val(dialog.data.appsid);
var appsid = dialog.data.appsid.split(',');
$('.app').each(function(){
for(var i=0; i<appsid.length; i++){
if(appsid[i] == $(this).attr('appid')){
$(this).addClass('act');
break;
}
}
});
}
$('.app').click(function(){
if($(this).hasClass('act')){
var appsid = $('#value_1').val().split(',');
var newappsid = [];
for(var i=0, j=0; i<appsid.length; i++){
if(appsid[i] != $(this).attr('appid')){
newappsid[j] = appsid[i];
j++;
}
}
$('#value_1').val(newappsid.join(','));
$(this).removeClass('act');
}else{
if($('#value_1').val() != ''){
var appsid = $('#value_1').val().split(',');
appsid[appsid.length] = $(this).attr('appid');
$('#value_1').val(appsid.join(','));
}else{
$('#value_1').val($(this).attr('appid'));
}
$(this).addClass('act');
}
dialog.data.appsid = $('#value_1').val();
});
});
</script>
</body>
</html>