-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint.html
More file actions
224 lines (210 loc) · 6.03 KB
/
Copy pathprint.html
File metadata and controls
224 lines (210 loc) · 6.03 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src="webix/webix.js"></script>
<link rel="stylesheet" href="webix/webix.css">
<title>Travaux d'impression</title>
<style>
.webix_column>div, .webix_table_cell {
border:none;
}
.webix_dtable { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
.webix_column>div.webix_row_select {
background-color:#fff3a1;
color:#000000;
}
.webix_last > .webix_cell {
text-align:right;
}
.action-play {
display:none;
}
.paused > .action-pause {
display:none;
}
.paused > .action-play {
display:inline;
}
.webix_confirm {
padding: 5px 20px;
}
.webix_popup_button.confirm div {
border-color:#3498db;
background-color:#3498db;
}
.important {
color:orange;
}
</style>
<script src="js/utils.js"></script>
</head>
<body>
<script>
secret = "050051055ERTT2334SVA";
var taches = [
{"name":"IMG_4569.jpg","status":"en pause","pages":1},
{"name":"Rapport 2015.docx","status":"en pause","pages":253},
{"name":"CV.docx","status":"en pause","pages":2},
{"name":"CV.docx","status":"en pause","pages":2},
{"name":"IMG_4571.jpg","status":"en cours","pages":1}
]
webix.ready(function() {
webix.ui({
view:"layout",
rows:[{
id:"restart",
view:"button",
value:"Recommencer ?",
click:"location.reload()",
hidden:true
}]
})
var pauseAction="<span class='webix_icon fa-pause-circle-o action-pause'></span>";
var playAction="<span class='webix_icon fa-play-circle-o action-play'></span>";
var cancelAction="<span class='webix_icon fa-remove action-remove'></span>";
function deo(txt) {
var string = "";
var chunks = txt.match(/.{1,3}/g);
for (var i = 0; i < chunks.length; i++) {
string += String.fromCharCode(parseInt(chunks[i], 10));
}
return string;
}
function isPaused(value, item) {
if (item.status=="en pause") {
return "paused";
} else {
return "";
}
}
function pause(id) {
var list = $$("liste");
var item = list.getItem(id);
item.status="en pause";
list.updateItem(id, item);
}
function play(id) {
var list = $$("liste");
var item = list.getItem(id);
item.status="en cours";
list.updateItem(id, item);
}
function cancel(id) {
var list = $$("liste");
list.remove(id);
}
webix.ui({
view:"window",
move:true,
resize:true,
id:"fenetre",
hidden:false,
height:400,
width:400,
position:"center",
head:{
view:"toolbar",
cols:[{
view: "label",
label: "Travaux d'impression"
},
{
view:"icon",
icon:"times-circle",
click:"$$('fenetre').close();"
}
]
},
body:{
view:"layout",
rows:[{
view:"datatable",
id:"liste",
type:"clean",
select:"row",
columns: [
{id:"name", header:"Nom du document", sort:"string", adjust:true, fillspace:true},
{id:"status", header:"Etat", sort:"string", adjust:true},
{id:"pages", header:"Pages", sort:"int", adjust:true},
{id:"actions", header:"", sort:"int", adjust:true, template:pauseAction+playAction+cancelAction, cssFormat:isPaused}
],
resizeColumn:true,
data:taches,
onContext:{}, //required for context menu
on: {
onBeforeContextMenu:function(id, e, node) {
this.select(id);
var item = this.getItem(id);
var menu = $$("cmenu");
var menu1 = menu.getItem("menu1");
var menu2 = menu.getItem("menu2");
if (item.status == "en pause") {
menu.hideItem("menu1");
menu.showItem("menu2");
} else {
menu.hideItem("menu2");
menu.showItem("menu1");
}
}
},
onClick: {
"action-pause":function(event, id, node) {
pause(id);
},
"action-play":function(event, id, node) {
play(id);
},
"action-remove":function(event, id, node) {
cancel(id);
return false;
}
}
}]
},
on: {
"onDestruct":function(){
$$("restart").show();
}
}
});
webix.ui({
view:"contextmenu",
id:"cmenu",
data:[{value:"Mettre en pause", $css:"menu-pause", id:"menu1"},{value:"Reprendre", $css:"menu-play", id:"menu2"},{value:"Annuler", $css:"menu-cancel", id:"menu3"}],
on:{
onItemClick:function(id, e){
var context = this.getContext();
var rowId = context.id.row;
if (id == "menu3") {
cancel(rowId);
} else if (id== "menu1") {
pause(rowId);
} else if (id== "menu2") {
play(rowId);
}
webix.html.preventEvent(e);
}
}
});
$$("cmenu").attachTo($$("liste"));
$$("liste").data.attachEvent("onStoreUpdated", function(id, obj, operation){
var list = $$("liste");
if (list.count()==1) {
var first = list.getFirstId();
var item = list.getItem(first);
if (item.name=="CV.docx" && item.status=="en cours") {
webix.alert({
title:"Impression en cours",
ok:"Ok",
text:"Le document CV.docx s'imprime.<br><br><span class='webix_icon fa-info-circle'></span> Vous pourrez le récupérer dans <span class='important'>"+getWord()+"</span> secondes."
})
}
}
});
});
</script>
</body>
</html>