rails_jq_grid 0.0.3.pre2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/public/javascripts/rails-jqgrid/Changes.txt +0 -0
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-bg.js +132 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-bg1251.js +132 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-cat.js +128 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-cn.js +132 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-cs.js +128 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-da.js +128 -0
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-de.js +133 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-el.js +126 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-en.js +128 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-es.js +128 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-fa.js +145 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-fi.js +130 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-fr.js +126 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-gl.js +126 -0
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-he.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-hu.js +129 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-is.js +126 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-it.js +1 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-ja.js +155 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-nl.js +149 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-no.js +1 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-pl.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-pt-br.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-pt.js +125 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-ro.js +139 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-ru.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-sk.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-sr.js +128 -0
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-sv.js +127 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-tr.js +126 -1
- data/public/javascripts/rails-jqgrid/i18n/grid.locale-ua.js +127 -1
- data/public/javascripts/rails-jqgrid/install.txt +0 -0
- data/public/javascripts/rails-jqgrid/jquery.jqGrid.min.js +445 -432
- data/public/javascripts/rails-jqgrid/src/JsonXml.js +329 -329
- data/public/javascripts/rails-jqgrid/src/css/ellipsis-xbl.xml +0 -0
- data/public/javascripts/rails-jqgrid/src/css/ui.jqgrid.css +139 -129
- data/public/javascripts/rails-jqgrid/src/css/ui.multiselect.css +0 -0
- data/public/javascripts/rails-jqgrid/src/grid.base.js +3078 -3003
- data/public/javascripts/rails-jqgrid/src/grid.celledit.js +486 -486
- data/public/javascripts/rails-jqgrid/src/grid.common.js +646 -636
- data/public/javascripts/rails-jqgrid/src/grid.custom.js +820 -817
- data/public/javascripts/rails-jqgrid/src/grid.formedit.js +1954 -1872
- data/public/javascripts/rails-jqgrid/src/grid.grouping.js +250 -0
- data/public/javascripts/rails-jqgrid/src/grid.import.js +200 -200
- data/public/javascripts/rails-jqgrid/src/grid.inlinedit.js +255 -250
- data/public/javascripts/rails-jqgrid/src/grid.jqueryui.js +504 -503
- data/public/javascripts/rails-jqgrid/src/grid.loader.js +1 -0
- data/public/javascripts/rails-jqgrid/src/grid.postext.js +63 -63
- data/public/javascripts/rails-jqgrid/src/grid.setcolumns.js +125 -125
- data/public/javascripts/rails-jqgrid/src/grid.subgrid.js +260 -260
- data/public/javascripts/rails-jqgrid/src/grid.tbltogrid.js +106 -106
- data/public/javascripts/rails-jqgrid/src/grid.treegrid.js +489 -482
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-bg.js +132 -132
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-bg1251.js +132 -132
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-cat.js +128 -128
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-cn.js +132 -132
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-cs.js +128 -128
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-da.js +128 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-de.js +132 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-dk.js +0 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-el.js +126 -126
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-en.js +128 -128
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-es.js +128 -128
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-fa.js +145 -125
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-fi.js +130 -130
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-fr.js +2 -2
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-gl.js +126 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-he.js +127 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-hu.js +129 -129
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-is.js +126 -126
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-it.js +0 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ja.js +155 -155
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-nl.js +148 -148
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-no.js +0 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-pl.js +126 -126
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-pt-br.js +127 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-pt.js +125 -125
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ro.js +139 -139
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ru.js +127 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-sk.js +127 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-sr.js +128 -0
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-sv.js +127 -127
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-tr.js +126 -126
- data/public/javascripts/rails-jqgrid/src/i18n/grid.locale-ua.js +127 -127
- data/public/javascripts/rails-jqgrid/src/jqDnR.js +68 -67
- data/public/javascripts/rails-jqgrid/src/jqModal.js +68 -68
- data/public/javascripts/rails-jqgrid/src/jquery.fmatter.js +563 -541
- data/public/javascripts/rails-jqgrid/src/jquery.searchFilter.js +1 -1
- data/public/javascripts/rails-jqgrid/src/ui.multiselect.js +0 -0
- data/public/stylesheets/rails-jqgrid/ellipsis-xbl.xml +0 -0
- data/public/stylesheets/rails-jqgrid/ui.jqgrid.css +139 -2
- data/rails_jq_grid.gemspec +10 -3
- metadata +15 -11
@@ -1,636 +1,646 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
*
|
4
|
-
*
|
5
|
-
*
|
6
|
-
*
|
7
|
-
* http://www.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
if
|
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
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
if(
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
}
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
elem.
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
}
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
}
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
ov =
|
388
|
-
ov.
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
}
|
448
|
-
|
449
|
-
function
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
}
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
}
|
532
|
-
function
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
if(
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
if(
|
595
|
-
if(
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
}
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
}
|
1
|
+
;(function($){
|
2
|
+
/*
|
3
|
+
* jqGrid common function
|
4
|
+
* Tony Tomov tony@trirand.com
|
5
|
+
* http://trirand.com/blog/
|
6
|
+
* Dual licensed under the MIT and GPL licenses:
|
7
|
+
* http://www.opensource.org/licenses/mit-license.php
|
8
|
+
* http://www.gnu.org/licenses/gpl-2.0.html
|
9
|
+
*/
|
10
|
+
$.extend($.jgrid,{
|
11
|
+
// Modal functions
|
12
|
+
showModal : function(h) {
|
13
|
+
h.w.show();
|
14
|
+
},
|
15
|
+
closeModal : function(h) {
|
16
|
+
h.w.hide().attr("aria-hidden","true");
|
17
|
+
if(h.o) { h.o.remove(); }
|
18
|
+
},
|
19
|
+
hideModal : function (selector,o) {
|
20
|
+
o = $.extend({jqm : true, gb :''}, o || {});
|
21
|
+
if(o.onClose) {
|
22
|
+
var oncret = o.onClose(selector);
|
23
|
+
if (typeof oncret == 'boolean' && !oncret ) { return; }
|
24
|
+
}
|
25
|
+
if ($.fn.jqm && o.jqm === true) {
|
26
|
+
$(selector).attr("aria-hidden","true").jqmHide();
|
27
|
+
} else {
|
28
|
+
if(o.gb !== '') {
|
29
|
+
try {$(".jqgrid-overlay:first",o.gb).hide();} catch (e){}
|
30
|
+
}
|
31
|
+
$(selector).hide().attr("aria-hidden","true");
|
32
|
+
}
|
33
|
+
},
|
34
|
+
//Helper functions
|
35
|
+
findPos : function(obj) {
|
36
|
+
var curleft = 0, curtop = 0;
|
37
|
+
if (obj.offsetParent) {
|
38
|
+
do {
|
39
|
+
curleft += obj.offsetLeft;
|
40
|
+
curtop += obj.offsetTop;
|
41
|
+
} while (obj = obj.offsetParent);
|
42
|
+
//do not change obj == obj.offsetParent
|
43
|
+
}
|
44
|
+
return [curleft,curtop];
|
45
|
+
},
|
46
|
+
createModal : function(aIDs, content, p, insertSelector, posSelector, appendsel) {
|
47
|
+
var mw = document.createElement('div'), rtlsup, self = this;
|
48
|
+
rtlsup = $(p.gbox).attr("dir") == "rtl" ? true : false;
|
49
|
+
mw.className= "ui-widget ui-widget-content ui-corner-all ui-jqdialog";
|
50
|
+
mw.id = aIDs.themodal;
|
51
|
+
var mh = document.createElement('div');
|
52
|
+
mh.className = "ui-jqdialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix";
|
53
|
+
mh.id = aIDs.modalhead;
|
54
|
+
$(mh).append("<span class='ui-jqdialog-title'>"+p.caption+"</span>");
|
55
|
+
var ahr= $("<a href='javascript:void(0)' class='ui-jqdialog-titlebar-close ui-corner-all'></a>")
|
56
|
+
.hover(function(){ahr.addClass('ui-state-hover');},
|
57
|
+
function(){ahr.removeClass('ui-state-hover');})
|
58
|
+
.append("<span class='ui-icon ui-icon-closethick'></span>");
|
59
|
+
$(mh).append(ahr);
|
60
|
+
if(rtlsup) {
|
61
|
+
mw.dir = "rtl";
|
62
|
+
$(".ui-jqdialog-title",mh).css("float","right");
|
63
|
+
$(".ui-jqdialog-titlebar-close",mh).css("left",0.3+"em");
|
64
|
+
} else {
|
65
|
+
mw.dir = "ltr";
|
66
|
+
$(".ui-jqdialog-title",mh).css("float","left");
|
67
|
+
$(".ui-jqdialog-titlebar-close",mh).css("right",0.3+"em");
|
68
|
+
}
|
69
|
+
var mc = document.createElement('div');
|
70
|
+
$(mc).addClass("ui-jqdialog-content ui-widget-content").attr("id",aIDs.modalcontent);
|
71
|
+
$(mc).append(content);
|
72
|
+
mw.appendChild(mc);
|
73
|
+
$(mw).prepend(mh);
|
74
|
+
if(appendsel===true) { $('body').append(mw); } //append as first child in body -for alert dialog
|
75
|
+
else {$(mw).insertBefore(insertSelector);}
|
76
|
+
if(typeof p.jqModal === 'undefined') {p.jqModal = true;} // internal use
|
77
|
+
var coord = {};
|
78
|
+
if ( $.fn.jqm && p.jqModal === true) {
|
79
|
+
if(p.left ===0 && p.top===0) {
|
80
|
+
var pos = [];
|
81
|
+
pos = this.findPos(posSelector);
|
82
|
+
p.left = pos[0] + 4;
|
83
|
+
p.top = pos[1] + 4;
|
84
|
+
}
|
85
|
+
coord.top = p.top+"px";
|
86
|
+
coord.left = p.left;
|
87
|
+
} else if(p.left !==0 || p.top!==0) {
|
88
|
+
coord.left = p.left;
|
89
|
+
coord.top = p.top+"px";
|
90
|
+
}
|
91
|
+
$("a.ui-jqdialog-titlebar-close",mh).click(function(e){
|
92
|
+
var oncm = $("#"+aIDs.themodal).data("onClose") || p.onClose;
|
93
|
+
var gboxclose = $("#"+aIDs.themodal).data("gbox") || p.gbox;
|
94
|
+
self.hideModal("#"+aIDs.themodal,{gb:gboxclose,jqm:p.jqModal,onClose:oncm});
|
95
|
+
return false;
|
96
|
+
});
|
97
|
+
if (p.width === 0 || !p.width) {p.width = 300;}
|
98
|
+
if(p.height === 0 || !p.height) {p.height =200;}
|
99
|
+
if(!p.zIndex) {
|
100
|
+
var parentZ = $(insertSelector).parents("*[role=dialog]").first().css("z-index")
|
101
|
+
if(parentZ)
|
102
|
+
p.zIndex = parseInt(parentZ)+1
|
103
|
+
else
|
104
|
+
p.zIndex = 950;
|
105
|
+
}
|
106
|
+
var rtlt = 0;
|
107
|
+
if( rtlsup && coord.left && !appendsel) {
|
108
|
+
rtlt = $(p.gbox).width()- (!isNaN(p.width) ? parseInt(p.width,10) :0) - 8; // to do
|
109
|
+
// just in case
|
110
|
+
coord.left = parseInt(coord.left,10) + parseInt(rtlt,10);
|
111
|
+
}
|
112
|
+
if(coord.left) { coord.left += "px"; }
|
113
|
+
$(mw).css($.extend({
|
114
|
+
width: isNaN(p.width) ? "auto": p.width+"px",
|
115
|
+
height:isNaN(p.height) ? "auto" : p.height + "px",
|
116
|
+
zIndex:p.zIndex,
|
117
|
+
overflow: 'hidden'
|
118
|
+
},coord))
|
119
|
+
.attr({tabIndex: "-1","role":"dialog","aria-labelledby":aIDs.modalhead,"aria-hidden":"true"});
|
120
|
+
if(typeof p.drag == 'undefined') { p.drag=true;}
|
121
|
+
if(typeof p.resize == 'undefined') {p.resize=true;}
|
122
|
+
if (p.drag) {
|
123
|
+
$(mh).css('cursor','move');
|
124
|
+
if($.fn.jqDrag) {
|
125
|
+
$(mw).jqDrag(mh);
|
126
|
+
} else {
|
127
|
+
try {
|
128
|
+
$(mw).draggable({handle: $("#"+mh.id)});
|
129
|
+
} catch (e) {}
|
130
|
+
}
|
131
|
+
}
|
132
|
+
if(p.resize) {
|
133
|
+
if($.fn.jqResize) {
|
134
|
+
$(mw).append("<div class='jqResize ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se'></div>");
|
135
|
+
$("#"+aIDs.themodal).jqResize(".jqResize",aIDs.scrollelm ? "#"+aIDs.scrollelm : false);
|
136
|
+
} else {
|
137
|
+
try {
|
138
|
+
$(mw).resizable({handles: 'se, sw',alsoResize: aIDs.scrollelm ? "#"+aIDs.scrollelm : false});
|
139
|
+
} catch (e) {}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
if(p.closeOnEscape === true){
|
143
|
+
$(mw).keydown( function( e ) {
|
144
|
+
if( e.which == 27 ) {
|
145
|
+
var cone = $("#"+aIDs.themodal).data("onClose") || p.onClose;
|
146
|
+
self.hideModal(this,{gb:p.gbox,jqm:p.jqModal,onClose: cone});
|
147
|
+
}
|
148
|
+
});
|
149
|
+
}
|
150
|
+
},
|
151
|
+
viewModal : function (selector,o){
|
152
|
+
o = $.extend({
|
153
|
+
toTop: true,
|
154
|
+
overlay: 10,
|
155
|
+
modal: false,
|
156
|
+
onShow: this.showModal,
|
157
|
+
onHide: this.closeModal,
|
158
|
+
gbox: '',
|
159
|
+
jqm : true,
|
160
|
+
jqM : true
|
161
|
+
}, o || {});
|
162
|
+
if ($.fn.jqm && o.jqm === true) {
|
163
|
+
if(o.jqM) { $(selector).attr("aria-hidden","false").jqm(o).jqmShow(); }
|
164
|
+
else {$(selector).attr("aria-hidden","false").jqmShow();}
|
165
|
+
} else {
|
166
|
+
if(o.gbox !== '') {
|
167
|
+
$(".jqgrid-overlay:first",o.gbox).show();
|
168
|
+
$(selector).data("gbox",o.gbox);
|
169
|
+
}
|
170
|
+
$(selector).show().attr("aria-hidden","false");
|
171
|
+
try{$(':input:visible',selector)[0].focus();}catch(_){}
|
172
|
+
}
|
173
|
+
},
|
174
|
+
|
175
|
+
info_dialog : function(caption, content,c_b, modalopt) {
|
176
|
+
var mopt = {
|
177
|
+
width:290,
|
178
|
+
height:'auto',
|
179
|
+
dataheight: 'auto',
|
180
|
+
drag: true,
|
181
|
+
resize: false,
|
182
|
+
caption:"<b>"+caption+"</b>",
|
183
|
+
left:250,
|
184
|
+
top:170,
|
185
|
+
zIndex : 1000,
|
186
|
+
jqModal : true,
|
187
|
+
modal : false,
|
188
|
+
closeOnEscape : true,
|
189
|
+
align: 'center',
|
190
|
+
buttonalign : 'center',
|
191
|
+
buttons : []
|
192
|
+
// {text:'textbutt', id:"buttid", onClick : function(){...}}
|
193
|
+
// if the id is not provided we set it like info_button_+ the index in the array - i.e info_button_0,info_button_1...
|
194
|
+
};
|
195
|
+
$.extend(mopt,modalopt || {});
|
196
|
+
var jm = mopt.jqModal, self = this;
|
197
|
+
if($.fn.jqm && !jm) { jm = false; }
|
198
|
+
// in case there is no jqModal
|
199
|
+
var buttstr ="";
|
200
|
+
if(mopt.buttons.length > 0) {
|
201
|
+
for(var i=0;i<mopt.buttons.length;i++) {
|
202
|
+
if(typeof mopt.buttons[i].id == "undefined") { mopt.buttons[i].id = "info_button_"+i; }
|
203
|
+
buttstr += "<a href='javascript:void(0)' id='"+mopt.buttons[i].id+"' class='fm-button ui-state-default ui-corner-all'>"+mopt.buttons[i].text+"</a>";
|
204
|
+
}
|
205
|
+
}
|
206
|
+
var dh = isNaN(mopt.dataheight) ? mopt.dataheight : mopt.dataheight+"px",
|
207
|
+
cn = "text-align:"+mopt.align+";";
|
208
|
+
var cnt = "<div id='info_id'>";
|
209
|
+
cnt += "<div id='infocnt' style='margin:0px;padding-bottom:1em;width:100%;overflow:auto;position:relative;height:"+dh+";"+cn+"'>"+content+"</div>";
|
210
|
+
cnt += c_b ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'><a href='javascript:void(0)' id='closedialog' class='fm-button ui-state-default ui-corner-all'>"+c_b+"</a>"+buttstr+"</div>" :
|
211
|
+
buttstr !== "" ? "<div class='ui-widget-content ui-helper-clearfix' style='text-align:"+mopt.buttonalign+";padding-bottom:0.8em;padding-top:0.5em;background-image: none;border-width: 1px 0 0 0;'>"+buttstr+"</div>" : "";
|
212
|
+
cnt += "</div>";
|
213
|
+
|
214
|
+
try {
|
215
|
+
if($("#info_dialog").attr("aria-hidden") == "false") {
|
216
|
+
this.hideModal("#info_dialog",{jqm:jm});
|
217
|
+
}
|
218
|
+
$("#info_dialog").remove();
|
219
|
+
} catch (e){}
|
220
|
+
this.createModal({
|
221
|
+
themodal:'info_dialog',
|
222
|
+
modalhead:'info_head',
|
223
|
+
modalcontent:'info_content',
|
224
|
+
scrollelm: 'infocnt'},
|
225
|
+
cnt,
|
226
|
+
mopt,
|
227
|
+
'','',true
|
228
|
+
);
|
229
|
+
// attach onclick after inserting into the dom
|
230
|
+
if(buttstr) {
|
231
|
+
$.each(mopt.buttons,function(i){
|
232
|
+
$("#"+this.id,"#info_id").bind('click',function(){mopt.buttons[i].onClick.call($("#info_dialog")); return false;});
|
233
|
+
});
|
234
|
+
}
|
235
|
+
$("#closedialog", "#info_id").click(function(e){
|
236
|
+
self.hideModal("#info_dialog",{jqm:jm});
|
237
|
+
return false;
|
238
|
+
});
|
239
|
+
$(".fm-button","#info_dialog").hover(
|
240
|
+
function(){$(this).addClass('ui-state-hover');},
|
241
|
+
function(){$(this).removeClass('ui-state-hover');}
|
242
|
+
);
|
243
|
+
if($.isFunction(mopt.beforeOpen) ) { mopt.beforeOpen(); }
|
244
|
+
this.viewModal("#info_dialog",{
|
245
|
+
onHide: function(h) {
|
246
|
+
h.w.hide().remove();
|
247
|
+
if(h.o) { h.o.remove(); }
|
248
|
+
},
|
249
|
+
modal :mopt.modal,
|
250
|
+
jqm:jm
|
251
|
+
});
|
252
|
+
if($.isFunction(mopt.afterOpen) ) { mopt.afterOpen(); }
|
253
|
+
try{ $("#info_dialog").focus();} catch (e){}
|
254
|
+
},
|
255
|
+
// Form Functions
|
256
|
+
createEl : function(eltype,options,vl,autowidth, ajaxso) {
|
257
|
+
var elem = "";
|
258
|
+
if(options.defaultValue) { delete options.defaultValue; }
|
259
|
+
function bindEv (el, opt) {
|
260
|
+
if($.isFunction(opt.dataInit)) {
|
261
|
+
// datepicker fix
|
262
|
+
el.id = opt.id;
|
263
|
+
opt.dataInit(el);
|
264
|
+
delete opt.id;
|
265
|
+
delete opt.dataInit;
|
266
|
+
}
|
267
|
+
if(opt.dataEvents) {
|
268
|
+
$.each(opt.dataEvents, function() {
|
269
|
+
if (this.data !== undefined) {
|
270
|
+
$(el).bind(this.type, this.data, this.fn);
|
271
|
+
} else {
|
272
|
+
$(el).bind(this.type, this.fn);
|
273
|
+
}
|
274
|
+
});
|
275
|
+
delete opt.dataEvents;
|
276
|
+
}
|
277
|
+
return opt;
|
278
|
+
}
|
279
|
+
switch (eltype)
|
280
|
+
{
|
281
|
+
case "textarea" :
|
282
|
+
elem = document.createElement("textarea");
|
283
|
+
if(autowidth) {
|
284
|
+
if(!options.cols) { $(elem).css({width:"98%"});}
|
285
|
+
} else if (!options.cols) { options.cols = 20; }
|
286
|
+
if(!options.rows) { options.rows = 2; }
|
287
|
+
if(vl==' ' || vl==' ' || (vl.length==1 && vl.charCodeAt(0)==160)) {vl="";}
|
288
|
+
elem.value = vl;
|
289
|
+
options = bindEv(elem,options);
|
290
|
+
$(elem).attr(options).attr({"role":"textbox","multiline":"true"});
|
291
|
+
break;
|
292
|
+
case "checkbox" : //what code for simple checkbox
|
293
|
+
elem = document.createElement("input");
|
294
|
+
elem.type = "checkbox";
|
295
|
+
if( !options.value ) {
|
296
|
+
var vl1 = vl.toLowerCase();
|
297
|
+
if(vl1.search(/(false|0|no|off|undefined)/i)<0 && vl1!=="") {
|
298
|
+
elem.checked=true;
|
299
|
+
elem.defaultChecked=true;
|
300
|
+
elem.value = vl;
|
301
|
+
} else {
|
302
|
+
elem.value = "on";
|
303
|
+
}
|
304
|
+
$(elem).attr("offval","off");
|
305
|
+
} else {
|
306
|
+
var cbval = options.value.split(":");
|
307
|
+
if(vl === cbval[0]) {
|
308
|
+
elem.checked=true;
|
309
|
+
elem.defaultChecked=true;
|
310
|
+
}
|
311
|
+
elem.value = cbval[0];
|
312
|
+
$(elem).attr("offval",cbval[1]);
|
313
|
+
try {delete options.value;} catch (e){}
|
314
|
+
}
|
315
|
+
options = bindEv(elem,options);
|
316
|
+
$(elem).attr(options).attr("role","checkbox");
|
317
|
+
break;
|
318
|
+
case "select" :
|
319
|
+
elem = document.createElement("select");
|
320
|
+
elem.setAttribute("role","select");
|
321
|
+
var msl, ovm = [];
|
322
|
+
if(options.multiple===true) {
|
323
|
+
msl = true;
|
324
|
+
elem.multiple="multiple";
|
325
|
+
$(elem).attr("aria-multiselectable","true");
|
326
|
+
} else { msl = false; }
|
327
|
+
if(typeof(options.dataUrl) != "undefined") {
|
328
|
+
$.ajax($.extend({
|
329
|
+
url: options.dataUrl,
|
330
|
+
type : "GET",
|
331
|
+
dataType: "html",
|
332
|
+
success: function(data,status){
|
333
|
+
try {delete options.dataUrl; delete options.value;} catch (e){}
|
334
|
+
var a;
|
335
|
+
if(typeof(options.buildSelect) != "undefined") {
|
336
|
+
var b = options.buildSelect(data);
|
337
|
+
a = $(b).html();
|
338
|
+
delete options.buildSelect;
|
339
|
+
} else {
|
340
|
+
a = $(data).html();
|
341
|
+
}
|
342
|
+
if(a) {
|
343
|
+
$(elem).append(a);
|
344
|
+
options = bindEv(elem,options);
|
345
|
+
if(typeof options.size === 'undefined') { options.size = msl ? 3 : 1;}
|
346
|
+
if(msl) {
|
347
|
+
ovm = vl.split(",");
|
348
|
+
ovm = $.map(ovm,function(n){return $.trim(n);});
|
349
|
+
} else {
|
350
|
+
ovm[0] = $.trim(vl);
|
351
|
+
}
|
352
|
+
$(elem).attr(options);
|
353
|
+
setTimeout(function(){
|
354
|
+
$("option",elem).each(function(i){
|
355
|
+
if(i===0) { this.selected = ""; }
|
356
|
+
$(this).attr("role","option");
|
357
|
+
if($.inArray($.trim($(this).text()),ovm) > -1 || $.inArray($.trim($(this).val()),ovm) > -1 ) {
|
358
|
+
this.selected= "selected";
|
359
|
+
if(!msl) { return false; }
|
360
|
+
}
|
361
|
+
});
|
362
|
+
},0);
|
363
|
+
}
|
364
|
+
}
|
365
|
+
},ajaxso || {}));
|
366
|
+
} else if(options.value) {
|
367
|
+
var i;
|
368
|
+
if(msl) {
|
369
|
+
ovm = vl.split(",");
|
370
|
+
ovm = $.map(ovm,function(n){return $.trim(n);});
|
371
|
+
if(typeof options.size === 'undefined') {options.size = 3;}
|
372
|
+
} else {
|
373
|
+
options.size = 1;
|
374
|
+
}
|
375
|
+
if(typeof options.value === 'function') { options.value = options.value(); }
|
376
|
+
var so,sv, ov;
|
377
|
+
if(typeof options.value === 'string') {
|
378
|
+
so = options.value.split(";");
|
379
|
+
for(i=0; i<so.length;i++){
|
380
|
+
sv = so[i].split(":");
|
381
|
+
if(sv.length > 2 ) {
|
382
|
+
sv[1] = $.map(sv,function(n,i){if(i>0) { return n;} }).join(":");
|
383
|
+
}
|
384
|
+
ov = document.createElement("option");
|
385
|
+
ov.setAttribute("role","option");
|
386
|
+
ov.value = sv[0]; ov.innerHTML = sv[1];
|
387
|
+
if (!msl && ($.trim(sv[0]) == $.trim(vl) || $.trim(sv[1]) == $.trim(vl))) { ov.selected ="selected"; }
|
388
|
+
if (msl && ($.inArray($.trim(sv[1]), ovm)>-1 || $.inArray($.trim(sv[0]), ovm)>-1)) {ov.selected ="selected";}
|
389
|
+
elem.appendChild(ov);
|
390
|
+
}
|
391
|
+
} else if (typeof options.value === 'object') {
|
392
|
+
var oSv = options.value;
|
393
|
+
for ( var key in oSv) {
|
394
|
+
if (oSv.hasOwnProperty(key ) ){
|
395
|
+
ov = document.createElement("option");
|
396
|
+
ov.setAttribute("role","option");
|
397
|
+
ov.value = key; ov.innerHTML = oSv[key];
|
398
|
+
if (!msl && ( $.trim(key) == $.trim(vl) || $.trim(oSv[key]) == $.trim(vl)) ) { ov.selected ="selected"; }
|
399
|
+
if (msl && ($.inArray($.trim(oSv[key]),ovm)>-1 || $.inArray($.trim(key),ovm)>-1)) { ov.selected ="selected"; }
|
400
|
+
elem.appendChild(ov);
|
401
|
+
}
|
402
|
+
}
|
403
|
+
}
|
404
|
+
options = bindEv(elem,options);
|
405
|
+
try {delete options.value;} catch (e){}
|
406
|
+
$(elem).attr(options);
|
407
|
+
}
|
408
|
+
break;
|
409
|
+
case "text" :
|
410
|
+
case "password" :
|
411
|
+
case "button" :
|
412
|
+
var role;
|
413
|
+
if(eltype=="button") { role = "button"; }
|
414
|
+
else { role = "textbox"; }
|
415
|
+
elem = document.createElement("input");
|
416
|
+
elem.type = eltype;
|
417
|
+
elem.value = vl;
|
418
|
+
options = bindEv(elem,options);
|
419
|
+
if(eltype != "button"){
|
420
|
+
if(autowidth) {
|
421
|
+
if(!options.size) { $(elem).css({width:"98%"}); }
|
422
|
+
} else if (!options.size) { options.size = 20; }
|
423
|
+
}
|
424
|
+
$(elem).attr(options).attr("role",role);
|
425
|
+
break;
|
426
|
+
case "image" :
|
427
|
+
case "file" :
|
428
|
+
elem = document.createElement("input");
|
429
|
+
elem.type = eltype;
|
430
|
+
options = bindEv(elem,options);
|
431
|
+
$(elem).attr(options);
|
432
|
+
break;
|
433
|
+
case "custom" :
|
434
|
+
elem = document.createElement("span");
|
435
|
+
try {
|
436
|
+
if($.isFunction(options.custom_element)) {
|
437
|
+
var celm = options.custom_element.call(this,vl,options);
|
438
|
+
if(celm) {
|
439
|
+
celm = $(celm).addClass("customelement").attr({id:options.id,name:options.name});
|
440
|
+
$(elem).empty().append(celm);
|
441
|
+
} else {
|
442
|
+
throw "e2";
|
443
|
+
}
|
444
|
+
} else {
|
445
|
+
throw "e1";
|
446
|
+
}
|
447
|
+
} catch (e) {
|
448
|
+
if (e=="e1") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.nodefined, $.jgrid.edit.bClose);}
|
449
|
+
if (e=="e2") { this.info_dialog($.jgrid.errors.errcap,"function 'custom_element' "+$.jgrid.edit.msg.novalue,$.jgrid.edit.bClose);}
|
450
|
+
else { this.info_dialog($.jgrid.errors.errcap,typeof(e)==="string"?e:e.message,$.jgrid.edit.bClose); }
|
451
|
+
}
|
452
|
+
break;
|
453
|
+
}
|
454
|
+
return elem;
|
455
|
+
},
|
456
|
+
// Date Validation Javascript
|
457
|
+
checkDate : function (format, date) {
|
458
|
+
var daysInFebruary = function(year){
|
459
|
+
// February has 29 days in any year evenly divisible by four,
|
460
|
+
// EXCEPT for centurial years which are not also divisible by 400.
|
461
|
+
return (((year % 4 === 0) && ( year % 100 !== 0 || (year % 400 === 0))) ? 29 : 28 );
|
462
|
+
},
|
463
|
+
DaysArray = function(n) {
|
464
|
+
for (var i = 1; i <= n; i++) {
|
465
|
+
this[i] = 31;
|
466
|
+
if (i==4 || i==6 || i==9 || i==11) {this[i] = 30;}
|
467
|
+
if (i==2) {this[i] = 29;}
|
468
|
+
}
|
469
|
+
return this;
|
470
|
+
};
|
471
|
+
|
472
|
+
var tsp = {}, sep;
|
473
|
+
format = format.toLowerCase();
|
474
|
+
//we search for /,-,. for the date separator
|
475
|
+
if(format.indexOf("/") != -1) {
|
476
|
+
sep = "/";
|
477
|
+
} else if(format.indexOf("-") != -1) {
|
478
|
+
sep = "-";
|
479
|
+
} else if(format.indexOf(".") != -1) {
|
480
|
+
sep = ".";
|
481
|
+
} else {
|
482
|
+
sep = "/";
|
483
|
+
}
|
484
|
+
format = format.split(sep);
|
485
|
+
date = date.split(sep);
|
486
|
+
if (date.length != 3) { return false; }
|
487
|
+
var j=-1,yln, dln=-1, mln=-1;
|
488
|
+
for(var i=0;i<format.length;i++){
|
489
|
+
var dv = isNaN(date[i]) ? 0 : parseInt(date[i],10);
|
490
|
+
tsp[format[i]] = dv;
|
491
|
+
yln = format[i];
|
492
|
+
if(yln.indexOf("y") != -1) { j=i; }
|
493
|
+
if(yln.indexOf("m") != -1) { mln=i; }
|
494
|
+
if(yln.indexOf("d") != -1) { dln=i; }
|
495
|
+
}
|
496
|
+
if (format[j] == "y" || format[j] == "yyyy") {
|
497
|
+
yln=4;
|
498
|
+
} else if(format[j] =="yy"){
|
499
|
+
yln = 2;
|
500
|
+
} else {
|
501
|
+
yln = -1;
|
502
|
+
}
|
503
|
+
var daysInMonth = DaysArray(12),
|
504
|
+
strDate;
|
505
|
+
if (j === -1) {
|
506
|
+
return false;
|
507
|
+
} else {
|
508
|
+
strDate = tsp[format[j]].toString();
|
509
|
+
if(yln == 2 && strDate.length == 1) {yln = 1;}
|
510
|
+
if (strDate.length != yln || (tsp[format[j]]===0 && date[j]!="00")){
|
511
|
+
return false;
|
512
|
+
}
|
513
|
+
}
|
514
|
+
if(mln === -1) {
|
515
|
+
return false;
|
516
|
+
} else {
|
517
|
+
strDate = tsp[format[mln]].toString();
|
518
|
+
if (strDate.length<1 || tsp[format[mln]]<1 || tsp[format[mln]]>12){
|
519
|
+
return false;
|
520
|
+
}
|
521
|
+
}
|
522
|
+
if(dln === -1) {
|
523
|
+
return false;
|
524
|
+
} else {
|
525
|
+
strDate = tsp[format[dln]].toString();
|
526
|
+
if (strDate.length<1 || tsp[format[dln]]<1 || tsp[format[dln]]>31 || (tsp[format[mln]]==2 && tsp[format[dln]]>daysInFebruary(tsp[format[j]])) || tsp[format[dln]] > daysInMonth[tsp[format[mln]]]){
|
527
|
+
return false;
|
528
|
+
}
|
529
|
+
}
|
530
|
+
return true;
|
531
|
+
},
|
532
|
+
isEmpty : function(val)
|
533
|
+
{
|
534
|
+
if (val.match(/^\s+$/) || val === "") {
|
535
|
+
return true;
|
536
|
+
} else {
|
537
|
+
return false;
|
538
|
+
}
|
539
|
+
},
|
540
|
+
checkTime : function(time){
|
541
|
+
// checks only hh:ss (and optional am/pm)
|
542
|
+
var re = /^(\d{1,2}):(\d{2})([ap]m)?$/,regs;
|
543
|
+
if(!this.isEmpty(time))
|
544
|
+
{
|
545
|
+
regs = time.match(re);
|
546
|
+
if(regs) {
|
547
|
+
if(regs[3]) {
|
548
|
+
if(regs[1] < 1 || regs[1] > 12) { return false; }
|
549
|
+
} else {
|
550
|
+
if(regs[1] > 23) { return false; }
|
551
|
+
}
|
552
|
+
if(regs[2] > 59) {
|
553
|
+
return false;
|
554
|
+
}
|
555
|
+
} else {
|
556
|
+
return false;
|
557
|
+
}
|
558
|
+
}
|
559
|
+
return true;
|
560
|
+
},
|
561
|
+
checkValues : function(val, valref,g) {
|
562
|
+
var edtrul,i, nm, dft, len;
|
563
|
+
if(typeof(valref)=='string'){
|
564
|
+
for( i =0, len=g.p.colModel.length;i<len; i++){
|
565
|
+
if(g.p.colModel[i].name==valref) {
|
566
|
+
edtrul = g.p.colModel[i].editrules;
|
567
|
+
valref = i;
|
568
|
+
try { nm = g.p.colModel[i].formoptions.label; } catch (e) {}
|
569
|
+
break;
|
570
|
+
}
|
571
|
+
}
|
572
|
+
} else if(valref >=0) {
|
573
|
+
edtrul = g.p.colModel[valref].editrules;
|
574
|
+
}
|
575
|
+
if(edtrul) {
|
576
|
+
if(!nm) { nm = g.p.colNames[valref]; }
|
577
|
+
if(edtrul.required === true) {
|
578
|
+
if( this.isEmpty(val) ) { return [false,nm+": "+$.jgrid.edit.msg.required,""]; }
|
579
|
+
}
|
580
|
+
// force required
|
581
|
+
var rqfield = edtrul.required === false ? false : true;
|
582
|
+
if(edtrul.number === true) {
|
583
|
+
if( !(rqfield === false && this.isEmpty(val)) ) {
|
584
|
+
if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.number,""]; }
|
585
|
+
}
|
586
|
+
}
|
587
|
+
if(typeof edtrul.minValue != 'undefined' && !isNaN(edtrul.minValue)) {
|
588
|
+
if (parseFloat(val) < parseFloat(edtrul.minValue) ) { return [false,nm+": "+$.jgrid.edit.msg.minValue+" "+edtrul.minValue,""];}
|
589
|
+
}
|
590
|
+
if(typeof edtrul.maxValue != 'undefined' && !isNaN(edtrul.maxValue)) {
|
591
|
+
if (parseFloat(val) > parseFloat(edtrul.maxValue) ) { return [false,nm+": "+$.jgrid.edit.msg.maxValue+" "+edtrul.maxValue,""];}
|
592
|
+
}
|
593
|
+
var filter;
|
594
|
+
if(edtrul.email === true) {
|
595
|
+
if( !(rqfield === false && this.isEmpty(val)) ) {
|
596
|
+
// taken from $ Validate plugin
|
597
|
+
filter = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i;
|
598
|
+
if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.email,""];}
|
599
|
+
}
|
600
|
+
}
|
601
|
+
if(edtrul.integer === true) {
|
602
|
+
if( !(rqfield === false && this.isEmpty(val)) ) {
|
603
|
+
if(isNaN(val)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""]; }
|
604
|
+
if ((val % 1 !== 0) || (val.indexOf('.') != -1)) { return [false,nm+": "+$.jgrid.edit.msg.integer,""];}
|
605
|
+
}
|
606
|
+
}
|
607
|
+
if(edtrul.date === true) {
|
608
|
+
if( !(rqfield === false && this.isEmpty(val)) ) {
|
609
|
+
if(g.p.colModel[valref].formatoptions && g.p.colModel[valref].formatoptions.newformat) {
|
610
|
+
dft = g.p.colModel[valref].formatoptions.newformat;
|
611
|
+
} else {
|
612
|
+
dft = g.p.colModel[valref].datefmt || "Y-m-d";
|
613
|
+
}
|
614
|
+
if(!this.checkDate (dft, val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - "+dft,""]; }
|
615
|
+
}
|
616
|
+
}
|
617
|
+
if(edtrul.time === true) {
|
618
|
+
if( !(rqfield === false && this.isEmpty(val)) ) {
|
619
|
+
if(!this.checkTime (val)) { return [false,nm+": "+$.jgrid.edit.msg.date+" - hh:mm (am/pm)",""]; }
|
620
|
+
}
|
621
|
+
}
|
622
|
+
if(edtrul.url === true) {
|
623
|
+
if( !(rqfield === false && this.isEmpty(val)) ) {
|
624
|
+
filter = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
|
625
|
+
if(!filter.test(val)) {return [false,nm+": "+$.jgrid.edit.msg.url,""];}
|
626
|
+
}
|
627
|
+
}
|
628
|
+
if(edtrul.custom === true) {
|
629
|
+
if( !(rqfield === false && this.isEmpty(val)) ) {
|
630
|
+
if($.isFunction(edtrul.custom_func)) {
|
631
|
+
var ret = edtrul.custom_func.call(g,val,nm);
|
632
|
+
if($.isArray(ret)) {
|
633
|
+
return ret;
|
634
|
+
} else {
|
635
|
+
return [false,$.jgrid.edit.msg.customarray,""];
|
636
|
+
}
|
637
|
+
} else {
|
638
|
+
return [false,$.jgrid.edit.msg.customfcheck,""];
|
639
|
+
}
|
640
|
+
}
|
641
|
+
}
|
642
|
+
}
|
643
|
+
return [true,"",""];
|
644
|
+
}
|
645
|
+
});
|
646
|
+
})(jQuery);
|