event.js // Для работы в современных браузерах - раскоментить

  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
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
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
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
388
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
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
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
588
589
590
591
592
593
594
595
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
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
function EventHandler(eventKey, fnEventHandler)
{
this.m_eventKey = eventKey;
this.m_fnHandler = fnEventHandler;
}
EventHandler.prototype.getEventKey = function()
{
return this.m_eventKey;
}
EventHandler.prototype.getHandler = function()
{
return this.m_fnHandler;
}
function HandlerRegistry()
{
this.m_handlers = new Array();
}
HandlerRegistry.prototype.registerEventHandler = function(strSrcFormName, strEventName, fnEventHandler)
{
var fnExistingHandler = this.getEventHandler(strSrcFormName, strEventName);
if (fnExistingHandler != null)
{
throwError("An Event handler for form " + strSrcFormName + " and event " + strEventName + " already registered");
return;
}
var fnEventHandler = new EventHandler(this.getEventKey(strSrcFormName, strEventName), fnEventHandler);
this.m_handlers[this.m_handlers.length] = fnEventHandler;
}
HandlerRegistry.prototype.reregisterEventHandler = function(strSrcFormName, strEventName, fnEventHandler)
{
var strEventKey = this.getEventKey(strSrcFormName, strEventName);
var bIsHandlerAlreadyRegistered = false;
for (var iHandler = 0; iHandler < this.m_handlers.length; iHandler++)
{
var eventHandler = this.m_handlers[iHandler];
if (eventHandler.getEventKey() == strEventKey)
{
var fnEventHandler = new EventHandler(strEventKey, fnEventHandler);
this.m_handlers[iHandler] = fnEventHandler;
bIsHandlerAlreadyRegistered = true;
break;
}
}
if (bIsHandlerAlreadyRegistered == false)
{
this.registerEventHandler(strSrcFormName, strEventName, fnEventHandler);
}
}
HandlerRegistry.prototype.getEventHandler = function(strSrcFormName, strEventName)
{
var fnEventHandler = null;
var strEventKey = this.getEventKey(strSrcFormName, strEventName);
for (var iHandler = 0; iHandler < this.m_handlers.length; iHandler++)
{
var eventHandler = this.m_handlers[iHandler];
if (eventHandler.getEventKey() == strEventKey)
{
fnEventHandler = eventHandler.getHandler();
break;
}
}
if (fnEventHandler == null)
{
strEventKey = this.getEventKey(null, strEventName);
for (var iHandler = 0; iHandler < this.m_handlers.length; iHandler++)
{
var eventHandler = this.m_handlers[iHandler];
if (eventHandler.getEventKey() == strEventKey)
{
fnEventHandler = eventHandler.getHandler();
break;
}
}
}
return fnEventHandler;
}
HandlerRegistry.prototype.getEventKey = function(strSrcFormName, strEventName)
{
if (strSrcFormName == null )
{
strSrcFormName = "";
}
return strSrcFormName + "." + strEventName;
}
var isNav = (navigator.appName == "Netscape");
var isMac = (navigator.platform.toLowerCase().indexOf("mac")!=-1)
var isMacIE = isMac&&!isNav;
var g_include_event;
if (g_include_event != "true")
{
if (typeof(Trace_CLIENTEVENTS) == "undefined")
{
Trace_CLIENTEVENTS = false;
}
g_include_event = "true";
var g_safeCallTimer = null;
var g_handlerRegistry = null;
var g_current_event_keycode = null;
var g_current_event_name = null;
function registerClientEventHandler(strSrcFormName, strEventName, fnEventHandler)
{
if (g_handlerRegistry == null)
{
g_handlerRegistry = new HandlerRegistry();
}
g_handlerRegistry.registerEventHandler(strSrcFormName, strEventName, fnEventHandler);
if (Trace_CLIENTEVENTS) events_trace("registered handler " + fnEventHandler.toString() +
" for event " + strEventName + " (form " + strSrcFormName + ")");
}
function registerPreSubmitClientEventHandler(strSrcFormName, strEventName, fnEventHandler)
{
registerClientEventHandler(strSrcFormName, strEventName, fnEventHandler);
}
function reregisterPreSubmitClientEventHandler(strSrcFormName, strEventName, fnEventHandler)
{
reregisterClientEventHandler(strSrcFormName, strEventName, fnEventHandler);
}
function reregisterClientEventHandler(strSrcFormName, strEventName, fnEventHandler)
{
if (g_handlerRegistry == null)
{
g_handlerRegistry = new HandlerRegistry();
}
g_handlerRegistry.reregisterEventHandler(strSrcFormName, strEventName, fnEventHandler);
if (Trace_CLIENTEVENTS) events_trace("reregistered handler " + fnEventHandler.toString() +
" for event " + strEventName + " (form " + strSrcFormName + ")");
}
function fireClientEvent(strEventName)
{
if (Trace_CLIENTEVENTS) events_trace("firing event " + strEventName);
var winWithHandler = findClientEventHandlerDispatchWindow(strEventName);
if (winWithHandler != null)
{
var fnEventHandler = winWithHandler.g_handlerRegistry.getEventHandler(this.name, strEventName);
if (fnEventHandler != null)
{
var args = new Array(fireClientEvent.arguments.length);
for (var i = 0; i < fireClientEvent.arguments.length; i++)
{
args[i] = fireClientEvent.arguments[i];
}
if (typeof(getTopLevelWnd().shiftKeyPressed) != "undefined" && getTopLevelWnd().shiftKeyPressed)
{
args[args.length] = "shiftKeyPressed";
}
if (typeof(getTopLevelWnd().ctrlKeyPressed) != "undefined" && getTopLevelWnd().ctrlKeyPressed)
{
args[args.length] = "ctrlKeyPressed";
}
if (typeof(getTopLevelWnd().altKeyPressed) != "undefined" && getTopLevelWnd().altKeyPressed)
{
args[args.length] = "altKeyPressed";
}
winWithHandler.safeCallEx(fnEventHandler, args, 1);
}
}
}
function firePreSubmitClientEvent(strEventName)
{
fireClientEvent(strEventName);
}
function isClientEventHandlerRegistered(strEventName)
{
if (Trace_CLIENTEVENTS) events_trace("testing for handler for " + strEventName);
var winWithHandler = findClientEventHandlerDispatchWindow(strEventName);
return (winWithHandler != null);
}
function findClientEventHandlerDispatchWindow(strEventName)
{
if (Trace_CLIENTEVENTS) events_trace("getting dispatch window for handler for " + strEventName);
var winWithHandler = null;
var winDispatch = this;
while (winDispatch != null && isDispatchableWindow(winDispatch) == true)
{
if (Trace_CLIENTEVENTS) events_trace("... checking window " + winDispatch.location);
if (winDispatch.g_handlerRegistry != null)
{
var fnEventHandler = winDispatch.g_handlerRegistry.getEventHandler(this.name, strEventName);
if (fnEventHandler != null)
{
// event handler found - we're done
winWithHandler = winDispatch;
if (Trace_CLIENTEVENTS) events_trace("... dispatch window found ");
break;
}
}
var winOpener = winDispatch.opener;
if (winOpener == null || winOpener == undefined )
{
winOpener = winDispatch.dialogArguments != undefined ? winDispatch.dialogArguments.m_parentWindow : null;
}
if (winDispatch == winOpener && (g_clientInfo.isBrowser(ClientInfo.SAFARI) || g_clientInfo.isBrowser(ClientInfo.FIREFOX)))
{
winOpener = winDispatch.parent;
}
var winParent = (winDispatch == winDispatch.parent) ? null : winDispatch.parent;
winDispatch = (winOpener == null) ? winParent : winOpener;
}
if (Trace_CLIENTEVENTS)
{
if (winWithHandler == null) events_trace("... dispatch window cannot be found ");
}
return winWithHandler;
}
function safeCall(fnFunction)
{
if(g_current_event_keycode == "32" && g_current_event_name == "keypress")
{
return;
}
safeCallEx(fnFunction, safeCall.arguments, 1);
}
function safeCallEx(fnFunction, args, nSkipArgs)
{
if (typeof(g_safeCallQueue) == "undefined")
{
g_safeCallQueue = [];
}
g_safeCallQueue[g_safeCallQueue.length] = new SafeCall(fnFunction, args, nSkipArgs);
if (g_safeCallTimer != null)
{
clearTimeout(g_safeCallTimer);
}
g_isSafeCallInvoked = true;
if (isWindowInitialised(window) == false)
{
if (Trace_CLIENTEVENTS) events_trace("Postponing dispatchQueuedSafeCalls by 10ms");
g_safeCallTimer = setTimeout("dispatchQueuedSafeCalls()", 10);
}
else
{
dispatchQueuedSafeCalls();
}
}
var g_isSafeCallInvoked = false;
function resetIsSafeCallInvoked()
{
g_isSafeCallInvoked = false;
}
function isSafeCallInvoked()
{
return g_isSafeCallInvoked;
}
function dispatchQueuedSafeCalls()
{
if (isWindowInitialised(window) == false)
{
if (Trace_CLIENTEVENTS) events_trace("Postponing dispatchQueuedSafeCalls by 10ms");
g_safeCallTimer = setTimeout("dispatchQueuedSafeCalls()", 10);
}
else if (typeof(g_safeCallQueue) != "undefined")
{
// If Mac IE, don't use shift()
if (g_clientInfo.isPlatform(ClientInfo.MACOS) && g_clientInfo.isBrowser(ClientInfo.MSIE))
{
for (var i = 0; i < g_safeCallQueue.length; i++)
{
var fnCall = g_safeCallQueue[i];
fnCall.execute();
}
g_safeCallQueue = [];
}
else
{
while (g_safeCallQueue.length > 0)
{
var fnCall = g_safeCallQueue.shift();
fnCall.execute();
}
}
}
}
function SafeCall(fnFunction, args, nSkipArgs)
{
this.fnFunction = fnFunction;
this.args = args;
this.nSkipArgs = nSkipArgs;
this.execute = function()
{
// SAFARI FIX - If current scope for 'this' is not the same as the
// function's scope, call the function in it's actual scope [ the correct one ]
if(this != arguments.callee._originalScope)
{
if (Trace_CLIENTEVENTS) events_trace("SafeCall has incorrect Scope. Resetting Scope");
return arguments.callee.apply(arguments.callee._originalScope, arguments);
}
var strArgs = "";
for (var iArg = this.nSkipArgs; iArg < this.args.length; iArg++)
{
if (iArg > 1)
{
strArgs += ",";
}
strArgs += "this.args[" + iArg + "]";
}
if (Trace_CLIENTEVENTS)
{
events_trace("... calling " + this.fnFunction.toString());
for (var iArg = this.nSkipArgs; iArg < this.args.length; iArg++)
{
events_trace("... arg " + (iArg - this.nSkipArgs) + ": " + this.args[iArg]);
}
}
try
{
if (typeof(this.fnFunction) == "string")
{
eval(this.fnFunction + "(" + strArgs + ");");
}
else
{
// Для работы в современных браузерах - раскоментить
//if(this.fnFunction.toString().indexOf("alert") > -1){
// alert(this.args[1])
//}else{
eval("this.fnFunction(" + strArgs + ");");
//}
}
}
catch(err)
{
if (Trace_CLIENTEVENTS)
{
events_trace(err);
}
}
}
// 'this' scope may get lost when SafeCall called via setTimeout()
this.execute._originalScope = this;
}
var g_arrXId = new Object();
var g_arrYId = new Object();
function setServerForm(strId, strHiddenXId, strHiddenYId)
{
if (strId == null || strId == "" || (typeof strId == "undefined"))
{
throwError("setForm: strId is a mandatory parameter");
return;
}
if (strHiddenXId == null || strHiddenXId == "" || (typeof strHiddenXId == "undefined"))
{
throwError("setForm: strHiddenXId is a mandatory parameter");
return;
}
if (strHiddenYId == null || strHiddenYId == "" || (typeof strHiddenYId == "undefined"))
{
throwError("setForm: strHiddenYId is a mandatory parameter");
return;
}
g_arrXId[strId] = strHiddenXId;
g_arrYId[strId] = strHiddenYId;
if (Trace_CLIENTEVENTS) events_trace("setServerForm: id = " + strId);
}
var g_serverEventLock = 0;
function acquireEventPostingLock()
{
if (g_serverEventLock++ != 0)
{
return false;
}
return true;
}
function releaseEventPostingLock()
{
g_serverEventLock = 0;
}
function isEventPostingLocked()
{
return (g_serverEventLock > 0);
}
function postServerEvent(strFormId, strSrcCtrl, strHandlerCtrl, strHandlerMethod, strEventArgName, strEventArgValue)
{
if (strHandlerMethod == null || strHandlerMethod == "" || (typeof strHandlerMethod == "undefined"))
{
throwError("postFormEvent: strHandlerMethod is a mandatory parameter");
return;
}
if (acquireEventPostingLock() == false)
{
return;
}
if (strFormId == null)
{
// If form doesn't exist, Safari returns NULL, other browsers return type 'undefined'. This check covers both.
if (document.forms && document.forms[0])
{
strFormId = document.forms[0].name;
}
}
var formElement = null;
var preSubmitHandler = null;
if (strFormId != null)
{
try
{
formElement = eval("document." + strFormId);
preSubmitHandler = eval(strFormId + "_preSubmitForm");
}
catch(e)
{
}
}
var functionArgs = arguments;
if (formElement && preSubmitHandler)
{
if (strHandlerCtrl == null || strHandlerCtrl == "" || (typeof strHandlerCtrl == "undefined"))
{
strHandlerCtrl = strFormId;
}
formElement.__dmfAction.value = strFormId + "_" + strHandlerMethod;
formElement.__dmfHandler.value = strFormId + "_" + strHandlerCtrl;
if (typeof(strSrcCtrl) != "undefined" && strSrcCtrl != null && strSrcCtrl != "")
{
formElement.__dmfControl.value = escapeUnicodeString(strFormId + "_" + strSrcCtrl);
}
else
{
formElement.__dmfControl.value = "";
}
var strHandlerArgs = "";
var EVENTARG_OFFSET = 4;
for (var iArg = EVENTARG_OFFSET; iArg < functionArgs.length; iArg+=2)
{
var strEventName = functionArgs[iArg];
if (strEventName != null)
{
var strEventValue = functionArgs[iArg+1];
if (typeof(strEventValue) != "undefined" && strEventValue != null)
{
if (strHandlerArgs != "")
{
strHandlerArgs += "&";
}
strHandlerArgs += escapeUnicodeString(strEventName) + "=" + escapeUnicodeString(strEventValue);
}
}
}
if (typeof(getTopLevelWnd().shiftKeyPressed) != "undefined" && getTopLevelWnd().shiftKeyPressed)
{
if (strHandlerArgs != "")
{
strHandlerArgs += "&";
}
strHandlerArgs += "shiftKeyPressed=true";
}
if (typeof(getTopLevelWnd().ctrlKeyPressed) != "undefined" && getTopLevelWnd().ctrlKeyPressed)
{
if (strHandlerArgs != "")
{
strHandlerArgs += "&";
}
strHandlerArgs += "ctrlKeyPressed=true";
}
if (typeof(getTopLevelWnd().altKeyPressed) != "undefined" && getTopLevelWnd().altKeyPressed)
{
if (strHandlerArgs != "")
{
strHandlerArgs += "&";
}
strHandlerArgs += "altKeyPressed=true";
}
formElement.__dmfHandlerArgs.value = strFormId + "_" + strHandlerArgs;
if (Trace_CLIENTEVENTS)
{
events_trace("posting form event");
events_trace("... action = " + formElement.__dmfAction.value);
events_trace("... handler = " + formElement.__dmfHandler.value);
events_trace("... handlerArgs = " + formElement.__dmfHandlerArgs.value);
events_trace("... source control = " + formElement.__dmfControl.value);
}
storeScrollPosition(strFormId, g_arrXId[strFormId], g_arrYId[strFormId]);
var strControlId = null;
if ( strSrcCtrl != null )
{
var elements = document.getElementsByName(strSrcCtrl);
if ( elements && elements.length > 0 )
{
strControlId = elements[0].id;
}
}
firePreSubmitClientEvent(postServerEvent.GENERIC_PRE_SUBMIT);
preSubmitHandler(strFormId, strControlId);
var popupEnabled = (formElement.__dmfModalPopupEnabled.value == "true");
var openPopup = popupEnabled && (formElement.__dmfUseModalPopup.value == "true");
formElement.__dmfUseModalPopup.value = openPopup;
if (openPopup)
{
var depth = formElement.__dmfDepth.value;
var popupWindowName = getPopupWindowName(window, depth);
formElement.__dmfTargetWindowName.value = popupWindowName;
var size = formElement.__dmfModalPopupWindowSize.value;
var strUrl = g_virtualRoot + "/wdk/popupContent.htm";
openModalPopupWindow(window, strFormId, size, popupWindowName, strUrl);
}
else
{
if (window.getWindowOpener() != null)
{
formElement.target = window.name;
}
if(window.isModalPopup())
{
window.document.body.style.cursor = "wait";
}
try
{
formElement.submit();
}
catch (e)
{
releaseEventPostingLock();
window.document.body.style.cursor='default';
}
}
}
else
{
if(Trace_CLIENTEVENTS)
{
events_trace("postServerEvent for " + ((strFormId != null) ? strFormId : "forms[0]")
+ " in window '" + window.name + "', Form not found. Delaying Call by "
+ postServerEvent.DELAY_PERIOD + "ms");
}
if ( postServerEvent.m_delayCount++ < postServerEvent.MAX_DELAY_COUNT )
{
// Haven't reached the max delay attempt limit, so try delaying [again]
var delayed = _postServerEventClosure.apply(this, functionArgs);
return setTimeout(delayed, postServerEvent.DELAY_PERIOD);
}
else
{
g_serverEventLock = 0;
postServerEvent.m_delayCount = 0;
if (Trace_CLIENTEVENTS)
{
events_trace("postServerEvent for " + ((strFormId != null) ? strFormId : "forms[0]")
+ " in window '" + window.name + "', ABORTING. Form not found after "
+ postServerEvent.MAX_DELAY_COUNT * postServerEvent.DELAY_PERIOD + "ms");
}
}
}
}
function postServerEvent2(strFormId, prefs, strSrcCtrl, strHandlerCtrl, strHandlerMethod, strEventArgName, strEventArgValue)
{
if (typeof prefs == "undefined" || prefs == null)
{
// Some browsers don't like messing with 'arguments', so make a copy.
var args = new Array(arguments.length - 1);
args[0] = arguments[0];
for (var i = 1; i < arguments.length - 1; i++)
{
args[i] = arguments[i+1];
}
postServerEvent.apply(this, args);
}
else
{
postInlineServerEvent.apply(this, arguments);
}
}
postServerEvent.m_delayCount = 0;
postServerEvent.MAX_DELAY_COUNT = 600;
postServerEvent.DELAY_PERIOD = 100;
postServerEvent.GENERIC_PRE_SUBMIT = "genericPreSubmit";
function _postServerEventClosure()
{
var functionArgs = arguments;
return function()
{
g_serverEventLock = 0;
postServerEvent.apply(this, functionArgs);
};
}
function setKeys(event)
{
if (event != null)
{
getTopLevelWnd().shiftKeyPressed = event.shiftKey;
getTopLevelWnd().ctrlKeyPressed = event.ctrlKey;
getTopLevelWnd().altKeyPressed = event.altKey;
}
setCurrentEventKeyInfo(event);
return false;
}
function setCurrentEventKeyInfo(event)
{
if (event != null)
{
g_current_event_keycode = event.which;
if (!event.which)
{
g_current_event_keycode = event.keyCode;
}
g_current_event_keycode = g_current_event_keycode + "";
g_current_event_name = event.type;
}
else
{
g_current_event_keycode = null;
g_current_event_name = null;
}
}
function getCurrentEventKeyCode() {
return g_current_event_keycode;
}
function throwError(strErrMsg)
{
events_trace("Exception: " + strErrMsg);
alert("events.js: Exception: " + strErrMsg);
}
function events_trace(strMsg)
{
Trace_println("events.js: " + strMsg);
}
var g_arrDecimalToHex = new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
function escapeUnicodeString(str)
{
var strescaped;
if (g_clientInfo.isBrowser(ClientInfo.NETSCAPE) == false)
{
strescaped = escape(str);
}
else
{
strescaped = "";
for(var idxch=0; idxch<str.length; idxch++)
{
var ch = str.charCodeAt(idxch);
var highbyte = ch & 0xFF00;
if (highbyte == 0)
{
var highbit = ch & 0xFF80;
if (highbit == 0)
{
strescaped += escape(str.substring(idxch, idxch+1));
}
else
{
strescaped +="%";
for(var idxdigit=0; idxdigit < 2; idxdigit++)
{
var decimaldigit = (ch >>> (4 - idxdigit * 4)) & 0x0F ;
strescaped += g_arrDecimalToHex[decimaldigit];
}
}
}
else
{
strescaped +="%u";
for(var idxdigit=0; idxdigit < 4; idxdigit++)
{
var decimaldigit = (ch >>> (12 - idxdigit * 4)) & 0x0F ;
strescaped += g_arrDecimalToHex[decimaldigit];
}
}
}
}
return strescaped;
}
if (getTopLevelWnd() == this)
{
function onEvalJavaScript(strScript)
{
if (strScript != null)
{
eval(strScript);
}
}
function wdkGenericPreSubmit()
{
}
registerClientEventHandler(null, "evalJavaScript", onEvalJavaScript);
registerPreSubmitClientEventHandler(null, postServerEvent.GENERIC_PRE_SUBMIT, wdkGenericPreSubmit);
}
}
reregisterClientEventHandler(null, "onDrlSavedSearchView", onDrlSavedSearchView);
function onDrlSavedSearchView (strObjectId, strObjectType, strTaskmgrId)
{
postServerEvent(null, null, null, "onaction", "objectId", strObjectId, "type", "dm_smart_list", "action", "viewsavedresults");
}
reregisterClientEventHandler(null, "onDrlSavedSearchEdit", onDrlSavedSearchEdit);
function onDrlSavedSearchEdit (strObjectId, strObjectType, strTaskmgrId)
{
postServerEvent(null, null, null, "onaction", "objectId", strObjectId, "type", "dm_smart_list", "action", "editfile");
}
function postAJAXEvent(ajaxURL, async)
{
url = addBrowserIdToURL(ajaxURL);
var isNative = false;
var msVers = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
var req = null;
if (typeof window.XMLHttpRequest != 'undefined')
{
isNative = true;
req = new XMLHttpRequest();
}
else
{
for (var i = 0; i < msVers.length; i++)
{
try
{
req = new ActiveXObject(msVers[i]);
break;
}
catch(e)
{
req = null;
}
}
}
req.open("POST", url, async);
req.send((isNative) ? "" : null);
}