PageRenderTime 52ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/source/_SiteNote/WWWControls/FileBrowser/Scripts/Parameters.js

#
JavaScript | 154 lines | 117 code | 11 blank | 26 comment | 10 complexity | 1ca7116b05d5a78abd79c648807747e5 MD5 | raw file
  1. //function Parameters(boxName, serverUrl, xmlTypes, webServiceUrl, applicationPath, filter, xslUrl, defaultFolder, browserControlPath, language, virtualPath, folderFilter)
  2. function Parameters(boxName, serverUrl, xmlTypes, webServiceUrl, applicationPath, filter, defaultFolder, browserControlPath, language, virtualPath, folderFilter)
  3. {
  4. var tabFilter;
  5. var myObject;
  6. var sFeatures;
  7. var tmp;
  8. this.boxName = boxName;
  9. this.serverUrl = serverUrl;
  10. this.xmlTypes = xmlTypes;
  11. this.webServiceUrl = webServiceUrl;
  12. this.applicationPath = applicationPath;
  13. this.controlPath = "/" + virtualPath + "/Tree/";
  14. //this.xslUrl = xslUrl;
  15. this.defaultFolder = defaultFolder;//.replace(/_/g, "\\");
  16. this.browserControlPath = browserControlPath;
  17. this.language = language;
  18. this.virtualPath = virtualPath;
  19. this.folderFilter = folderFilter;
  20. if(document.all[this.boxName].value == "")
  21. {
  22. this.directory = defaultFolder;//.replace(/_/g, "\\");
  23. }
  24. else
  25. {
  26. this.directory = document.all[this.boxName].value;
  27. }
  28. tabFilter = filter.split(',');
  29. //alert(filter);
  30. this.filter = "";
  31. for(i=0; i<tabFilter.length; i++)
  32. {
  33. //alert(tabFilter[i]);
  34. switch(tabFilter[i].replace(" ", ""))
  35. {
  36. case "Excel":
  37. this.filter += "Excel,.xls,.xlt,.xlc,.xlm,.xlw:";
  38. break;
  39. case "Word":
  40. this.filter += "Word,.doc:";
  41. break;
  42. case "PowerPoint":
  43. this.filter += "PowerPoint,.ppt:";
  44. break;
  45. case "NotePad":
  46. this.filter += "Notepad,.txt,.log:";
  47. break;
  48. case "Image":
  49. this.filter += "Image,.jpg,.gif,.tif,.png,.bmp:";
  50. break;
  51. case "Acrobat":
  52. this.filter += "Acrobat,.pdf:";
  53. break;
  54. case "Archives":
  55. this.filter += "Archives,.zip,.rar,.ace:";
  56. break;
  57. case "All":
  58. this.filter += "All Files,*.*:";
  59. break;
  60. default:
  61. break;
  62. }
  63. }
  64. if (this.filter == "")
  65. {
  66. this.filter += "All Files,*.*:";
  67. }
  68. if(true)
  69. {
  70. this.filter = this.filter.substring(0, this.filter.length-1);
  71. }
  72. //alert(this.filter);
  73. this.xmlHttp = null;
  74. myObject = new Object();
  75. if(document.all[this.boxName].value == "")
  76. {
  77. myObject.directory = defaultFolder;//.replace(/_/g, "\\");
  78. }
  79. else
  80. {
  81. myObject.directory = document.all[this.boxName].value;
  82. }
  83. myObject.serverUrl = serverUrl;
  84. myObject.xmlTypes = xmlTypes;
  85. myObject.webServiceUrl = webServiceUrl;
  86. myObject.applicationPath = applicationPath;
  87. myObject.controlPath = "/" + virtualPath + "/Tree/";
  88. myObject.serverUrl = this.browserControlPath;
  89. myObject.filter = this.filter;
  90. //myObject.xslUrl = xslUrl;
  91. myObject.defaultFolder = defaultFolder;//.replace(/_/g, "\\");
  92. myObject.language = language;
  93. myObject.browserControlPath = browserControlPath;
  94. //alert("directory : " + this.directory.toLowerCase());
  95. //alert("default folder : " + this.defaultFolder.toLowerCase());
  96. var pos;
  97. pos = (this.directory.toLowerCase()).indexOf(this.defaultFolder.toLowerCase());
  98. if(pos == -1)
  99. {
  100. //alert(this.directory);
  101. //alert(this.defaultFolder);
  102. this.directory = defaultFolder;
  103. myObject.directory = defaultFolder;//.replace(/_/g, "\\");
  104. //alert("The Path specified does not contain default path Or is already a filepath!");
  105. }
  106. else
  107. {
  108. tmp = this.directory.substring(this.defaultFolder.length, this.directory.length);
  109. this.directory = this.defaultFolder + tmp;
  110. myObject.directory = this.directory;
  111. }
  112. sFeatures = "dialogHeight:500px;dialogWidth:600px;scroll:no;resizable:no;status:no;";
  113. //document.all["askedDir"].value = window.showModalDialog(myObject.serverUrl + applicationPath + this.browserControlPath + "Popup.aspx?xmlTypesFiles="+ encodeURIComponent(this.xmlTypes) +"&webServiceUrl="+ encodeURIComponent(this.webServiceUrl) +"&directory="+ encodeURIComponent(this.directory) +"&applicationPath="+ encodeURIComponent(this.applicationPath) +"&xslUrl=" + encodeURIComponent(this.xslUrl) + "&defaultFolder=" + encodeURIComponent(this.defaultFolder) + "&browserControlPath=" + encodeURIComponent(this.browserControlPath), myObject, sFeatures);
  114. tmp = defaultFolder;//.replace(/\\/g, "_");
  115. this.defaultFolder = tmp;
  116. //alert("directory sent : " + this.directory);
  117. //alert(this.defaultFolder);
  118. //alert(this.serverUrl + this.applicationPath + this.browserControlPath);
  119. /*this.folderFilter = "f";
  120. alert(this.xslUrl);
  121. alert(this.xmlTypes);
  122. alert(this.webServiceUrl);
  123. alert(this.directory);
  124. alert(this.applicationPath);
  125. alert(this.defaultFolder);
  126. alert(this.browserControlPath);
  127. alert(this.folderFilter);*/
  128. //document.all[this.boxName].value = window.showModalDialog(this.serverUrl + this.applicationPath + this.browserControlPath + "Popup.aspx?xmlTypesFiles="+ encodeURIComponent(this.xmlTypes) +"&webServiceUrl="+ encodeURIComponent(this.webServiceUrl) +"&directory="+ encodeURIComponent(this.directory) +"&applicationPath="+ encodeURIComponent(this.applicationPath) +"&xslUrl=" + encodeURIComponent(this.xslUrl) +"&defaultFolder="+ encodeURIComponent(this.defaultFolder) +"&browserControlPath="+ encodeURIComponent(this.browserControlPath) + "&folderFilter=" + encodeURIComponent(this.folderFilter), myObject, sFeatures);
  129. //alert(this.serverUrl + this.applicationPath + this.browserControlPath + "Popup.aspx?xmlTypesFiles="+ encodeURIComponent(this.xmlTypes) +"&webServiceUrl="+ encodeURIComponent(this.webServiceUrl) +"&directory="+ encodeURIComponent(this.directory) +"&applicationPath="+ encodeURIComponent(this.applicationPath) +"&xslUrl=" + "&defaultFolder="+ encodeURIComponent(this.defaultFolder) +"&browserControlPath="+ encodeURIComponent(this.browserControlPath) + "&folderFilter=" + encodeURIComponent(this.folderFilter));
  130. document.all[this.boxName].value = window.showModalDialog(this.serverUrl + this.applicationPath + this.browserControlPath + "Popup.aspx?xmlTypesFiles="+ encodeURIComponent(this.xmlTypes) +"&webServiceUrl="+ encodeURIComponent(this.webServiceUrl) +"&directory="+ encodeURIComponent(this.directory) +"&applicationPath="+ encodeURIComponent(this.applicationPath) +"&xslUrl=" + "&defaultFolder="+ encodeURIComponent(this.defaultFolder) +"&browserControlPath="+ encodeURIComponent(this.browserControlPath) + "&folderFilter=" + encodeURIComponent(this.folderFilter), myObject, sFeatures);
  131. }
  132. Parameters.prototype.Initialize = function()
  133. {
  134. try
  135. {
  136. this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
  137. }
  138. catch(e)
  139. {
  140. err(e);
  141. this.xmlHttp = null;
  142. }
  143. }