Changeset 1840
- Timestamp:
- 04/18/08 17:37:03
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/deployment/webadmin/webapp/resources/resources/bedeworkXProperties.js
r1839 r1840 1 // Bedework event formfunctions1 // Bedework x-property functions 2 2 3 3 /* ********************************************************************** … … 36 36 var bwXParamHeight = "X-BEDEWORK-PARAM-HEIGHT"; 37 37 38 var bwXPropertySubmittedBy = "X-BEDEWORK-SUBMITTEDBY"; 38 39 var bwXPropertySubmitComment = "X-BEDEWORK-SUBMIT-COMMENT"; 39 40 … … 47 48 /* An xproperty 48 49 * name: String - name of x-property, e.g. "X-BEDEWORK-IMAGE" 49 * params: 2-D Array of parameter key/value pairs,50 * params: 2-D Array of parameter name/value pairs, 50 51 * e.g. params[0] = ["X-BEDEWORK-PARAM-DESCRIPTION","a lovely image"] 51 52 * value: String - value of x-property … … 58 59 this.format = function() { 59 60 var curXparams = ""; 60 for (var i = 0; i < this.params.length; i++) { 61 curXparams += ";" + this.params[i][0] + "=" + this.params[i][1]; 61 if (this.params.length) { 62 for (var i = 0; i < this.params.length; i++) { 63 curXparams += ";" + this.params[i][0] + "=" + this.params[i][1]; 64 } 62 65 } 63 66 return this.name + curXparams + ":" + this.value; … … 75 78 this.update = function(name, params, value, isUnique) { 76 79 var xprop = new BwXProperty(name, params, value); 77 if (isUnique && this.contains( xprop)) {80 if (isUnique && this.contains(name)) { 78 81 index = this.getIndex(name); 79 82 xproperties.splice(index,1,xprop); … … 83 86 } 84 87 85 this.contains = function( xprop) {88 this.contains = function(name) { 86 89 for (var i = 0; i < xproperties.length; i++) { 87 90 var curXprop = xproperties[i]; 88 if (curXprop [0].equals(xprop[0])) {91 if (curXprop.name == name) { 89 92 return true; 90 93 } … … 93 96 } 94 97 95 this.getIndex = function( xpropName) {98 this.getIndex = function(name) { 96 99 for (var i = 0; i < xproperties.length; i++) { 97 100 var curXprop = xproperties[i]; 98 if (curXprop [0].equals(xpropName)) {101 if (curXprop.name == name) { 99 102 return i; 100 103 } … … 109 112 xpropField.name = "xproperty"; 110 113 xpropField.value = xproperties[i].format(); 114 // alert(xproperties[i].format()); 111 115 } 112 116 } … … 114 118 } 115 119 116 function setBedeworkXProperties(formObj ) {120 function setBedeworkXProperties(formObj,submitter) { 117 121 // set up specific Bedework X-Properties on event form submission 118 122 … … 121 125 bwXProps.update(bwXPropertyImage,[[bwXParamDescription,''],[bwXParamWidth,''],[bwXParamHeight,'']],formObj["xBwImageHolder"].value,true); 122 126 } 127 // X-BEDEWORK-SUBMITTEDBY 128 bwXProps.update(bwXPropertySubmittedBy,[],submitter,true); 123 129 124 130 // commit all xproperties back to the form
