XFormsSubmission.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. XFormsSubmission.prototype = new XFormsElement;
  2. function XFormsSubmission (strParentId, strAction, strAdd, strEncoding, strId, strMediaType, strMethod, strRef, strReplace, strResultRef, strTag, strType)
  3. {
  4. if (!strId)
  5. {
  6. return;
  7. }
  8. XFormsElement.call(this, strParentId, strId, strTag);
  9. // Property
  10. this.attribute = new Hashtable();
  11. this.attribute["action"] = strAction;
  12. this.attribute["add"] = strAdd;
  13. this.attribute["encoding"] = strEncoding;
  14. this.attribute["id"] = strId;
  15. this.attribute["mediatype"] = strMediaType;
  16. this.attribute["method"] = strMethod;
  17. this.attribute["ref"] = strRef;
  18. this.attribute["replace"] = strReplace;
  19. this.attribute["resultref"] = strResultRef;
  20. this.attribute["tag"] = strTag;
  21. this.attribute["type"] = strType;
  22. this.attribute["function"] = "";
  23. this.m_refresh = false;
  24. };
  25. XFormsSubmission.create = function (strParentId, clAttribute)
  26. {
  27. var strAction = "";
  28. var strAdd = "";
  29. var strEncoding = "";
  30. var strId = "";
  31. var strMediaType = "application/x-www-form-urlencoded";
  32. var strMethod = "post";
  33. var strRef = "";
  34. var strReplace = "";
  35. var strResultRef = "";
  36. var strType = "";
  37. var strUserDefineAttrib = "";
  38. for (var i=0; i<clAttribute.count(); i++)
  39. {
  40. var strAttributeName = clAttribute.keys()[i];
  41. switch (strAttributeName)
  42. {
  43. case "action" :
  44. {
  45. strAction = clAttribute.item(strAttributeName);
  46. break;
  47. }
  48. case "add" :
  49. {
  50. strAdd = clAttribute.item(strAttributeName);
  51. break;
  52. }
  53. case "encoding" :
  54. {
  55. strEncoding = clAttribute.item(strAttributeName);
  56. break;
  57. }
  58. case "id" :
  59. {
  60. strId = clAttribute.item(strAttributeName);
  61. break;
  62. }
  63. case "mediatype" :
  64. {
  65. strMediaType = clAttribute.item(strAttributeName);
  66. break;
  67. }
  68. case "method" :
  69. {
  70. strMethod = clAttribute.item(strAttributeName);
  71. break;
  72. }
  73. case "ref" :
  74. {
  75. strRef = clAttribute.item(strAttributeName);
  76. break;
  77. }
  78. case "replace" :
  79. {
  80. strReplace = clAttribute.item(strAttributeName);
  81. break;
  82. }
  83. case "resultRef" :
  84. {
  85. strResultRef = clAttribute.item(strAttributeName);
  86. break;
  87. }
  88. case "type" :
  89. {
  90. strType = clAttribute.item(strAttributeName);
  91. break;
  92. }
  93. default :
  94. {
  95. if (!STYLE_LIST[strAttributeName])
  96. {
  97. strUserDefineAttrib += strAttributeName + ":" + clAttribute.item(strAttributeName) + "; ";
  98. }
  99. break;
  100. }
  101. }
  102. }
  103. var objSubmission = new XFormsSubmission (strParentId, strAction, strAdd, strEncoding, strId, strMediaType, strMethod, strRef, strReplace, strResultRef, "xforms:submission", strType, strUserDefineAttrib);
  104. return objSubmission;
  105. };