lipsiadmin 5.1.1 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/version.rb CHANGED
@@ -2,7 +2,7 @@ module Lipsiadmin
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 5
4
4
  MINOR = 1
5
- TINY = 1
5
+ TINY = 2
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,4 +1,3 @@
1
- # If you translate this other language or have something to fix please send me an email at: d.dagostino@lipsiasoft.com
2
1
  en:
3
2
  backend:
4
3
  tabs:
@@ -14,7 +13,7 @@ en:
14
13
  of: "of"
15
14
  sessions:
16
15
  wrong: "Wrong email or password"
17
- logout: "Correctly Logged Out"
16
+ logout: "Successfully Logged Out"
18
17
  menus:
19
18
  account: "Account"
20
19
  list: "List"
@@ -43,15 +42,15 @@ en:
43
42
  send: "Send"
44
43
  help:
45
44
  title: "Support request"
46
- description: "Say us what problem do you have and how we can reproduce it"
47
- compliments: "Your request was correctly delivered."
45
+ description: "Tell us the problem you have and how we can reproduce it."
46
+ compliments: "Your request was delivered successfully."
48
47
  labels:
49
48
  all: "All "
50
49
  search: "Search"
51
50
  messages:
52
51
  compliments:
53
52
  title: "Congratulations"
54
- message: "Your data are correctly saved."
53
+ message: "Your data was saved successfully."
55
54
  wait:
56
55
  title: "Sending Data"
57
56
  message: "Sending data to servers..."
@@ -60,8 +59,8 @@ en:
60
59
  message: "Are you sure to destroy {0} element/s ?"
61
60
  alert:
62
61
  title: "Attention"
63
- message: "There are some connection issues.<br />Contact tecnical support."
64
- notConfigured: "This fatures is not ready yet.<br />Contact tecnical support."
62
+ message: "There are some connection issues.<br />Contact technical support."
63
+ notConfigured: "This feature is not ready yet.<br />Contact technical support."
65
64
  notSelected: "You must select at least one record"
66
65
 
67
66
  emails:
@@ -70,7 +69,7 @@ en:
70
69
  body: "Hello {{name}},\nyour account has been activated.\n\nYou can login with the following email/password:\n\n- Email: {{email}}\n- Password: {{password}}\n\nusing the following url: {{url}}"
71
70
  support:
72
71
  object: "Support Request"
73
- footer: "\n---------------------------\nCordiali Saluti,\nLipsiaSoft s.r.l."
72
+ footer: "\n---------------------------\nThank you,\nLipsiaSoft s.r.l."
74
73
 
75
74
  print:
76
75
  footer:
@@ -0,0 +1,790 @@
1
+ /**
2
+ * @class Ext.SwfUploadPanel
3
+ * @extends Ext.grid.GridPanel
4
+
5
+ * Makes a Panel to provide the ability to upload multiple files using the SwfUpload flash script.
6
+ *
7
+ * @author Stephan Wentz
8
+ * @author Michael Giddens (Original author)
9
+ * @website http://www.brainbits.net
10
+ * @created 2008-02-26
11
+ * @version 0.5
12
+ *
13
+ * known_issues
14
+ * - Progress bar used hardcoded width. Not sure how to make 100% in bbar
15
+ * - Panel requires width / height to be set. Not sure why it will not fit
16
+ * - when panel is nested sometimes the column model is not always shown to fit until a file is added. Render order issue.
17
+ *
18
+ * @constructor
19
+ * @param {Object} config The config object
20
+ */
21
+ Ext.SwfUploadPanel = Ext.extend(Ext.grid.GridPanel, {
22
+
23
+ /**
24
+ * @cfg {Object} strings
25
+ * All strings used by Ext.SwfUploadPanel
26
+ */
27
+ strings: {
28
+ text_add: 'Add File(s)',
29
+ text_upload: 'Upload File(s)',
30
+ text_cancel: 'Cancel Upload',
31
+ text_clear: 'Clear Queue',
32
+ text_progressbar: 'Progress Bar',
33
+ text_remove: 'Remove File',
34
+ text_remove_sure: 'Are you sure you wish to remove this file from queue?',
35
+ text_error: 'Error',
36
+ text_uploading: 'Uploading file: {0} ({1} of {2})',
37
+ header_filename: 'Filename',
38
+ header_size: 'Size',
39
+ header_status: 'Status',
40
+ status: {
41
+ 0: 'Queued',
42
+ 1: 'Uploading...',
43
+ 2: 'Completed',
44
+ 3: 'Error',
45
+ 4: 'Cancelled'
46
+ },
47
+ error_queue_exceeded: 'The selected file(s) exceed(s) the maximum number of {0} queued files.',
48
+ error_queue_slots_0: 'There is no slot left',
49
+ error_queue_slots_1: 'There is only one slot left',
50
+ error_queue_slots_2: 'There are only {0} slots left',
51
+ error_size_exceeded: 'The selected files size exceeds the allowed limit of 1 MB.',
52
+ error_zero_byte_file: 'Zero byte file selected.',
53
+ error_invalid_filetype: 'Invalid filetype selected.',
54
+ error_file_not_found: 'File not found 404.',
55
+ error_security_error: 'Security Error. Not allowed to post to different url.'
56
+ },
57
+
58
+ /**
59
+ * @cfg {Boolean} single_select
60
+ * false to allow multiple file selections, true for single file selection.
61
+ * Please note that this doesn't affect the number of allowed files in the queue.
62
+ * Use the {@link #file_queue_limit} parameter to change the allowed number of files in the queue.
63
+ */
64
+ single_select: true,
65
+ /**
66
+ * @cfg {Boolean} confirm_delete
67
+ * Show a confirmation box on deletion of queued files.
68
+ */
69
+ confirm_delete: true,
70
+ /**
71
+ * @cfg {String} file_types
72
+ * Allowed file types for the File Selection Dialog. Use semi-colon as a seperator for multiple file-types.
73
+ */
74
+ file_types: "*.*", // Default allow all file types
75
+ /**
76
+ * @cfg {String} file_types
77
+ * A text description that is displayed to the user in the File Browser dialog.
78
+ */
79
+ file_types_description: "All Files", //
80
+ /**
81
+ * @cfg {String} file_size_limit
82
+ * The file_size_limit setting defines the maximum allowed size of a file to be uploaded.
83
+ * This setting accepts a value and unit. Valid units are B, KB, MB and GB. If the unit is omitted default is KB.
84
+ * A value of 0 (zero) is interpretted as unlimited.
85
+ */
86
+ file_size_limit: "1MB", // Default size limit 100MB
87
+ /**
88
+ * @cfg {String} file_upload_limit
89
+ * Defines the number of files allowed to be uploaded by SWFUpload.
90
+ * This setting also sets the upper bound of the {@link #file_queue_limit} setting.
91
+ * The value of 0 (zero) is interpretted as unlimited.
92
+ */
93
+ file_upload_limit: "0", // Default no upload limit
94
+ /**
95
+ * @cfg {String} file_queue_limit
96
+ * Defines the number of unprocessed files allowed to be simultaneously queued.
97
+ * The value of 0 (zero) is interpretted as unlimited.
98
+ */
99
+ file_queue_limit: "0", // Default no queue limit
100
+ /**
101
+ * @cfg {String} file_post_name
102
+ * The file_post_name allows you to set the value name used to post the file.
103
+ */
104
+ file_post_name: "file", // Default name
105
+ /**
106
+ * @cfg {String} flash_url
107
+ * The full, absolute, or relative URL to the Flash Control swf file.
108
+ */
109
+ flash_url: "swfupload.swf", // Default url, relative to the page url
110
+ /**
111
+ * @cfg {Boolean} debug
112
+ * A boolean value that defines whether the debug event handler should be fired.
113
+ */
114
+ debug: false,
115
+
116
+ // standard grid parameters
117
+ autoExpandColumn: 'name',
118
+ enableColumnResize: false,
119
+ enableColumnMove: false,
120
+ border: false,
121
+ viewConfig: { forceFit: true },
122
+
123
+ // private
124
+ upload_cancelled: false,
125
+
126
+ // private
127
+ initComponent: function() {
128
+
129
+ this.addEvents(
130
+ /**
131
+ * @event swfUploadLoaded
132
+ * Fires after the Flash object has been loaded
133
+ * @param {Ext.grid.GridPanel} grid This grid
134
+ */
135
+ 'swfUploadLoaded',
136
+ /**
137
+ * @event swfUploadLoaded
138
+ * Fires after a file has been qeueud
139
+ * @param {Ext.grid.GridPanel} grid This grid
140
+ * @param {Object} file The file object that produced the error
141
+ */
142
+ 'fileQueued',
143
+ /**
144
+ * @event startUpload
145
+ * Fires before the upload starts
146
+ * @param {Ext.grid.GridPanel} grid This grid
147
+ */
148
+ 'startUpload',
149
+ /**
150
+ * @event fileUploadError
151
+ * Fires after an upload has been stopped or cancelled
152
+ * @param {Ext.grid.GridPanel} grid This grid
153
+ * @param {Object} file The file object that produced the error
154
+ * @param {String} code The error code
155
+ * @param {String} message Supplemental error message
156
+ */
157
+ 'fileUploadError',
158
+ /**
159
+ * @event fileUploadSuccess
160
+ * Fires after an upload has been successfully uploaded
161
+ * @param {Ext.grid.GridPanel} grid This grid
162
+ * @param {Object} file The file object that has been uploaded
163
+ * @param {Object} data The response data of the upload request
164
+ */
165
+ 'fileUploadSuccess',
166
+ /**
167
+ * @event fileUploadComplete
168
+ * Fires after the upload cycle for one file finished
169
+ * @param {Ext.grid.GridPanel} grid This grid
170
+ * @param {Object} file The file object that has been uploaded
171
+ */
172
+ 'fileUploadComplete',
173
+ /**
174
+ * @event fileUploadComplete
175
+ * Fires after the upload cycle for all files in the queue finished
176
+ * @param {Ext.grid.GridPanel} grid This grid
177
+ */
178
+ 'allUploadsComplete',
179
+ /**
180
+ * @event fileUploadComplete
181
+ * Fires after one or more files have been removed from the queue
182
+ * @param {Ext.grid.GridPanel} grid This grid
183
+ */
184
+ 'removeFiles',
185
+ /**
186
+ * @event fileUploadComplete
187
+ * Fires after all files have been removed from the queue
188
+ * @param {Ext.grid.GridPanel} grid This grid
189
+ */
190
+ 'removeAllFiles'
191
+ );
192
+
193
+ this.rec = Ext.data.Record.create([
194
+ {name: 'name'},
195
+ {name: 'size'},
196
+ {name: 'id'},
197
+ {name: 'type'},
198
+ {name: 'creationdate', type: 'date', dateFormat: 'm/d/Y'},
199
+ {name: 'status'}
200
+ ]);
201
+
202
+ this.store = new Ext.data.Store({
203
+ reader: new Ext.data.JsonReader({
204
+ id: 'id'
205
+ }, this.rec)
206
+ });
207
+
208
+ this.columns = [{
209
+ id:'name',
210
+ header: this.strings.header_filename,
211
+ dataIndex: 'name'
212
+ },{
213
+ id:'size',
214
+ header: this.strings.header_size,
215
+ width: 80,
216
+ dataIndex: 'size',
217
+ renderer: this.formatBytes
218
+ },{
219
+ id:'status',
220
+ header: this.strings.header_status,
221
+ width: 100,
222
+ dataIndex: 'status',
223
+ renderer: this.formatStatus.createDelegate(this)
224
+ },{
225
+ id:'progress',
226
+ header: 'Progess',
227
+ width: 150,
228
+ renderer: this.formatProgressBar
229
+ }
230
+
231
+ ];
232
+
233
+ this.sm = new Ext.grid.RowSelectionModel({
234
+ singleSelect: this.single_select
235
+ });
236
+
237
+ this.tbar = [{
238
+ text: this.strings.text_add,
239
+ cls: 'x-btn-text-icon add',
240
+ xhandler: function() {
241
+ if (this.single_select) {
242
+ this.suo.selectFile();
243
+ }
244
+ else {
245
+ this.suo.selectFiles();
246
+ }
247
+ },
248
+ xscope: this,
249
+ // added by mh
250
+ listeners: {
251
+ render: function(){
252
+ this.initButton();
253
+ },
254
+ scope: this
255
+ }
256
+ // end added
257
+ }, '->', {
258
+ text: this.strings.text_cancel,
259
+ cls: 'x-btn-text-icon remove',
260
+ handler: this.stopUpload,
261
+ scope: this,
262
+ hidden: true
263
+ }, {
264
+ text: this.strings.text_upload,
265
+ cls: 'x-btn-text-icon upload',
266
+ handler: this.startUpload,
267
+ scope: this,
268
+ hidden: true
269
+ }, {
270
+ text: this.strings.text_clear,
271
+ cls: 'x-btn-text-icon remove',
272
+ handler: this.removeAllFiles,
273
+ scope: this,
274
+ hidden: false
275
+ }];
276
+
277
+ this.addListener({
278
+ keypress: {
279
+ fn: function(e) {
280
+ if (this.confirm_delete) {
281
+ if(e.getKey() == e.DELETE) {
282
+ Ext.MessageBox.confirm(this.strings.text_remove,this.strings.text_remove_sure, function(e) {
283
+ if (e == 'yes') {
284
+ this.removeFiles();
285
+ }
286
+ }, this);
287
+ }
288
+ } else {
289
+ this.removeFiles(this);
290
+ }
291
+ },
292
+ scope: this
293
+ },
294
+
295
+ // Prevent the default right click to show up in the grid.
296
+ contextmenu: function(e) {
297
+ e.stopEvent();
298
+ },
299
+
300
+ // modified by mh
301
+ render: function(){
302
+ this.addBtn = this.getTopToolbar().items.items[0];
303
+ this.cancelBtn = this.getTopToolbar().items.items[2];
304
+ this.uploadBtn = this.getTopToolbar().items.items[3];
305
+ this.clearBtn = this.getTopToolbar().items.items[4];
306
+ }
307
+ // end modified
308
+ });
309
+
310
+ Ext.SwfUploadPanel.superclass.initComponent.call(this);
311
+ },
312
+
313
+ // modified by mh - refactor to separate method
314
+ initButton: function() {
315
+ var suoID = Ext.id();
316
+ var em = this.addBtn.el.child('em');
317
+ em.setStyle({
318
+ position: 'relative',
319
+ display: 'block'
320
+ });
321
+ em.createChild({
322
+ tag: 'div',
323
+ id: suoID
324
+ });
325
+ this.suo = new SWFUpload({
326
+ button_placeholder_id: suoID,
327
+ button_width: em.getWidth(),
328
+ button_height: em.getHeight(),
329
+ button_cursor: SWFUpload.CURSOR.HAND,
330
+ button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
331
+
332
+ upload_url: this.upload_url,
333
+ post_params: this.post_params,
334
+ file_post_name: this.file_post_name,
335
+ file_size_limit: this.file_size_limit,
336
+ file_queue_limit: this.file_queue_limit,
337
+ file_types: this.file_types,
338
+ file_types_description: this.file_types_description,
339
+ file_upload_limit: this.file_upload_limit,
340
+ flash_url: this.flash_url,
341
+
342
+ // Event Handler Settings
343
+ swfupload_loaded_handler: this.swfUploadLoaded.createDelegate(this),
344
+
345
+ file_dialog_start_handler: this.fileDialogStart.createDelegate(this),
346
+ file_queued_handler: this.fileQueue.createDelegate(this),
347
+ file_queue_error_handler: this.fileQueueError.createDelegate(this),
348
+ file_dialog_complete_handler: this.fileDialogComplete.createDelegate(this),
349
+
350
+ upload_start_handler: this.uploadStart.createDelegate(this),
351
+ upload_progress_handler: this.uploadProgress.createDelegate(this),
352
+ upload_error_handler: this.uploadError.createDelegate(this),
353
+ upload_success_handler: this.uploadSuccess.createDelegate(this),
354
+ upload_complete_handler: this.uploadComplete.createDelegate(this),
355
+
356
+ debug: this.debug,
357
+ debug_handler: this.debug ? this.debugHandler : Ext.emptyFn
358
+ });
359
+
360
+ Ext.get(this.suo.movieName).setStyle({
361
+ position: 'absolute',
362
+ top: 0,
363
+ left: 0
364
+ });
365
+ },
366
+
367
+ formatProgressBar : function(_v, cellmeta, record){
368
+ switch(record.data.fileState){
369
+ case SWFUpload.FILE_STATUS.COMPLETE:
370
+ if(Ext.isIE){
371
+ returnValue =
372
+ '<div class="x-progress-wrap" style="height: 18px">' +
373
+ '<div class="x-progress-inner">' +
374
+ '<div style="width: 100%;" class="x-progress-bar x-progress-text">' + '100 %'
375
+ '</div>' +
376
+ '</div>' +
377
+ '</div>';
378
+ }else{
379
+ returnValue =
380
+ '<div class="x-progress-wrap" style="height: 18px">' +
381
+ '<div class="x-progress-inner">' +
382
+ '<div id="progressBar_' + record.data.id + '" style="width: 100%;" class="x-progress-bar">' +
383
+ '</div>' +
384
+ '<div id="progressText_' + record.data.id + '" style="width: 100%;" class="x-progress-text x-progress-text-back" />100 %</div>'
385
+ '</div>' +
386
+ '</div>';
387
+ }
388
+ break;
389
+ default :
390
+ returnValue =
391
+ '<div class="x-progress-wrap" style="height: 18px">' +
392
+ '<div class="x-progress-inner">' +
393
+ '<div id="progressBar_' + record.data.id + '" style="width: 0%;" class="x-progress-bar">' +
394
+ '</div>' +
395
+ '<div id="progressText_' + record.data.id + '" style="width: 100%;" class="x-progress-text x-progress-text-back" />0 %</div>'
396
+ '</div>' +
397
+ '</div>';
398
+ break;
399
+ }
400
+ return returnValue;
401
+ },
402
+
403
+ /**
404
+ * SWFUpload debug handler
405
+ * @param {Object} line
406
+ */
407
+ debugHandler: function(line) {
408
+ console.log(line);
409
+ },
410
+
411
+ /**
412
+ * Formats file status
413
+ * @param {Integer} status
414
+ * @return {String}
415
+ */
416
+ formatStatus: function(status) {
417
+ return this.strings.status[status];
418
+ },
419
+
420
+ /**
421
+ * Formats raw bytes into kB/mB/GB/TB
422
+ * @param {Integer} bytes
423
+ * @return {String}
424
+ */
425
+ formatBytes: function(size) {
426
+ if (!size) {
427
+ size = 0;
428
+ }
429
+ var suffix = ["B", "KB", "MB", "GB"];
430
+ var result = size;
431
+ size = parseInt(size, 10);
432
+ result = size + " " + suffix[0];
433
+ var loop = 0;
434
+ while (size / 1024 > 1) {
435
+ size = size / 1024;
436
+ loop++;
437
+ }
438
+ result = Math.round(size) + " " + suffix[loop];
439
+
440
+ return result;
441
+
442
+ if(isNaN(bytes)) {
443
+ return ('');
444
+ }
445
+
446
+ var unit, val;
447
+
448
+ if(bytes < 999) {
449
+ unit = 'B';
450
+ val = (!bytes && this.progressRequestCount >= 1) ? '~' : bytes;
451
+ } else if(bytes < 999999) {
452
+ unit = 'kB';
453
+ val = Math.round(bytes/1000);
454
+ } else if(bytes < 999999999) {
455
+ unit = 'MB';
456
+ val = Math.round(bytes/100000) / 10;
457
+ } else if(bytes < 999999999999) {
458
+ unit = 'GB';
459
+ val = Math.round(bytes/100000000) / 10;
460
+ } else {
461
+ unit = 'TB';
462
+ val = Math.round(bytes/100000000000) / 10;
463
+ }
464
+
465
+ return (val + ' ' + unit);
466
+ },
467
+
468
+ /**
469
+ * SWFUpload swfUploadLoaded event
470
+ */
471
+ swfUploadLoaded: function() {
472
+ if(this.debug) console.info('SWFUPLOAD LOADED');
473
+
474
+ this.fireEvent('swfUploadLoaded', this);
475
+ },
476
+
477
+ /**
478
+ * SWFUpload fileDialogStart event
479
+ */
480
+ fileDialogStart: function() {
481
+ if(this.debug) console.info('FILE DIALOG START');
482
+
483
+ this.fireEvent('fileDialogStart', this);
484
+ },
485
+
486
+ /**
487
+ * Add file to store / grid
488
+ * SWFUpload fileQueue event
489
+ * @param {Object} file
490
+ */
491
+ fileQueue: function(file) {
492
+ if(this.debug) console.info('FILE QUEUE');
493
+ file.status = 0;
494
+ r = new this.rec(file);
495
+ r.id = file.id;
496
+ this.store.add(r);
497
+
498
+ this.fireEvent('fileQueued', this, file);
499
+ },
500
+
501
+ /**
502
+ * Error when file queue error occurs
503
+ * SWFUpload fileQueueError event
504
+ * @param {Object} file
505
+ * @param {Integer} code
506
+ * @param {string} message
507
+ */
508
+ fileQueueError: function(file, code, message) {
509
+ if(this.debug) console.info('FILE QUEUE ERROR');
510
+
511
+ switch (code) {
512
+ case -100:
513
+ var slots;
514
+ switch(message) {
515
+ case '0':
516
+ slots = this.strings.error_queue_slots_0;
517
+ break;
518
+ case '1':
519
+ slots = this.strings.error_queue_slots_1;
520
+ break;
521
+ default:
522
+ slots = String.format(this.strings.error_queue_slots_2, message);
523
+ }
524
+ Ext.MessageBox.alert(this.strings.text_error, String.format(this.strings.error_queue_exceeded + ' ' + slots, this.file_queue_limit));
525
+ break;
526
+
527
+ case -110:
528
+ Ext.MessageBox.alert(this.strings.text_error, String.format(this.strings.error_size_exceeded, this.formatBytes(this.file_size_limit * 1024)));
529
+ break;
530
+
531
+ case -120:
532
+ Ext.MessageBox.alert(this.strings.text_error, this.strings.error_zero_byte_file);
533
+ break;
534
+
535
+ case -130:
536
+ Ext.MessageBox.alert(this.strings.text_error, this.strings.error_invalid_filetype);
537
+ break;
538
+ }
539
+
540
+ this.fireEvent('fileQueueError', this, file, code/*, error*/);
541
+ },
542
+
543
+ /**
544
+ * SWFUpload fileDialogComplete event
545
+ * @param {Integer} file_count
546
+ */
547
+ fileDialogComplete: function(file_count) {
548
+ if(this.debug) console.info('FILE DIALOG COMPLETE');
549
+
550
+ if (file_count > 0) {
551
+ this.uploadBtn.show();
552
+ }
553
+
554
+ this.addBtn.show();
555
+ this.clearBtn.show();
556
+
557
+ this.fireEvent('fileDialogComplete', this, file_count);
558
+ },
559
+
560
+ /**
561
+ * SWFUpload uploadStart event
562
+ * @param {Object} file
563
+ */
564
+ uploadStart: function(file) {
565
+ if(this.debug) console.info('UPLOAD START');
566
+ this.fireEvent('uploadStart', this, file);
567
+
568
+ return true;
569
+ },
570
+
571
+ /**
572
+ * SWFUpload uploadProgress event
573
+ * @param {Object} file
574
+ * @param {Integer} bytes_completed
575
+ * @param {Integer} bytes_total
576
+ */
577
+ progressCount : 0,
578
+ uploadProgress: function(file, bytes_completed, bytes_total) {
579
+ //if(this.debug)
580
+ var percent = Math.ceil((bytes_completed / bytes_total) * 100);
581
+ if (percent != this.progressCount)
582
+ {
583
+ Ext.getDom('progressBar_' + file.id).style.width = percent + "%";
584
+ Ext.getDom('progressText_' + file.id).innerHTML = percent + " %";
585
+ this.progressCount = percent;
586
+ }
587
+
588
+ //console.info(percent);
589
+
590
+ this.store.getById(file.id).set('status', 1);
591
+
592
+ //this.store.getById(file.id).commit();
593
+
594
+ this.fireEvent('uploadProgress', this, file, bytes_completed, bytes_total);
595
+ },
596
+
597
+ /**
598
+ * SWFUpload uploadError event
599
+ * Show notice when error occurs
600
+ * @param {Object} file
601
+ * @param {Integer} error
602
+ * @param {Integer} code
603
+ * @return {}
604
+ */
605
+ uploadError: function(file, error, code) {
606
+ if(this.debug) console.info('UPLOAD ERROR');
607
+ if (code==500)
608
+ {
609
+ Ext.MessageBox.alert(this.strings.text_error, "File too big");
610
+ this.fireEvent('fileUploadError', this, file, error, code);
611
+ return;
612
+ }
613
+ switch (error) {
614
+ case -200:
615
+ Ext.MessageBox.alert(this.strings.text_error, this.strings.error_file_not_found);
616
+ break;
617
+
618
+ case -230:
619
+ Ext.MessageBox.alert(this.strings.text_error, this.strings.error_security_error);
620
+ break;
621
+
622
+ case -290:
623
+ this.store.getById(file.id).set('status', 4);
624
+ this.store.getById(file.id).commit();
625
+ break;
626
+ }
627
+
628
+ this.fireEvent('fileUploadError', this, file, error, code);
629
+ },
630
+
631
+ /**
632
+ * SWFUpload uploadSuccess event
633
+ * @param {Object} file
634
+ * @param {Object} response
635
+ */
636
+ uploadSuccess: function(file, response) {
637
+ if(this.debug) console.info('UPLOAD SUCCESS');
638
+
639
+ var data = Ext.decode(response);
640
+ if (data.success) {
641
+ this.store.getById(file.id).data.fileState = SWFUpload.FILE_STATUS.COMPLETE;
642
+ this.store.getById(file.id).set('status', 2);
643
+ //this.store.remove(this.store.getById(file.id));
644
+ } else {
645
+ this.store.getById(file.id).set('status', 3);
646
+ this.store.getById(file.id).commit();
647
+ if (data.msg) {
648
+ Ext.MessageBox.alert(this.strings.text_error, data.msg);
649
+ }
650
+ }
651
+
652
+
653
+ this.fireEvent('fileUploadSuccess', this, file, data);
654
+ },
655
+
656
+ /**
657
+ * SWFUpload uploadComplete event
658
+ * @param {Object} file
659
+ */
660
+ uploadComplete: function(file) {
661
+ if(this.debug) console.info('UPLOAD COMPLETE');
662
+
663
+ if(this.suo.getStats().files_queued && !this.upload_cancelled) {
664
+ this.suo.startUpload();
665
+ } else {
666
+ this.fireEvent('fileUploadComplete', this, file);
667
+
668
+ this.allUploadsComplete();
669
+ }
670
+
671
+ },
672
+
673
+ /**
674
+ * SWFUpload allUploadsComplete method
675
+ */
676
+ allUploadsComplete: function() {
677
+ this.cancelBtn.hide();
678
+ this.addBtn.show();
679
+ this.clearBtn.show();
680
+
681
+ this.fireEvent('allUploadsComplete', this);
682
+ },
683
+
684
+ /**
685
+ * SWFUpload setPostParams method
686
+ * @param {String} name
687
+ * @param {String} value
688
+ */
689
+ addPostParam: function(name, value) {
690
+ if (this.suo) {
691
+ this.suo.settings.post_params[name] = value;
692
+ this.suo.setPostParams(this.suo.settings.post_params);
693
+ } else {
694
+ this.post_params[name] = value;
695
+ }
696
+ },
697
+
698
+ /**
699
+ * Start file upload
700
+ * SWFUpload startUpload method
701
+ */
702
+ startUpload: function() {
703
+ if(this.debug) console.info('START UPLOAD');
704
+
705
+ this.cancelBtn.show();
706
+ this.uploadBtn.hide();
707
+ this.clearBtn.hide();
708
+ // this.addBtn.hide();
709
+
710
+ this.upload_cancelled = false;
711
+
712
+ this.fireEvent('startUpload', this);
713
+
714
+ this.suo.startUpload();
715
+ },
716
+
717
+ /**
718
+ * SWFUpload stopUpload method
719
+ * @param {Object} file
720
+ */
721
+ stopUpload: function(file) {
722
+ if(this.debug) console.info('STOP UPLOAD');
723
+
724
+ this.suo.stopUpload();
725
+
726
+ this.upload_cancelled = true;
727
+
728
+ this.getStore().each(function() {
729
+ if (this.data.status == 1) {
730
+ this.set('status', 0);
731
+ this.commit();
732
+ }
733
+ });
734
+
735
+ this.cancelBtn.hide();
736
+ if (this.suo.getStats().files_queued > 0) {
737
+ this.uploadBtn.show();
738
+ }
739
+ this.addBtn.show();
740
+ this.clearBtn.show();
741
+ },
742
+
743
+ /**
744
+ * Delete one or multiple rows
745
+ * SWFUpload cancelUpload method
746
+ */
747
+ removeFiles: function() {
748
+ if(this.debug) console.info('REMOVE FILES');
749
+
750
+ var selRecords = this.getSelections();
751
+ for (var i=0; i < selRecords.length; i++) {
752
+ if (selRecords[i].data.status != 1) {
753
+ this.suo.cancelUpload(selRecords[i].id);
754
+ this.store.remove(selRecords[i]);
755
+ }
756
+ }
757
+
758
+ if (this.suo.getStats().files_queued === 0) {
759
+ this.uploadBtn.hide();
760
+ // this.clearBtn.hide();
761
+ }
762
+
763
+ this.fireEvent('removeFiles', this);
764
+ },
765
+
766
+ /**
767
+ * Clear the Queue
768
+ * SWFUpload cancelUpload method
769
+ */
770
+ removeAllFiles: function() {
771
+ if(this.debug) console.info('REMOVE ALL');
772
+
773
+ // mark all internal files as cancelled
774
+ var files_left = this.suo.getStats().files_queued;
775
+
776
+ while (files_left > 0) {
777
+ this.suo.cancelUpload();
778
+ files_left = this.suo.getStats().files_queued;
779
+ }
780
+
781
+ this.store.removeAll();
782
+
783
+ this.cancelBtn.hide();
784
+ this.uploadBtn.hide();
785
+ // this.clearBtn.hide();
786
+
787
+ this.fireEvent('removeAllFiles', this);
788
+ }
789
+
790
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lipsiadmin
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Davide D'Agostino
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-18 00:00:00 +01:00
12
+ date: 2010-02-03 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -441,8 +441,8 @@ files:
441
441
  - lib/view/helpers/frontend_helper.rb
442
442
  - lib/view/helpers/pdf_helper.rb
443
443
  - lib/view/helpers/view_helper.rb
444
+ - resources/javascripts/swfuploadpanel.js
444
445
  - resources/javascripts/ux.js
445
- - resources/javascripts/ux.min.js
446
446
  - resources/pd4ml/pd4ml.jar
447
447
  - resources/pd4ml/ruby/Pd4Ruby.class
448
448
  - resources/pd4ml/ruby/Pd4Ruby.java
@@ -1,3 +0,0 @@
1
- Ext.util.Format.eurMoney=function(v){v=(Math.round((v-0)*100))/100;v=(v==Math.floor(v))?v+".00":((v*10==Math.floor(v*10))?v+"0":v);return v+" €"};Ext.util.Format.percentage=function(v,p,record){return(v+" %")};Ext.util.Format.boolRenderer=function(v,p,record){p.css+=" x-grid3-check-col-td";return'<div class="x-grid3-check-col'+(v?"-on":"")+" x-grid3-cc-"+this.id+'">&#160;</div>'};var treeDropConfig={getDropPoint:function(e,n,dd){var tn=n.node;if(tn.isRoot){return tn.allowChildren!==false?"append":false}var dragEl=n.ddel;var t=Ext.lib.Dom.getY(dragEl),b=t+dragEl.offsetHeight;var y=Ext.lib.Event.getPageY(e);var noAppend=tn.allowChildren===false;if(this.appendOnly||tn.parentNode.allowChildren===false){return noAppend?false:"append"}var noBelow=false;if(!this.allowParentInsert){noBelow=tn.hasChildNodes()&&tn.isExpanded()}var q=(b-t)/(noAppend?2:3);if(y>=t&&y<(t+q)){return"above"}else{if(!noBelow&&(noAppend||y>=b-q&&y<=b)){return"below"}else{return"append"}}},completeDrop:function(de){var ns=de.dropNode,p=de.point,t=de.target;if(!Ext.isArray(ns)){ns=[ns]}var n;for(var i=0,len=ns.length;i<len;i++){n=ns[i];if(p=="above"){t.parentNode.insertBefore(n,t)}else{if(p=="below"){t.parentNode.insertBefore(n,t.nextSibling)}else{t.leaf=false;t.appendChild(n)}}}n.ui.focus();if(this.tree.hlDrop){n.ui.highlight()}t.ui.endDrop();this.tree.fireEvent("nodedrop",de)}};Ext.grid.CheckColumn=function(config){Ext.apply(this,config);if(!this.id){this.id=Ext.id()}this.renderer=this.renderer.createDelegate(this)};Ext.grid.CheckColumn.prototype={init:function(grid){this.grid=grid;this.grid.on("render",function(){var view=this.grid.getView();view.mainBody.on("mousedown",this.onMouseDown,this)},this)},onMouseDown:function(e,t){if(t.className&&t.className.indexOf("x-grid3-cc-"+this.id)!=-1){e.stopEvent();var index=this.grid.getView().findRowIndex(t);var record=this.grid.store.getAt(index);var editEvent={grid:this.grid,record:this.grid.store.getAt(index),field:this.dataIndex,value:!record.data[this.dataIndex],originalValue:record.data[this.dataIndex],row:index,column:this.grid.getColumnModel().findColumnIndex(this.dataIndex)};record.set(this.dataIndex,editEvent.value);this.grid.getSelectionModel().selectRow(index);this.grid.fireEvent("afteredit",editEvent)}},renderer:function(v,p,record){p.css+=" x-grid3-check-col-td";return'<div class="x-grid3-check-col'+(v?"-on":"")+" x-grid3-cc-"+this.id+'">&#160;</div>'}};Ext.form.DateTimeField=Ext.extend(Ext.form.Field,{defaultAutoCreate:{tag:"input",type:"hidden"},timeWidth:100,dateWidth:100,dtSeparator:" ",hiddenFormat:"Y-m-d H:i:s",otherToNow:true,dateFormat:"d/m/y",timeFormat:"H:i",allowBlank:true,hideTime:false,initComponent:function(){Ext.form.DateTimeField.superclass.initComponent.call(this);var dateConfig=Ext.apply({},{id:this.id+"-date",format:this.dateFormat||Ext.form.DateField.prototype.format,width:this.dateWidth,allowBlank:this.allowBlank,selectOnFocus:this.selectOnFocus,listeners:{blur:{scope:this,fn:this.onBlur},focus:{scope:this,fn:this.onFocus}}},this.dateConfig);this.df=new Ext.form.DateField(dateConfig);this.df.ownerCt=this;delete (this.dateFormat);var timeConfig=Ext.apply({},{id:this.id+"-time",format:this.timeFormat||Ext.form.TimeField.prototype.format,allowBlank:(this.hideTime||this.allowBlank),width:this.timeWidth,selectOnFocus:this.selectOnFocus,listeners:{blur:{scope:this,fn:this.onBlur},focus:{scope:this,fn:this.onFocus}}},this.timeConfig);this.tf=new Ext.form.TimeField(timeConfig);this.tf.ownerCt=this;delete (this.timeFormat);this.relayEvents(this.df,["focus","specialkey","invalid","valid"]);this.relayEvents(this.tf,["focus","specialkey","invalid","valid"])},onRender:function(ct,position){if(this.isRendered){return}Ext.form.DateTimeField.superclass.onRender.call(this,ct,position);var t;var timeStyle=this.hideTime?"display:none":"";t=Ext.DomHelper.append(ct,{tag:"table",style:"border-collapse:collapse",children:[{tag:"tr",children:[{tag:"td",style:"padding-right:17px",cls:"datetime-date"},{tag:"td",cls:"datetime-time",style:timeStyle}]}]},true);this.tableEl=t;this.wrap=t.wrap();this.wrap.on("mousedown",this.onMouseDown,this,{delay:10});this.df.render(t.child("td.datetime-date"));this.tf.render(t.child("td.datetime-time"));this.df.wrap.setStyle({width:this.dateWidth});this.tf.wrap.setStyle({width:this.timeWidth});if(Ext.isIE&&Ext.isStrict){t.select("input").applyStyles({top:0})}this.on("specialkey",this.onSpecialKey,this);this.df.el.swallowEvent(["keydown","keypress"]);this.tf.el.swallowEvent(["keydown","keypress"]);if("side"===this.msgTarget){var elp=this.el.findParent(".x-form-element",10,true);this.errorIcon=elp.createChild({cls:"x-form-invalid-icon"});this.df.errorIcon=this.errorIcon;this.tf.errorIcon=this.errorIcon}if(!this.el.dom.name){this.el.dom.name=this.hiddenName||this.name||this.id}this.df.el.dom.removeAttribute("name");this.tf.el.dom.removeAttribute("name");this.isRendered=true;if(this.el.dom.value){this.setValue(this.el.dom.value)}else{if(true===this.emptyToNow){this.setValue(new Date());this.updateHidden()}}},adjustSize:Ext.BoxComponent.prototype.adjustSize,alignErrorIcon:function(){this.errorIcon.alignTo(this.tableEl,"tl-tr",[2,0])},initDateValue:function(){this.dateValue=this.otherToNow?new Date():""},clearInvalid:function(){this.df.clearInvalid();this.tf.clearInvalid()},beforeDestroy:function(){if(this.isRendered){this.wrap.removeAllListeners();this.wrap.remove();this.tableEl.remove();this.df.destroy();this.tf.destroy()}},disable:function(){if(this.isRendered){this.df.disabled=this.disabled;this.df.onDisable();this.tf.onDisable()}this.disabled=true;this.df.disabled=true;this.tf.disabled=true;this.fireEvent("disable",this);return this},enable:function(){if(this.rendered){this.df.onEnable();this.tf.onEnable()}this.disabled=false;this.df.disabled=false;this.tf.disabled=false;this.fireEvent("enable",this);return this},focus:function(){this.df.focus()},getPositionEl:function(){return this.wrap},getResizeEl:function(){return this.wrap},getValue:function(){return this.dateValue?new Date(this.dateValue):""},isValid:function(){return this.df.isValid()&&this.tf.isValid()},isVisible:function(){return this.df.rendered&&this.df.getActionEl().isVisible()},onBlur:function(f){if(this.wrapClick){f.focus();this.wrapClick=false}this.updateDate();this.updateTime();this.updateHidden();(function(){if(!this.df.hasFocus&&!this.tf.hasFocus){var v=this.getValue();if(String(v)!==String(this.startValue)){this.fireEvent("change",this,v,this.startValue)}this.hasFocus=false;this.fireEvent("blur",this)}}).defer(100,this)},onFocus:function(){if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();this.fireEvent("focus",this)}},onMouseDown:function(e){if(!this.disabled){this.wrapClick="td"===e.target.nodeName.toLowerCase()}},onSpecialKey:function(t,e){var key=e.getKey();if(key===e.TAB){if(t===this.df&&!e.shiftKey){e.stopEvent();this.tf.focus()}if(t===this.tf&&e.shiftKey){e.stopEvent();this.df.focus()}}if(key===e.ENTER){this.updateValue()}},setDate:function(date){this.df.setValue(date)},setTime:function(date){this.tf.setRawValue(date)},setSize:function(w,h){if(!w){return}if("below"===this.timePosition){this.df.setSize(w,h);this.tf.setSize(w,h);if(Ext.isIE){this.df.el.up("td").setWidth(w);this.tf.el.up("td").setWidth(w)}}else{this.df.setSize(w-this.timeWidth-4,h);this.tf.setSize(this.timeWidth,h);if(Ext.isIE){this.df.el.up("td").setWidth(w-this.timeWidth-4);this.tf.el.up("td").setWidth(this.timeWidth)}}},setValue:function(val){if(!val&&true===this.emptyToNow){this.setValue(new Date());return}else{if(!val){this.setDate("");this.setTime("");this.updateValue();return}}if("number"===typeof val){val=new Date(val)}else{if("string"===typeof val&&this.hiddenFormat){val=Date.parseDate(val,this.hiddenFormat)}}val=val?val:new Date(1970,0,1,0,0,0);var da,time;if(val instanceof Date){this.setDate(val);this.setTime(val.format(this.timeFormat));this.dateValue=new Date(val)}else{da=val.split(this.dtSeparator);this.setDate(da[0]);if(da[1]){if(da[2]){da[1]+=da[2]
2
- }var hh=da[1].split(":");this.setTime(hh[0]+":"+hh[1])}}},setVisible:function(visible){if(visible){this.df.show();this.tf.show()}else{this.df.hide();this.tf.hide()}return this},show:function(){return this.setVisible(true)},hide:function(){return this.setVisible(false)},updateDate:function(){var d=this.df.getValue();if(d){if(!(this.dateValue instanceof Date)){this.initDateValue();if(!this.tf.getValue()){this.setTime(this.dateValue)}}this.dateValue.setMonth(0);this.dateValue.setFullYear(d.getFullYear());this.dateValue.setMonth(d.getMonth());this.dateValue.setDate(d.getDate())}else{this.dateValue="";this.setTime("")}},updateTime:function(){var t=this.tf.getValue();if(t&&!(t instanceof Date)){t=Date.parseDate(t,this.tf.format)}if(t&&!this.df.getValue()){this.initDateValue();this.setDate(this.dateValue)}if(this.dateValue instanceof Date){if(t){this.dateValue.setHours(t.getHours());this.dateValue.setMinutes(t.getMinutes());this.dateValue.setSeconds(t.getSeconds())}else{this.dateValue.setHours(0);this.dateValue.setMinutes(0);this.dateValue.setSeconds(0)}}},updateHidden:function(){if(this.isRendered){var value=this.dateValue instanceof Date?this.dateValue.format(this.hiddenFormat):"";this.el.dom.value=value}},updateValue:function(){this.updateDate();this.updateTime();this.updateHidden();return},validate:function(){return this.df.validate()&&this.tf.validate()},renderer:function(field){var format=field.editor.dateFormat||Ext.form.DateTime.prototype.dateFormat;format+=" "+(field.editor.timeFormat||Ext.form.DateTime.prototype.timeFormat);var renderer=function(val){var retval=Ext.util.Format.date(val,format);return retval};return renderer}});Ext.reg("datetimefield",Ext.form.DateTimeField);Ext.grid.Search=function(config){Ext.apply(this,config);Ext.grid.Search.superclass.constructor.call(this)};Ext.extend(Ext.grid.Search,Ext.util.Observable,{autoFocus:true,searchText:"Search",searchTipText:"Insert a word or press Search",selectAllText:"Select All",position:"top",iconCls:"check",checkIndexes:"all",disableIndexes:[],dateFormat:undefined,showSelectAll:true,menuStyle:"checkbox",minCharsTipText:"Insert at least {0} characters",mode:"remote",width:200,xtype:"gridsearch",paramNames:{fields:"fields",query:"query"},shortcutKey:"r",shortcutModifier:"alt",align:"right",minLength:3,init:function(grid){this.grid=grid;this.id=this.grid.id+"-search";if("string"===typeof this.toolbarContainer){this.toolbarContainer=Ext.getCmp(this.toolbarContainer)}grid.store.load=grid.store.load.createInterceptor(this.load,this);grid.onRender=grid.onRender.createSequence(this.onRender,this);grid.reconfigure=grid.reconfigure.createSequence(this.reconfigure,this)},onRender:function(){var panel=this.toolbarContainer||this.grid;var tb="bottom"===this.position?panel.bottomToolbar:panel.topToolbar;this.menu=new Ext.menu.Menu();if("right"===this.align){tb.addFill()}else{if(0<tb.items.getCount()){tb.addSeparator()}}tb.add({text:this.searchText,menu:this.menu});this.field=new Ext.form.TwinTriggerField({width:this.width,selectOnFocus:undefined===this.selectOnFocus?true:this.selectOnFocus,trigger1Class:"x-form-clear-trigger",trigger2Class:this.minChars?"x-hidden":"x-form-search-trigger",onTrigger1Click:this.minChars?Ext.emptyFn:this.onTriggerClear.createDelegate(this),onTrigger2Click:this.onTriggerSearch.createDelegate(this),minLength:this.minLength});this.field.on("render",function(){this.field.el.dom.qtip=this.minChars?String.format(this.minCharsTipText,this.minChars):this.searchTipText;if(this.minChars){this.field.el.on({scope:this,buffer:300,keyup:this.onKeyUp})}var map=new Ext.KeyMap(this.field.el,[{key:Ext.EventObject.ENTER,scope:this,fn:this.onTriggerSearch},{key:Ext.EventObject.ESC,scope:this,fn:this.onTriggerClear}]);map.stopEvent=true},this,{single:true});tb.add(this.field);this.initState();if(this.shortcutKey&&this.shortcutModifier){var shortcutEl=this.grid.getEl();var shortcutCfg=[{key:this.shortcutKey,scope:this,stopEvent:true,fn:function(){this.field.focus()}}];shortcutCfg[0][this.shortcutModifier]=true;this.keymap=new Ext.KeyMap(shortcutEl,shortcutCfg)}if(true===this.autoFocus){this.grid.store.on({scope:this,load:function(){this.field.focus()}})}},initState:function(){if(Ext.state.Manager){var state=Ext.state.Manager.get(this.id);this.applyState(state)}},applyState:function(state){if(state){if(state.checked&&state.checked instanceof Array){this.checkIndexes=state.checked}if(state.value){this.field.setValue(state.value)}}this.reconfigure();this.onTriggerSearch()},saveState:function(){if(Ext.state.Manager){var state=this.getState();Ext.state.Manager.set(this.id,state)}},getState:function(){var checked=[];this.menu.items.each(function(item){if(item.dataIndex&&item.checked){checked.push(item.dataIndex)}});this.inited=true;return{value:this.field.getValue(),checked:checked}},load:function(){return(this.field!=undefined&&this.inited==true)},onKeyUp:function(){var length=this.field.getValue().toString().length;if(0===length||this.minChars<=length){this.onTriggerSearch()}},onTriggerClear:function(){if(this.field.getValue()){this.field.setValue("");this.field.focus();this.onTriggerSearch()}this.saveState()},onTriggerSearch:function(){if(!this.field.isValid()){return}var val=this.field.getValue();var store=this.grid.store;if("local"===this.mode){store.clearFilter();if(val){store.filterBy(function(r){var retval=false;this.menu.items.each(function(item){if(!item.checked||retval){return}var rv=r.get(item.dataIndex);rv=rv instanceof Date?rv.format(this.dateFormat||r.fields.get(item.dataIndex).dateFormat):rv;var re=new RegExp(val,"gi");retval=re.test(rv)},this);if(retval){return true}return retval},this)}else{}}else{if(store.lastOptions&&store.lastOptions.params){store.lastOptions.params[store.paramNames.start]=0}var fields=[];this.menu.items.each(function(item){if(item.checked&&item.dataIndex){fields.push(item.dataIndex)}});delete (store.baseParams[this.paramNames.fields]);delete (store.baseParams[this.paramNames.query]);if(store.lastOptions&&store.lastOptions.params){delete (store.lastOptions.params[this.paramNames.fields]);delete (store.lastOptions.params[this.paramNames.query])}if(fields.length){store.baseParams[this.paramNames.fields]=fields.compact().join();store.baseParams[this.paramNames.query]=val}store.reload()}this.saveState()},setDisabled:function(){this.field.setDisabled.apply(this.field,arguments)},enable:function(){this.setDisabled(false)},disable:function(){this.setDisabled(true)},reconfigure:function(){var menu=this.menu;menu.removeAll();if(this.showSelectAll&&"radio"!==this.menuStyle){menu.add(new Ext.menu.CheckItem({text:this.selectAllText,checked:!(this.checkIndexes instanceof Array),hideOnClick:false,handler:function(item){var checked=!item.checked;item.parentMenu.items.each(function(i){if(item!==i&&i.setChecked&&!i.disabled){i.setChecked(checked)}})}}),"-")}var cm=this.grid.colModel;var group=undefined;if("radio"===this.menuStyle){group="g"+(new Date).getTime()}Ext.each(cm.config,function(config){var disable=false;if(config.header&&config.dataIndex&&config.sortable){Ext.each(this.disableIndexes,function(item){disable=disable?disable:item===config.dataIndex});if(!disable){menu.add(new Ext.menu.CheckItem({text:config.header,hideOnClick:false,group:group,checked:"all"===this.checkIndexes,dataIndex:config.dataIndex}))}}},this);if(this.checkIndexes instanceof Array){Ext.each(this.checkIndexes,function(di){var item=menu.items.find(function(itm){return itm.dataIndex===di});if(item){item.setChecked(true,true)}},this)}if(this.readonlyIndexes instanceof Array){Ext.each(this.readonlyIndexes,function(di){var item=menu.items.find(function(itm){return itm.dataIndex===di});if(item){item.disable()}},this)}}});Ext.state.DataBaseProvider=function(config){Ext.state.DataBaseProvider.superclass.constructor.call(this);this.path="/backend/state_sessions";Ext.apply(this,config);this.state=this.readCookies()};Ext.extend(Ext.state.DataBaseProvider,Ext.state.Provider,{set:function(name,value){if(typeof value=="undefined"||value===null){this.clear(name);
3
- return}this.setCookie(name,value);Ext.state.DataBaseProvider.superclass.set.call(this,name,value)},clear:function(name){this.clearCookie(name);Ext.state.DataBaseProvider.superclass.clear.call(this,name)},readCookies:function(){var cookies={};var values=[];new Ajax.Request(this.path,{method:"GET",asynchronous:false,onSuccess:function(response,request){values=Ext.decode(response.responseText)}});values.each(function(f){if(f.state_session&&f.state_session.component&&f.state_session.component.substring(0,3)=="ys-"){cookies[f.state_session.component.substr(3)]=this.decodeValue(f.state_session.data)}},this);return cookies},setCookie:function(name,value){Ext.Ajax.request({url:this.path,method:"POST",params:{id:"ys-"+name,data:this.encodeValue(value)}})},clearCookie:function(name){Ext.Ajax.request({url:this.path+"/ys-"+name,method:"DELETE"})}});