Changeset 1840

Show
Ignore:
Timestamp:
04/18/08 17:37:03
Author:
johnsa
Message:

web clients: adding/updating xproperty support to all clients; added X-BEDEWORK-SUBMITTEDBY property.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webadmin/webapp/resources/resources/bedeworkXProperties.js

    r1839 r1840  
    1 // Bedework event form functions 
     1// Bedework x-property functions 
    22 
    33/* ********************************************************************** 
     
    3636var bwXParamHeight = "X-BEDEWORK-PARAM-HEIGHT"; 
    3737 
     38var bwXPropertySubmittedBy = "X-BEDEWORK-SUBMITTEDBY"; 
    3839var bwXPropertySubmitComment = "X-BEDEWORK-SUBMIT-COMMENT"; 
    3940 
     
    4748/* An xproperty 
    4849 * 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, 
    5051 *         e.g. params[0] = ["X-BEDEWORK-PARAM-DESCRIPTION","a lovely image"] 
    5152 * value:  String - value of x-property 
     
    5859  this.format = function() { 
    5960    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      } 
    6265    } 
    6366    return this.name + curXparams + ":" + this.value; 
     
    7578  this.update = function(name, params, value, isUnique) { 
    7679    var xprop = new BwXProperty(name, params, value); 
    77     if (isUnique && this.contains(xprop)) { 
     80    if (isUnique && this.contains(name)) { 
    7881      index = this.getIndex(name); 
    7982      xproperties.splice(index,1,xprop); 
     
    8386  } 
    8487 
    85   this.contains = function(xprop) { 
     88  this.contains = function(name) { 
    8689    for (var i = 0; i < xproperties.length; i++) { 
    8790      var curXprop = xproperties[i]; 
    88       if (curXprop[0].equals(xprop[0])) { 
     91      if (curXprop.name == name) { 
    8992        return true; 
    9093      } 
     
    9396  } 
    9497 
    95   this.getIndex = function(xpropName) { 
     98  this.getIndex = function(name) { 
    9699    for (var i = 0; i < xproperties.length; i++) { 
    97100      var curXprop = xproperties[i]; 
    98       if (curXprop[0].equals(xpropName)) { 
     101      if (curXprop.name == name) { 
    99102        return i; 
    100103      } 
     
    109112      xpropField.name = "xproperty"; 
    110113      xpropField.value = xproperties[i].format(); 
     114      // alert(xproperties[i].format()); 
    111115    } 
    112116  } 
     
    114118} 
    115119 
    116 function setBedeworkXProperties(formObj) { 
     120function setBedeworkXProperties(formObj,submitter) { 
    117121  // set up specific Bedework X-Properties on event form submission 
    118122 
     
    121125    bwXProps.update(bwXPropertyImage,[[bwXParamDescription,''],[bwXParamWidth,''],[bwXParamHeight,'']],formObj["xBwImageHolder"].value,true); 
    122126  } 
     127  // X-BEDEWORK-SUBMITTEDBY 
     128  bwXProps.update(bwXPropertySubmittedBy,[],submitter,true); 
    123129 
    124130  // commit all xproperties back to the form