Advertisement

01.12.2008 at 02:29PM PST, ID: 23078407 | Points: 500
[x]
Attachment Details

Dreamweaver Javascript Error

Asked by sporenza in Macromedia Dreamweaver

All,

I am running Dreamweaver 8 and am getting this error when I toggle through site code:

"While executing findServerBehaviors in Login User.htm, the following JavaScript error(s) occured:

At line 128 of file "C:\Program Files\Macromedia\Dreamweaver 8\Configuration\ServerBehaviors\Shared\Login User.js":
ReferenceError: FieldTypes is not defined

Some notes:
Line 127:          <td valign="baseline" class="formField"><input name="StoreProfile" type="checkbox" id="StoreProfile" value="checkbox" <%if (cstr(Request.Cookies("UserName"))<>"")then Response.Write("checked")%> />Save User Name</td>
Line 128: </tr>

the is in a page called "login.asp"

i see no direct references to "Login User.js"

Any help is appreicated.Start Free Trial
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:
715:
716:
717:
718:
719:
720:
721:
722:
723:
724:
725:
726:
727:
728:
729:
730:
731:
732:
733:
734:
735:
736:
737:
738:
739:
740:
741:
742:
743:
744:
745:
746:
747:
748:
749:
750:
751:
752:
753:
754:
755:
756:
757:
758:
759:
760:
761:
762:
763:
764:
765:
766:
767:
768:
769:
770:
771:
772:
773:
774:
775:
776:
777:
778:
779:
780:
781:
782:
783:
784:
785:
786:
787:
788:
789:
790:
791:
792:
793:
794:
795:
796:
797:
798:
799:
800:
801:
802:
803:
804:
805:
806:
807:
808:
809:
810:
811:
812:
813:
814:
815:
816:
817:
818:
819:
820:
821:
822:
823:
824:
825:
826:
827:
828:
829:
830:
831:
832:
833:
834:
835:
836:
837:
838:
839:
840:
841:
842:
843:
844:
845:
846:
847:
848:
849:
850:
851:
852:
853:
854:
855:
856:
857:
858:
859:
860:
861:
862:
863:
864:
865:
866:
867:
868:
869:
870:
871:
872:
873:
874:
875:
876:
877:
878:
879:
880:
881:
882:
883:
884:
885:
886:
887:
888:
889:
890:
891:
892:
893:
894:
895:
896:
897:
898:
899:
900:
901:
902:
903:
904:
905:
906:
907:
908:
909:
910:
911:
912:
913:
914:
915:
916:
917:
918:
919:
920:
921:
922:
923:
924:
925:
926:
927:
928:
929:
930:
931:
932:
933:
934:
935:
936:
937:
938:
939:
940:
941:
942:
943:
944:
945:
946:
947:
948:
949:
950:
951:
952:
953:
954:
955:
956:
957:
958:
959:
960:
961:
962:
963:
964:
965:
966:
967:
968:
969:
970:
971:
972:
973:
974:
975:
976:
977:
978:
979:
980:
981:
982:
983:
984:
985:
986:
987:
988:
989:
990:
991:
992:
993:
994:
995:
996:
997:
998:
999:
1000:
1001:
1002:
1003:
1004:
1005:
1006:
1007:
1008:
1009:
1010:
1011:
1012:
1013:
1014:
1015:
1016:
1017:
1018:
1019:
1020:
1021:
1022:
1023:
1024:
1025:
1026:
1027:
1028:
1029:
1030:
1031:
1032:
1033:
1034:
1035:
1036:
1037:
1038:
1039:
1040:
1041:
1042:
1043:
1044:
1045:
1046:
1047:
1048:
1049:
1050:
1051:
1052:
1053:
1054:
1055:
1056:
1057:
1058:
1059:
1060:
1061:
1062:
1063:
1064:
1065:
1066:
1067:
1068:
1069:
1070:
1071:
1072:
1073:
1074:
1075:
1076:
1077:
1078:
1079:
1080:
1081:
1082:
1083:
1084:
1085:
1086:
1087:
1088:
Login User.js
--------------------------
// Copyright 2001, 2002, 2003, 2004, 2005 Macromedia, Inc. All rights reserved.
 
//*************** GLOBALS VARS *****************
 
var LIST_FORM;
var LIST_CONNECTION;
var LIST_TABLE;
 
var LIST_FORMUSERNAME;
var LIST_RSUSERNAME;
 
var LIST_FORMPASSWORD;
var LIST_RSPASSWORD;
 
var LIST_RSAUTHORIZATION;
var TEXTGOTOURLONSUCCESS;
var CBGOTOREFERRERURL;
var TEXTGOTOURLONFAILURE;
 
var RG_SECURITYMETHOD;
 
var EMPTY_LIST = new Array("");
 
 
//******************* API **********************
 
//--------------------------------------------------------------------
// FUNCTION:
//   canApplyServerBehavior
//
// DESCRIPTION:
//   Returns true if a Server Behavior can be applied to the current
//   document
//
// ARGUMENTS:
//   sbObj - ServerBehavior object - one of the objects returned
//           from findServerBehaviors
//
// RETURNS:
//   boolean - true if the behavior can be applied, false otherwise
//--------------------------------------------------------------------
function canApplyServerBehavior(sbObj)
{
  var success = true;
 
  if (!sbObj)
  {
    // attempting to add the behavior - check to see if one already exists on the page
    var ourSBs = new Array();
	ourSBs = ourSBs.concat(dwscripts.getServerBehaviorsByFileName("Login User.htm"));
	ourSBs = ourSBs.concat(dwscripts.getServerBehaviorsByFileName("Login User2.htm"));
    if (ourSBs.length != 0)
    {
      alert(MM.MSG_OnlyOneInstanceAllowed);
      success=false;
    }
  }
    
  if (success)
  {
    var dom = dw.getDocumentDOM();
    var allForms = dom.getElementsByTagName("FORM");
    if (allForms.length==0)
    {
      alert(MM.MSG_LoginUserNoFormOnPage);
      success = false;
    }
  }
  
  if (success)
  {
    var restrictSBs = dwscripts.getServerBehaviorsByFileName("Restrict Access To Page.htm");
    if (restrictSBs.length != 0)
    {
      alert(MM.MSG_LoginUserPageRestricted);
    }
    
    // search each form element for the requisit number and type of controls
    if (getUPFormObjects().length == 0)
    {
      alert(MM.MSG_LoginUserNoValidForms);
      success = false;
    }
  }
 
  return success;
}
 
//--------------------------------------------------------------------
// FUNCTION:
//   findServerBehaviors
//
// DESCRIPTION:
//   Returns an array of ServerBehavior objects, each one representing
//   an instance of this Server Behavior on the page
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   JavaScript Array of ServerBehavior objects
//--------------------------------------------------------------------
function findServerBehaviors()
{
  sbArray = dwscripts.findSBs(MM.LABEL_TitleLoginUser);
 
  for (var i=0; i < sbArray.length; i++)
  {
    if (sbArray[i].parameters.cname != null)
    {
      var dom = dw.getDocumentDOM();
	    var currServerModel = dw.getDocumentDOM().serverModel.getServerName();
			var urlformat = sbArray[i].parameters.urlformat;
			if (currServerModel == "JSP") 
			{
			  //if the connection relative path begins with '/' it is site relative
				if ((sbArray[i].parameters.relpath != null) && (sbArray[i].parameters.relpath[0]=='/'))
				{
					//set the urlformat to virtual
					urlformat = "virtual";
				}
			}
      if (dom && dom.URL && sbArray[i].parameters.relpath != getConnectionsPath(sbArray[i].parameters.cname,urlformat))
      {
        sbArray[i].incomplete = true;
        sbArray[i].errorMsg += "\n"+MM.MSG_ConnectionPathInvalid;
      }
      sbArray[i].parameters.fldUsername = FieldTypes.decodeSQLReference(sbArray[i].parameters.fldUsername);
      sbArray[i].parameters.fldPassword = FieldTypes.decodeSQLReference(sbArray[i].parameters.fldPassword);
      sbArray[i].parameters.table = FieldTypes.decodeSQLReference(sbArray[i].parameters.table);
    }
  }
  
  return sbArray;
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   applyServerBehavior
//
// DESCRIPTION:
//   Collects values from the form elements in the dialog box and
//   adds the Server Behavior to the user's document
//
// ARGUMENTS:
//   sbObj - ServerBehavior object - one of the objects returned
//           from findServerBehaviors
//
// RETURNS:
//   string - empty upon success, or an error message
//--------------------------------------------------------------------
function applyServerBehavior(sbObj)
{
  var errMsg = "";
  
  if (TEXTGOTOURLONSUCCESS.value == "" || TEXTGOTOURLONFAILURE.value == "")
  {
    errMsg = MM.MSG_MustSupplyRedirectPages;
  }
 
  if (errMsg == "")
  {
    if (LIST_CONNECTION.get() == MM.LABEL_None)
    {
      errMsg = MM.MSG_MustSelectConnection;
    }
  }
 
  if (errMsg == "")
  {
    if (LIST_TABLE.get() == MM.LABEL_NoTables)
    {
      errMsg = MM.MSG_MustSelectTable;
    }
  }
  
  if (errMsg == "")
  {
    var useAccessList = (RG_SECURITYMETHOD.getSelectedValue() == "securityMethodUPA");
    var fldAuthorization = useAccessList ? LIST_RSAUTHORIZATION.getValue() : "";
    var connName   = LIST_CONNECTION.get();
 
    var paramObj = new Array();
    
    // parameters for connection include
    paramObj.cname = connName;
 
    paramObj.formNode = LIST_FORM.getValue().formObj;
    paramObj.frmUsername = LIST_FORMUSERNAME.getValue();
    paramObj.fldAuthorization = fldAuthorization;
    paramObj.redirectSuccess = TEXTGOTOURLONSUCCESS.value;
    paramObj.redirectFailed = TEXTGOTOURLONFAILURE.value;
    paramObj.connection = connName;
    paramObj.fldUsername = FieldTypes.encodeSQLReference(LIST_RSUSERNAME.getValue(), paramObj.cname);
    paramObj.fldPassword = FieldTypes.encodeSQLReference(LIST_RSPASSWORD.getValue(), paramObj.cname);
    paramObj.table = FieldTypes.encodeSQLReference(LIST_TABLE.getValue(), paramObj.cname);
    paramObj.frmPassword = LIST_FORMPASSWORD.getValue();
    paramObj.redirectToReferrer = (CBGOTOREFERRERURL.checked ? "true" : "false");
    paramObj.MM_userAuthorization = MM_USERAUTHORIZATION;
    paramObj.MM_username = MM_USERNAME;
		if (sbObj != null)
		{
			//get the existing url format from the current server behavior
			paramObj.urlformat = sbObj.parameters.urlformat;
			if ((sbObj.parameters.relpath != null) && (sbObj.parameters.relpath[0]=='/'))
			{
				//set the urlformat to virtual
				paramObj.urlformat = "virtual";
			}
		}
		else
		{
		  //get the default url format
			paramObj.urlformat = getConnectionsUrlFormat(dw.getDocumentDOM());
		}
		paramObj.relpath = getConnectionsPath(connName,paramObj.urlformat);
    paramObj.ext = getServerExtension();
		//for JSP file with "/" serves as virtual url prefix, so change the urlformat to "file"
    var currServerModel = dw.getDocumentDOM().serverModel.getServerName();
		if ((currServerModel == "JSP") && ((paramObj.urlformat != null) && (paramObj.urlformat == "virtual")))
		{
			paramObj.urlformat = "file";
		}
 
    //special case the update of connection_ref, to prevent multiple
    // connection statements from being created
    if (sbObj && 
        (sbObj.parameters.relpath != paramObj.relpath ||
         sbObj.parameters.ext != paramObj.ext) &&
        sbObj.parameters.cname == paramObj.cname) 
		{
      sbObj.MM_forcePriorUpdate = "connectionref_statement";
    }
 
	// InterAKT stuff
	var fieldObj = FieldTypes.getFieldObj(paramObj.cname, paramObj.table, paramObj.fldUsername);
	paramObj.param1Type = FieldTypes.getFieldTypeFromObj(fieldObj);
	paramObj.param1Size = FieldTypes.getFieldSizeFromObj(fieldObj);
	paramObj.param1Size = FieldTypes.checkSizeForRSParameter(paramObj.param1Type, paramObj.param1Size);
	paramObj.param1TypeDisplayName = FieldTypes.getParameterTypeDisplayName(paramObj.param1Type);
 
	var fieldObj = FieldTypes.getFieldObj(paramObj.cname, paramObj.table, paramObj.fldPassword);
	paramObj.param2Type = FieldTypes.getFieldTypeFromObj(fieldObj);
	paramObj.param2Size = FieldTypes.getFieldSizeFromObj(fieldObj);
	paramObj.param2Size = FieldTypes.checkSizeForRSParameter(paramObj.param2Type, paramObj.param2Size);
	paramObj.param2TypeDisplayName = FieldTypes.getParameterTypeDisplayName(paramObj.param2Type);
 
	var sbFileName = dwscripts.getSBFileName();
    var currServerModel = dw.getDocumentDOM().serverModel.getServerName();
	if (currServerModel != "JSP") {
		sbFileName = "Login User2.htm";
	} else if (sbObj) {
		sbObj.setForcePriorUpdate("LoginUser_main");
	}
	
    dwscripts.applySB(paramObj, sbObj, sbFileName);
    MMDB.refreshCache(true);
    
    // Set the security method in a design note for other behaviors to use
    var securityMethod = useAccessList ? "useAccessList" : "dontUseAccessList";
    putSecurityMethodToNotes(securityMethod);
  }
  
  return errMsg;
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   analyzeServerBehavior
//
// DESCRIPTION:
//   Performs extra checks needed to determine if the Server Behavior
//   is complete
//
// ARGUMENTS:
//   sbObj - ServerBehavior object - one of the objects returned
//           from findServerBehaviors
//   allRecs - JavaScripts Array of ServerBehavior objects - all of the
//             ServerBehavior objects known to Dreamweaver
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function analyzeServerBehavior(sbObj, allRecs)
{
  formNode = sbObj.selectedNode;
  if (formNode == null)
  {
    sbObj.incomplete = true;
  }
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   inspectServerBehavior
//
// DESCRIPTION:
//   Sets the values of the form elements in the dialog box based
//   on the given ServerBehavior object
//
// ARGUMENTS:
//   sbObj - ServerBehavior object - one of the objects returned
//           from findServerBehaviors
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function inspectServerBehavior(sbObj)
{  
  // select form in form list
  var formNode = sbObj.selectedNode;
  if (formNode != null)
  {
    var myFormName = formNode.getAttribute("NAME");
    var formNames = LIST_FORM.get('all');
    var idx = -1;
    for (i=0; i<formNames.length; i++)
    {
      if (myFormName == formNames[i])
      {
        idx = i;
        break;
      }
    }
    if (idx >= 0)
    {
      LIST_FORM.setIndex(idx);
      LIST_FORM.disable();
    }
  }  
  onChangeForm();
 
  var connName = sbObj.getParameter("connection");
  LIST_CONNECTION.pickValue(connName);
  if (LIST_CONNECTION.getIndex() == 0)
  {
    alert(dwscripts.sprintf(MM.MSG_ConnNotFound, connName));
  }
  onChangeConnection();
  
  LIST_TABLE.pickValue(sbObj.getParameter("table"));
  onChangeTable();
  
  LIST_FORMUSERNAME.pickValue(sbObj.getParameter("frmUsername"));
  LIST_RSUSERNAME.pickValue(sbObj.getParameter("fldUsername"));
  LIST_FORMPASSWORD.pickValue(sbObj.getParameter("frmPassword"))
  LIST_RSPASSWORD.pickValue(sbObj.getParameter("fldPassword"));
  if (sbObj.getParameter("fldAuthorization") != "")
  {
    LIST_RSAUTHORIZATION.pickValue(sbObj.getParameter("fldAuthorization"));
    RG_SECURITYMETHOD.setSelectedValue("securityMethodUPA");
    onClickSecurityMethodUPA();
  }
  else 
  {
    RG_SECURITYMETHOD.setSelectedValue("securityMethodUP");
    onClickSecurityMethodUP();
  }
 
  TEXTGOTOURLONSUCCESS.value = sbObj.getParameter("redirectSuccess");
  TEXTGOTOURLONFAILURE.value = sbObj.getParameter("redirectFailed");
 
  CBGOTOREFERRERURL.checked =  (sbObj.getParameter("redirectToReferrer") == "true");
  
  if (sbObj.errorMsg != "")
  {
    alert(sbObj.errorMsg)
  }
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   deleteServerBehavior
//
// DESCRIPTION:
//   Remove the specified Server Behavior from the user's document
//
// ARGUMENTS:
//   sbObj - ServerBehavior object - one of the objects returned
//           from findServerBehaviors
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function deleteServerBehavior(sbObj)
{
  dwscripts.deleteSB(sbObj);
  MMDB.refreshCache(true);
  return true;
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   displayHelp
//
// DESCRIPTION:
//   Displays the built-in Dreamweaver help.
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function displayHelp()
{
  // Replace the following call if you are modifying this file for your own use.
  dwscripts.displayDWHelp(HELP_DOC);
}
 
 
 
//***************** LOCAL FUNCTIONS  ******************
 
//--------------------------------------------------------------------
// FUNCTION:
//   initializeUI
//
// DESCRIPTION:
//   Prepare the dialog and controls for user input
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function initializeUI()
{
  LIST_FORM = new ListControl("listForm");
  var upFormObjects = getUPFormObjects();
  var formNames  = getUPFormNames(upFormObjects);
  if (formNames) 
  {
    LIST_FORM.setAll(formNames,upFormObjects);
  } 
  else 
  {
    LIST_FORM.setAll(new Array(MM.LABEL_NoForms), EMPTY_LIST);
  }
  LIST_FORM.object.focus();
 
  LIST_CONNECTION = new ListControl("listConnection")
  var connNames = MMDB.getConnectionList();
  connNames.splice(0,0,MM.LABEL_None);
  if (connNames.length > 0)
  {
    LIST_CONNECTION.setAll(connNames,connNames);
  }
 
  LIST_TABLE = new ListControl("listTable");
 
  LIST_FORMUSERNAME = new ListControl("listFormUsername");
  LIST_RSUSERNAME = new ListControl("listRsUsername");
 
  LIST_FORMPASSWORD = new ListControl("listFormPassword");
  LIST_RSPASSWORD = new ListControl("listRsPassword");
 
  LIST_RSAUTHORIZATION = new ListControl("listRsAuthorization");
  TEXTGOTOURLONSUCCESS = dwscripts.findDOMObject("textGoToURLOnSuccess");
  CBGOTOREFERRERURL = dwscripts.findDOMObject("cbGoToReferrerURL");
  TEXTGOTOURLONFAILURE = dwscripts.findDOMObject("textGoToURLOnFailure");
 
  RG_SECURITYMETHOD = new RadioGroup("securityMethod");
  LIST_RSAUTHORIZATION.disable();
 
  // All the controls are populated, now set the state by calling onEvent methods
  onChangeForm();
  onChangeConnection();
 
  elts = document.forms[0].elements;
  if (elts && elts.length)
    elts[0].focus();
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   onChangeForm
//
// DESCRIPTION:
//   Called when the form changes to update the UI
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function onChangeForm()
{
  var upFormObject = LIST_FORM.getValue()
  var controlNames = getUPFormControlNames(upFormObject);
  if (controlNames.length)
  {
    LIST_FORMUSERNAME.setAll(controlNames, controlNames);
    LIST_FORMPASSWORD.setAll(controlNames, controlNames);
 
    // try to match existing form fields to username & password
    for (i=0; i<controlNames.length; i++)
    {
      if (controlNames[i].toUpperCase().search("USERNAME") >= 0)
      {
        LIST_FORMUSERNAME.setIndex(i);
      }
      if (controlNames[i].toUpperCase().search("PASSWORD") >= 0)
      {
        LIST_FORMPASSWORD.setIndex(i);
      }
    }
    if (LIST_FORMUSERNAME.getIndex() == LIST_FORMPASSWORD.getIndex())
    {
      if (LIST_FORMUSERNAME.getIndex() == 0)
      {
        LIST_FORMPASSWORD.setIndex(1)
      }
      else
      {
        LIST_FORMPASSWORD.setIndex(0)
      }
    }
  } 
  else 
  {
    LIST_FORMUSERNAME.setAll(new Array(MM.LABEL_NoFields), EMPTY_LIST);
    LIST_FORMPASSWORD.setAll(new Array(MM.LABEL_NoFields), EMPTY_LIST);
  }
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   onChangeConnection
//
// DESCRIPTION:
//   Called when the connection changes to update the UI
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
 
function onChangeConnection()
{
  var tableNames = new Array();
  if (LIST_CONNECTION.get() != MM.LABEL_None)
  {
    var tableObjects = MMDB.getTables(LIST_CONNECTION.get());
    if (tableObjects.length==0) 
    {
      alert(MM.MSG_LoginUserNoTablesFound);
    }
    else 
    {
      for (i = 0; i < tableObjects.length; i++)
      {
        var thisTable = tableObjects[i]
        thisSchema =  dwscripts.trim(thisTable.schema)
        if (thisSchema.length == 0)
        {
          thisSchema = dwscripts.trim(thisTable.catalog)
        }
        if (thisSchema.length > 0)
        {
          thisSchema += "."
        }
        tableNames.push(String(thisSchema + thisTable.table))
      }
    }
  }
  if (tableNames.length > 0)
  {
    LIST_TABLE.setAll(tableNames,tableNames);
  } 
  else 
  {
    LIST_TABLE.setAll(new Array(MM.LABEL_NoTables), EMPTY_LIST);
  }
  onChangeTable();
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   onChangeTable
//
// DESCRIPTION:
//   Called when the table changes to update the UI
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function onChangeTable()
{
  var conn  = LIST_CONNECTION.get();
  var table = LIST_TABLE.get();
  if (table != MM.LABEL_NoTables)
  {
    var colsAndTypes = MMDB.getColumnAndTypeOfTable(conn,table)
    var colNames  = new Array();
    //var typeList = new Array();
    for (var i=0; i < colsAndTypes.length; i+=2)
    {
      colNames.push (colsAndTypes[i]);
      //MAP_COL_TYPES[colsAndTypes[i]] = colsAndTypes[i+1];
    }
    if (colNames && colNames.length > 0)
    {
      LIST_RSUSERNAME.setAll(colNames, colNames);
      LIST_RSPASSWORD.setAll(colNames, colNames);
      LIST_RSPASSWORD.setIndex(1);
      LIST_RSAUTHORIZATION.setAll(colNames, colNames);
    } 
    else
    {
      LIST_RSUSERNAME.setAll(Array(MM.LABEL_NoRecordsetFieldsFound), Array());
      LIST_RSPASSWORD.setAll(Array(MM.LABEL_NoRecordsetFieldsFound), Array());
      LIST_RSAUTHORIZATION.setAll(Array(MM.LABEL_NoRecordsetFieldsFound), Array());
    }
  } 
  else 
  {
    LIST_RSUSERNAME.setAll(EMPTY_LIST,EMPTY_LIST);
    LIST_RSPASSWORD.setAll(EMPTY_LIST,EMPTY_LIST);
    LIST_RSAUTHORIZATION.setAll(EMPTY_LIST,EMPTY_LIST);
  }
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   onClickSecurityMethodUP
//
// DESCRIPTION:
//   Disables the authorization field
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function onClickSecurityMethodUP()
{
  LIST_RSAUTHORIZATION.disable();
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   onClickSecurityMethodUPA
//
// DESCRIPTION:
//   Enables the authorization field
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function onClickSecurityMethodUPA()
{
  LIST_RSAUTHORIZATION.enable();
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   onClickBtnFileBrowserOnSuccess
//
// DESCRIPTION:
//   Browses for a success URL
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function onClickBtnFileBrowserOnSuccess()
{
  var fileName = browseForFileURL();  //returns a local filename
  if (fileName)
  {
    TEXTGOTOURLONSUCCESS.value = fileName;
  }
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   onClickBtnFileBrowserOnFailure
//
// DESCRIPTION:
//   Browses for a failure URL
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   nothing
//--------------------------------------------------------------------
function onClickBtnFileBrowserOnFailure()
{
  var fileName = browseForFileURL();  //returns a local filename
  if (fileName)
  {
    TEXTGOTOURLONFAILURE.value = fileName;
  }
}
 
 
// ******************************************************************
//
//  Form and form control handling routines
//
 
//--------------------------------------------------------------------
// FUNCTION:
//   getUPFormObjects
//
// DESCRIPTION:
//   Returns a list of form objects
//
// ARGUMENTS:
//   none
//
// RETURNS:
//   array of form nodes
//--------------------------------------------------------------------
function getUPFormObjects()
{
  var obj;
  var retList = new Array();
  var dom = dw.getDocumentDOM();
  var forms = dom.getElementsByTagName("FORM");
  for (var i=0; i < forms.length; i++)
  {
    formControls = findUsernamePasswordFormFields(forms[i]);
    if (formControls.length >= 1)
    {
      obj = new Object();
      obj.formObj = forms[i];
      if (forms[i].getAttribute("NAME") != null && forms[i].getAttribute("NAME") != "")
      {
        obj.name = forms[i].getAttribute("NAME");
      } 
      else 
      {
        obj.name = MM.LABEL_Unnamed;
      }
      obj.formControls = formControls;
      retList.push(obj);
    }
  }
  return retList;
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   getUPFormNames
//
// DESCRIPTION:
//   Returns a list of form names
//
// ARGUMENTS:
//   upFormList - array of objects - an array of form objects to get
//     the names for.
//
// RETURNS:
//   array of strings
//--------------------------------------------------------------------
function getUPFormNames(upFormList)
{
  var retList = new Array();
  for (i=0; i<upFormList.length; i++)
  {
    retList.push(upFormList[i].name);
  }
  return retList;
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   getUPFormControlNames
//
// DESCRIPTION:
//   Returns the names of the form elements within a given form object
//
// ARGUMENTS:
//   formObject - object - the form object to get controls from
//
// RETURNS:
//   array of string
//--------------------------------------------------------------------
function getUPFormControlNames(formObject)
{
  var retList = new Array(), displayStr, node;
  fieldList = formObject.formControls;
  for (var i=0;  fieldList.length && i < fieldList.length; i++) 
  {
    node = fieldList[i];
    displayStr = "";
    if (node.obj && node.obj.getAttribute("NAME") != null)
    {
      displayStr = node.obj.getAttribute("NAME");
    } 
    else 
    {
      displayStr = MM.LABEL_Unnamed;
    }
    retList.push(displayStr);
  }
  return retList;
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   findUsernamePasswordFormFields
//
// DESCRIPTION:
//   Returns an array of objects which contain:
//    obj ref, column binding, is number
//
// ARGUMENTS:
//   formObj - object - the form object to get controls from
//
// RETURNS:
//   array of objects
//--------------------------------------------------------------------
 
function findUsernamePasswordFormFields(formObj)
{
  var retList = new Array(), node;
  var tagList = getTagElementsInOrder(new Array("INPUT", "SELECT"), formObj);
  //remove the unneeded form elements
  for (var i=0; i < tagList.length; i++)
  {
    if (tagList[i].tagName == "INPUT" && tagList[i].type &&
        (tagList[i].type.toUpperCase() == "SUBMIT" ||
         tagList[i].type.toUpperCase() == "BUTTON" ||
         tagList[i].type.toUpperCase() == "RADIO"  ||
         tagList[i].type.toUpperCase() == "CHECKBOX" ||
         tagList[i].type.toUpperCase() == "FILE" ||
         tagList[i].type.toUpperCase() == "IMAGE" ||
         tagList[i].type.toUpperCase() == "RESET"))
    {
      tagList.splice(i,1);
      i--;
    } 
    else if (tagList[i].tagName == "INPUT" && tagList[i].type &&
             tagList[i].type.toUpperCase() == "HIDDEN" &&
             tagList[i].getAttribute("NAME").indexOf("MM_") != -1)
    {
      tagList.splice(i,1);
      i--;
    }
  }
  //add valid types to the array of form fields
  for (var i=0; i < tagList.length; i++)
  {
    node = new Object();
    node.obj = tagList[i];
    node.column = '';
    node.type = 'str';
    retList.push(node);
  }
  
  return retList;
}
 
 
//--------------------------------------------------------------------
// FUNCTION:
//   getTagElementsInOrder
//
// DESCRIPTION:
//   Returns a list of elements whose tag name matches 
//   one of those in tagList
//
// ARGUMENTS:
//   tagList - array of strings - the list of tag names to match
//   dom - DOM object - (optional) the dom to search
//
// RETURNS:
//   array of tag objects
//--------------------------------------------------------------------
function getTagElementsInOrder(tagList, dom)
{
  var retList = new Array();
  if (dom == null)
  {
    dom = dw.getDocumentDOM();
  }
  
  // **** modified this from the original in editOperations.js ****
  //for (var i=0; dom.hasChildNodes() && i < dom.childNodes.length; i++) {
  for (var i=0; dom.hasChildNodes!=null && dom.hasChildNodes() && i < dom.childNodes.length; i++)
  {
    if (dom.childNodes[i].nodeType == Node.ELEMENT)
    {
      for (j=0; j < tagList.length; j++)
      {
        if (dom.childNodes[i].tagName == tagList[j])
        {
          retList.push(dom.childNodes[i]);
          break;
        }
      }
      retList = retList.concat(getTagElementsInOrder(tagList,dom.childNodes[i]));
    }
  }
  
  return retList;
}
 
 
 
Login.asp Page
--------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<!--#include file="Connections/connLAWbase.asp" -->
 
<script>
if (top.location.href != self.location.href)
{
    top.location.href = self.location.href;
}
</script>
 
<%if (cStr(Request("signout"))<>"") then Session.Contents.RemoveAll()%>                    
 
<%
if (cStr(Request.Form("Login"))<>"")  then
  if (cStr(Request.Form("StoreProfile"))<>"")  then
    Response.Cookies("UserName") = cStr(Request("UserName"))
  else 
    Response.Cookies("UserName") = ""
  end if
  	today =  DateAdd("d",30, Date())
  	Response.Cookies("UserName").Expires = today
end if
%>
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("UserName"))
If MM_valUsername <> "" Then
  MM_fldUserAuthorization="UserAccess"
  MM_redirectLoginSuccess="Administration/admin_main.asp"
  MM_redirectLoginFailed="login.asp?failed=true"
  MM_flag="ADODB.Recordset"
  set MM_rsUser = Server.CreateObject(MM_flag)
  MM_rsUser.ActiveConnection = MM_connLAWbase_STRING
  MM_rsUser.Source = "SELECT UserName, UserPassword, EmployeeID"
  If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
  MM_rsUser.Source = MM_rsUser.Source & " FROM tblEmployees WHERE UserName='" & Replace(MM_valUsername,"'","''") &_
      "' AND UserPassword='" & Replace(Request.Form("Password"),"'","''") & "'"
  MM_rsUser.CursorType = 0
  MM_rsUser.CursorLocation = 2
  MM_rsUser.LockType = 3
  MM_rsUser.Open
  If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then 
    ' username and password match - this is a valid user
    Session("MM_Username") = MM_valUsername
	Session("MM_EmployeeID") = cStr(MM_rsUser.Fields.Item("EmployeeID").Value)
 
    If (MM_fldUserAuthorization <> "") Then
      Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
    Else
      Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And false Then
      MM_redirectLoginSuccess = Request.QueryString("accessdenied")
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginSuccess)
  End If
  MM_rsUser.Close
  Response.Redirect(MM_redirectLoginFailed)
End If
%>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- InstanceBegin template="/Templates/main_template.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>LAWbase</title>
<link href="css/p7ap_06.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/p7dj01.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/p7APscripts.js"></script>
<!--[if lte IE 6]>
<style type="text/css">
body {text-align: center;}
#logo, #tagline, #footer, #leftcolumn, #midcolumn, #rightcolumn {text-align: left;}
#wrapper, #footer, .menulist a {height: 1%;}
.note {border-style: solid;}
</style>
<![endif]-->
<style type="text/css" media="screen">
<!--
@import url("css/p7tp_07.css");
-->
</style>
<script type="text/javascript" src="js/p7tpscripts.js"></script>
<style type="text/css" media="screen">
<!--
@import url("css/p7tbm_center_08.css");
-->
</style>
<script type="text/javascript" src="js/p7tbmenu.js"></script>
<!-- InstanceBeginEditable name="head" -->
<link href="css/p7dj05.css" rel="stylesheet" type="text/css" media="all" />
<!-- InstanceEndEditable -->
</head>
<body onload="P7_initTP(7,1);P7_initTBM(0,0,0,1,200,8)">
<div id="logo">
  <h1><a href="page1.htm"><img src="images/dj_logo.jpg" alt="" width="280" height="36" border="0" /></a></h1>
  <div id="tagline">a CSOnDemand Prodcut </div>
</div>
<!-- InstanceBeginEditable name="main" -->
<div id="wrapper">
  <div id="layoutcrown">&nbsp;</div>
  <div id="midcolumn">
    <form action="<%=MM_LoginAction%>" method="post" name="UserLogin" id="UserLogin">
      <table width="100%" border="0" cellspacing="0" cellpadding="6">
        <tr>
          <td width="25">&nbsp;</td>
          <td colspan="2" class="smallText"><%if (cStr(Request("failed"))<>"") then Response.Write("The Login information you provided is not valid. Please try again.")%>
              <%if (cStr(Request("signout"))<>"") then Response.Write("You have been signed out.")%></td>
        </tr>
        <tr>
          <td width="25">&nbsp;</td>
          <td class="formTitle">USER NAME</td>
          <td class="formField"><input name="UserName" type="text" id="UserName" size="40" value="<%=Request.Cookies("UserName")%>" maxlength="20" /></td>
        </tr>
        <tr>
          <td width="25">&nbsp;</td>
          <td class="formTitle">PASSWORD</td>
          <td class="formField"><input name="Password" type="password" id="Password" size="40" maxlength="20" /></td>
        </tr>
        <tr>
          <td width="25">&nbsp;</td>
          <td class="formTitle">&nbsp;</td>
          <td valign="baseline" class="formField"><input name="StoreProfile" type="checkbox" id="StoreProfile" value="checkbox" <%if (cstr(Request.Cookies("UserName"))<>"")then Response.Write("checked")%> />Save User Name</td>
        </tr>
        <tr>
          <td width="25">&nbsp;</td>
          <td class="formTitle">&nbsp;</td>
          <td class="formField"><input name="Login" type="submit" id="Login" value="Login" /></td>
        </tr>
        <tr>
          <td width="25">&nbsp;</td>
          <td colspan="2" valign="middle" class="smallText"><p> <span class="formField"> Note:</span> For privacy, security and performance, there is a timeout when 
            using a browser to access LAWbase. If no transactions occur for a period of 20 minutes, 
            your connection will be severed and typing you have done may be lost. </p></td>
        </tr>
      </table>
    </form>
  </div>
  <div id="layoutbottom">&nbsp;</div>
</div>
<!-- InstanceEndEditable -->
<div id="footerbox">
  <div id="footer">
    <p>&copy; 2007 <a href="www.csondemand.com">CSOnDemand</a> </p>
  </div>
</div>
</body>
<!-- InstanceEnd --></html>
[+][-]01.12.2008 at 03:07PM PST, ID: 20645671

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.13.2008 at 03:35PM PST, ID: 20649867

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.14.2008 at 01:01AM PST, ID: 20651785

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.15.2008 at 02:33PM PST, ID: 20667427

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.15.2008 at 02:39PM PST, ID: 20667468

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.15.2008 at 02:53PM PST, ID: 20667570

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.15.2008 at 03:17PM PST, ID: 20667778

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628