text:
///////////////////////////////////////////////////////////////////////////
// Copyright © Esri. All Rights Reserved.
//
// Licensed under the Apache License Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////
define(
  ["dojo/_base/declare",
    "dojo/Evented",
    "dojo/_base/lang",
    "dijit/form/Select",
    "dojo/_base/array",
    'dojo/dom-attr',
    'dojo/dom-construct',
    'dojo/on',
    'dojo/query',
    'dojo/promise/all',
    'dojo/Deferred',
    "dojo/text!./Intersection.html",
    'dijit/_TemplatedMixin',
    'jimu/dijit/LayerChooserFromMap',
    'jimu/dijit/LayerChooserFromMapWithDropbox',
    'jimu/BaseWidgetSetting',
    'jimu/dijit/SimpleTable',
    'jimu/dijit/Message',
    "jimu/dijit/Popup",
    "jimu/dijit/CheckBox",
    'dijit/popup',
    'dijit/TooltipDialog',
    'dijit/form/ValidationTextBox',
    'dijit/form/NumberTextBox',
    'dijit/form/DropDownButton',
    'dojo/dom-class',
    "./layersAndFieldsApplyOn"
  ],
  function (
    declare,
    Evented,
    lang,
    Select,
    array,
    domAttr,
    domConstruct,
    on,
    query,
    all,
    Deferred,
    template,
    _TemplatedMixin,
    LayerChooserFromMap,
    LayerChooserFromMapWithDropbox,
    BaseWidgetSetting,
    Table,
    Message,
    Popup,
    CheckBox,
    popup,
    TooltipDialog,
    TextBox,
    NumberTextBox,
    DropDownButton,
    domClass,
    layersAndFieldsApplyOn
  ) {
    return declare([BaseWidgetSetting, Evented, _TemplatedMixin], {
      baseClass: "jimu-widget-smartEditor-setting-intersection",
      templateString: template,
      popup: null,
      totalLayers: [],
      _layersForApplyOn: [],
      isGroup: false,
      ValidFieldsByType: {
        "esriFieldTypeOID": ["esriFieldTypeSmallInteger", "esriFieldTypeInteger",
          "esriFieldTypeSingle", "esriFieldTypeDouble"
        ],
        "esriFieldTypeSmallInteger": ["esriFieldTypeOID", "esriFieldTypeSmallInteger",
          "esriFieldTypeInteger", "esriFieldTypeSingle", "esriFieldTypeDouble"
        ],
        "esriFieldTypeInteger": ["esriFieldTypeOID", "esriFieldTypeSmallInteger",
          "esriFieldTypeInteger", "esriFieldTypeSingle", "esriFieldTypeDouble"
        ],
        "esriFieldTypeDouble": ["esriFieldTypeOID", "esriFieldTypeSmallInteger",
          "esriFieldTypeInteger", "esriFieldTypeSingle", "esriFieldTypeDouble"
        ],
        "esriFieldTypeSingle": ["esriFieldTypeOID", "esriFieldTypeSmallInteger",
          "esriFieldTypeInteger", "esriFieldTypeSingle", "esriFieldTypeDouble"
        ],
        "esriFieldTypeGUID": ["esriFieldTypeGUID", "esriFieldTypeGlobalID"],
        "esriFieldTypeDate": ["esriFieldTypeDate"],
        "esriFieldTypeString": ["esriFieldTypeSmallInteger", "esriFieldTypeInteger",
          "esriFieldTypeSingle", "esriFieldTypeDouble", "esriFieldTypeString", "esriFieldTypeGUID",
          "esriFieldTypeDate", "esriFieldTypeOID", "esriFieldTypeGlobalID"
        ]
      },
      ValidFieldsByTypeToApplyOn: {
        "esriFieldTypeInteger": ["esriFieldTypeSmallInteger",
          "esriFieldTypeInteger", "esriFieldTypeSingle", "esriFieldTypeDouble"
        ],
        "esriFieldTypeGUID": ["esriFieldTypeGUID"],
        "esriFieldTypeDate": ["esriFieldTypeDate"],
        "esriFieldTypeString": ["esriFieldTypeString"]
      },

      postCreate: function () {
        this.inherited(arguments);
        this.totalLayers = [];
        this._layersForApplyOn = [];
        //create toleance settings dialog content
        this._createToleranceSettingsDialogContent();
        //create intersection content
        this._createDialogContent();
        //show the popup dialog
        if (!this.isDelete) {
          this.showDialog();
        }
        this._initLayerSelector();
        this._createLayersAndFields();
        //Listen for all layer event
        this.own(on(this.addLayer, "click", lang.hitch(this, function () {
          if (this.totalLayers.length > 0) {
            var row = this._layerTable.addRow({}).tr;
            this._addLayersDropDown(row);
            this._addFieldsDropDown(row);
            this._addToleranceSettings(row);
          } else {
            new Message({
              message: this.nls.intersectionPage.noLayersMessage
            });
          }
        })));
      },

      _createDialogContent: function () {
        this.isEnabled = false;
        if (this._fieldValues && this._fieldValues.Intersection) {
          if (this._fieldValues.Intersection.hasOwnProperty("enabled")) {
            this.isEnabled = this._fieldValues.Intersection.enabled;
          }
        }
        //Initialize group info controls
        this._initControls();
        //Initialize table contents
        this._initTable();
      },

      _initControls: function () {
        //Create Textbox to enter GroupName
        this.groupNameTextBox = new TextBox({
          style: { width: "100%" },
          required: true,
          trim: true
        }, domConstruct.create("div", {}, this.groupNameTextBoxNode));
        //validate groupname for not empty and unique
        this.groupNameTextBox.validator = lang.hitch(this, function (value) {
          if (!value) {
            this.groupNameTextBox.set("invalidMessage",
              this.nls.smartActionsPage.requiredGroupNameMsg);
            return false;
          }
          if (value !== this.prevName &&
            this.editUtils.isDuplicateGroupName(value, this.existingGroupNames)) {
            this.groupNameTextBox.set("invalidMessage",
              this.nls.smartActionsPage.uniqueGroupNameMsg);
            return false;
          }
          return true;
        });
        if (this.name) {
          this.groupNameTextBox.set('value', this.name);
        }
        this.dataTypeDropdown = new Select({
          options: this._addDataTypeOptions(),
          style: { width: "100%" }
        });
        this.dataTypeDropdown.placeAt(this.dataTypeDropDownNode);
        this.dataTypeDropdown.startup();
        this.own(on(this.dataTypeDropdown, "change", lang.hitch(this, function (value) {
          var allRows;
          if (this.isGroup) {
            //Set current selected fiedl type
            this._fieldType = value;
            //Empty total layers array as it need to fillied agin based on changed fieldType
            this.totalLayers = [];
            this._layersForApplyOn = [];
            //Delete all Rows in layer Table
            allRows = this._layerTable.getRows();
            array.forEach(allRows, lang.hitch(this, function (tr) {
              this._layerTable.deleteRow(tr);
            }));
            //reInit layer selector based on selected fieldType
            this._initLayerSelector();
            this._createLayersAndFields();
          }
        })));
        if (this._fieldType) {
          this.dataTypeDropdown.set('value', this._fieldType, false);
        }
        //Show Checkbox to submit data when filed is hidden
        this.ignoreLayerRanking = new CheckBox({
          'label': this.nls.intersectionPage.ignoreLayerRankingCheckboxLabel
        }, domConstruct.create("div", {}, this.ignoreLayerRankingNode));
      },

      _addDataTypeOptions: function () {
        var options = [{
          "label": this.nls.dataType.esriFieldTypeString,
          "value": "esriFieldTypeString"
        }, {
          "label": this.nls.dataType.esriFieldTypeInteger,
          "value": "esriFieldTypeInteger"
        }, {
          "label": this.nls.dataType.esriFieldTypeDate,
          "value": "esriFieldTypeDate"
        }, {
          "label": this.nls.dataType.esriFieldTypeGUID,
          "value": "esriFieldTypeGUID"
        }];
        return options;
      },

      _initTable: function () {
        var fields2, args2;
        fields2 = [{
          name: 'layerName',
          title: this.nls.intersectionPage.layerText,
          type: 'empty',
          width: '30%'
        }, {
          name: 'fieldName',
          title: this.nls.intersectionPage.fieldText,
          type: 'empty',
          width: '30%'
        },
        {
          name: 'toleranceSettings',
          title: this.nls.intersectionPage.toleranceSettingText,
          type: 'empty',
          width: '25%'
        },
        {
          name: 'actions',
          title: this.nls.intersectionPage.actionsText,
          type: 'actions',
          width: '15%',
          actions: ['up', 'down', 'delete'],
          'class': 'actions'
        }];
        args2 = {
          fields: fields2,
          selectable: false
        };
        this._layerTable = new Table(args2);
        this._layerTable.placeAt(this.layerTableNode);
        this._layerTable.startup();
        this.own(on(this._layerTable,
          'actions-edit',
          lang.hitch(this, this._onEditFieldInfoClick)));
        this.own(on(this._layerTable,
          'actions-delete',
          lang.hitch(this, this._onDeleteFieldInfoClick)));
        this._populateTableData();
      },
      _populateTableData: function () {
        if (this._fieldValues.Intersection.ignoreLayerRanking) {
          this.ignoreLayerRanking.setValue(true);
        }
        array.forEach(this._fieldValues.Intersection.fields, lang.hitch(this, function (field) {
          var row;
          //Check if prev configured layer available in map then only add that row
          if (field.layerId &&
            this.layerInfos.getLayerInfoById(field.layerId)) {
            row = this._layerTable.addRow({}).tr;
            this._addLayersDropDown(row, field);
            this._addFieldsDropDown(row, field);
            this._addToleranceSettings(row, field);
          }
        }));
      },

      _createToleranceSettingsDialogContent: function () {
        var popupFieldContentDiv, unitOptions, dropDownParent, toleranceUnitTextDiv, toleranceValueTextDiv;
        popupFieldContentDiv = domConstruct.create("div", {
          "class": "esriCTpopupFieldContent"
        });

        this._useDefaultToleranceCheckbox = new CheckBox({
          'label': this.nls.intersectionPage.useDefaultToleranceText
        }, domConstruct.create("div", {
          "class": "esriCTPopupLabels"
        }, popupFieldContentDiv));

        toleranceValueTextDiv = domConstruct.create("div", {
          "class": "esriCTPopupLabels esriCTMargin",
          "innerHTML": this.nls.intersectionPage.toleranceValueText
        }, popupFieldContentDiv);

        this._toleranceValueTextbox = new NumberTextBox({
          style: { width: "100%" },
          constraints: { min: 0 },
          required: true
        }, domConstruct.create("div", {
          "class": "esriCTPopupLabels"
        }, popupFieldContentDiv));

        toleranceUnitTextDiv = domConstruct.create("div", {
          "class": "esriCTPopupLabels esriCTMargin",
          "innerHTML": this.nls.intersectionPage.toleranceUnitText
        }, popupFieldContentDiv);

        unitOptions = [{
          label: this.nls.units.miles, value: "miles"
        }, {
          label: this.nls.units.kilometers, value: "kilometers"
        }, {
          label: this.nls.units.meters, value: "meters"
        }, {
          label: this.nls.units.feet, value: "feet"
        }];

        dropDownParent = domConstruct.create("div", {}, popupFieldContentDiv);
        this._toleranceUnitDropdown = new Select({
          style: { width: "200px" },
          options: unitOptions
        });
        this._toleranceUnitDropdown.placeAt(dropDownParent);
        this._toleranceUnitDropdown.startup();

        this.toleranceSettingIconDialog = new TooltipDialog({
          "class": this.baseClass,
          content: popupFieldContentDiv
        });
        //once dialog is closed process the newly configred values and store in respective row
        this.own(on(this.toleranceSettingIconDialog, "close", lang.hitch(this, function () {
          var newValue, newToleranceData;
          //get the data configured in the recent open dialog
          newToleranceData = {
            useDefault: this._useDefaultToleranceCheckbox.getValue(),
            value: this._toleranceValueTextbox.get('value'),
            unit: this._toleranceUnitDropdown.getValue()
          };
          //in case of use default value show defalut value label
          //else set the lable to configured value and unit
          if (newToleranceData.useDefault) {
            newValue = this._useDefaultToleranceCheckbox.label;
          } else {
            if (this._toleranceValueTextbox.isValid()) {
              newValue = newToleranceData.value + " " + this.nls.units[newToleranceData.unit];
            }
          }
          //if usedfalut is true or the tolerancevalue is valid then only use the newly configured settings
          if (newToleranceData.useDefault || this._toleranceValueTextbox.isValid()) {
            //set all configured values in the row's object
            //if tolerance textbox value is valid then only store it else set it to 0
            if (this._toleranceValueTextbox.isValid()) {
              this._selectedRowForToleranceSettings.toleranceSettings.value = newToleranceData.value;
            } else {
              this._selectedRowForToleranceSettings.toleranceSettings.value = 0;
            }
            this._selectedRowForToleranceSettings.toleranceSettings.unit = newToleranceData.unit;
            this._selectedRowForToleranceSettings.toleranceSettings.useDefault = newToleranceData.useDefault;
            //display the newly configured value in row
            domAttr.set(this._selectedRowForToleranceSettings.toleranceTextContainer, "innerHTML", newValue);
            domAttr.set(this._selectedRowForToleranceSettings.toleranceTextContainer, "title", newValue);
          }
        })));
      },

      _addToleranceSettings: function (tableRow, prevSettings) {
        var fieldsColumn, toleranceTextValue, tolreanceParent, toleranceSettingIcon;
        //Create the default tolerance settings for backward compatibility
        //if available use the prev configured values
        if (!prevSettings || !prevSettings.toleranceSettings) {
          tableRow.toleranceSettings = {
            useDefault: false,
            value: 0,
            unit: "meters"
          };
        } else {
          tableRow.toleranceSettings = prevSettings.toleranceSettings;
        }
        //create the tolerance value to be shown in the row
        if (tableRow.toleranceSettings.useDefault) {
          toleranceTextValue = this._useDefaultToleranceCheckbox.label;
        } else {
          toleranceTextValue = tableRow.toleranceSettings.value + " " +
            this.nls.units[tableRow.toleranceSettings.unit];
        }
        //get the 3rd col to show tolerance settings and create the UI
        fieldsColumn = query('.simple-table-cell', tableRow)[2];
        tolreanceParent = domConstruct.create("div", {
          "class": "esriCTToleranceParentDiv"
        }, fieldsColumn);
        tableRow.toleranceTextContainer = domConstruct.create("div", {
          "class": "esriCTToleranceValueText esriCTEllipsis",
          "innerHTML": toleranceTextValue,
          "title": toleranceTextValue
        }, tolreanceParent);
        toleranceSettingIcon = new DropDownButton({
          iconClass: "esriCTToleranceSettingsIcon",
          dropDown: this.toleranceSettingIconDialog,
          "title": this.nls.intersectionPage.toleranceSettingText
        }, domConstruct.create("div", {}, tolreanceParent));
        //on opening the tolerence setting show the rows tolerance setting in the dialog
        //and also maintain the selectedRow so that on close we can store new settings in it
        this.own(on(toleranceSettingIcon, "click", lang.hitch(this, function () {
          this._selectedRowForToleranceSettings = tableRow;
          this._toleranceValueTextbox.set("value", tableRow.toleranceSettings.value);
          this._useDefaultToleranceCheckbox.setValue(tableRow.toleranceSettings.useDefault);
          this._toleranceUnitDropdown.set("value", tableRow.toleranceSettings.unit);
        })));
      },

      _addLayersDropDown: function (tr, fieldData) {
        var td, layerChooserFromMapArgs, layerSelector, layerChooserFromMap;
        if (tr.layerSelector) {
          tr.layerSelector.destroy();
        }
        //create layerChooser args
        layerChooserFromMapArgs = this._createLayerChooserMapArgs();
        layerChooserFromMap = new LayerChooserFromMap(layerChooserFromMapArgs);
        layerChooserFromMap.startup();

        td = query('.simple-table-cell', tr)[0];

        layerSelector =
          new LayerChooserFromMapWithDropbox({ layerChooser: layerChooserFromMap });
        layerSelector.placeAt(td);
        layerSelector.startup();

        tr.layerSelector = layerSelector;
        layerSelector.setSelectedLayer(this.totalLayers[0]);
        if (fieldData) {
          //setSelectedLayer in rows layerSelector
          layerSelector.setSelectedLayer(
            this.layerInfos.getLayerInfoById(fieldData.layerId).layerObject);
        }
        this.own(on(layerSelector, 'selection-change',
          lang.hitch(this, function () {
            tr.layerFields.set("options", this._addLayerFieldOptions(tr));
            tr.layerFields.set("value", tr.layerFields.options[0], false);
          })));
      },

      _createLayerChooserMapArgs: function () {
        var layerChooserFromMapArgs;
        layerChooserFromMapArgs = {
          multiple: false,
          createMapResponse: this.map.webMapResponse,
          filter: this._createFiltersForLayerSelector()
        };
        return layerChooserFromMapArgs;
      },

      _createIntersectionLayerfilter: function (validFieldSet) {
        return function (layerInfo) {
          var defLayerObject = layerInfo.getLayerObject();
          var hasValidField = false;
          defLayerObject.then(function (layerObject) {
            if (layerObject && layerObject.fields) {
              array.some(layerObject.fields, function (field) {
                if (validFieldSet.indexOf(field.type) > -1) {
                  hasValidField = true;
                  return true;
                }
              });
            }
          });
          return hasValidField;
        };
      },

      _createFiltersForLayerSelector: function () {
        var types, featureLayerFilter, imageServiceLayerFilter, filters, combinedFilter,
          intersectionLayerfilter, validFieldSet;

        types = ['point', 'polyline', 'polygon'];
        featureLayerFilter = LayerChooserFromMap.createFeaturelayerFilter(types, false, false);
        imageServiceLayerFilter = LayerChooserFromMap.createImageServiceLayerFilter(true);
        filters = [featureLayerFilter, imageServiceLayerFilter];
        combinedFilter = LayerChooserFromMap.orCombineFilters(filters);

        //Filter layers based on fieldType of the source field
        validFieldSet = this.ValidFieldsByType[this._fieldType];
        intersectionLayerfilter = this._createIntersectionLayerfilter(validFieldSet);

        //combine both the filters
        return LayerChooserFromMap.andCombineFilters([combinedFilter, intersectionLayerfilter]);
      },

      _initLayerSelector: function () {
        var defList, layerChooserFromMapArgs, layerInfosArray;
        defList = [];
        //create layerChooser and get its layerInfo so that all the filter required will be applied
        layerChooserFromMapArgs = this._createLayerChooserMapArgs();
        this._layerChooserFromMap = new LayerChooserFromMap(layerChooserFromMapArgs);
        this._layerChooserFromMap.startup();
        layerInfosArray = this._layerChooserFromMap.layerInfosObj.getLayerInfoArray();
        //Create total layers array
        this._getAllFilteredLayers(layerInfosArray, defList);
        return defList;
      },

      _getAllFilteredLayers: function (layerInfosArray, defList) {
        array.forEach(layerInfosArray, lang.hitch(this, function (currentLayer) {
          var layerDef;
          if (!currentLayer.isLeaf()) {
            this._getAllFilteredLayers(currentLayer.newSubLayers, defList);
          }
          else {
            layerDef = new Deferred();
            this._layerChooserFromMap.filter(currentLayer).then(
              lang.hitch(this, function (isValid) {
                if (isValid) {
                  this.totalLayers.push(currentLayer);
                  //consider only editable layers for apply on
                  if (this._isLayerEditable(currentLayer)) {
                    this._layersForApplyOn.push(currentLayer);
                  }
                }
                layerDef.resolve();
              }));
            defList.push(layerDef);
          }
        }));
      },

      _isLayerEditable: function (currentLayer) {
        var editCapabilites, isEditable = false;
        //check if we can get edit capabilites of the layer or not
        if (currentLayer && currentLayer.layerObject &&
          currentLayer.layerObject.getEditCapabilities) {
          editCapabilites = currentLayer.layerObject.getEditCapabilities();
          if (editCapabilites.canCreate || editCapabilites.canUpdate || editCapabilites.canDelete ||
            editCapabilites.canUpdateGeometry) {
            isEditable = true;
          }
        }
        return isEditable;
      },

      _addFieldsDropDown: function (tableRow, fieldData) {
        var fieldsColumn, dropDownContainer;
        fieldsColumn = query('.simple-table-cell', tableRow)[1];
        if (fieldsColumn) {
          dropDownContainer = domConstruct.create("div", {
            "class": "esriCTDropDownContainer"
          }, fieldsColumn);
          tableRow.layerFields = new Select({
            options: this._addLayerFieldOptions(tableRow),
            "class": "esriCTSettingsFieldDropdown"
          });
          tableRow.layerFields.placeAt(dropDownContainer);
          tableRow.layerFields.startup();
          if (fieldData) {
            tableRow.layerFields.set("value", fieldData.field, false);
          }
        }
      },
      _addLayerNameOptions: function () {
        var layers, options = [];
        layers = this.layerInfos.getLayerInfoArray();
        array.forEach(layers, lang.hitch(this, function (currentLayer) {
          if (currentLayer.layerObject.capabilities.indexOf("Query") > -1) {
            options.push({
              "label": currentLayer.layerObject.name,
              "value": currentLayer.layerObject.id
            });
          }
        }));
        return options;
      },
      _addLayerFieldOptions: function (row) {
        var selectedLayer, options = [], validFieldSet = [];
        if (!row.layerSelector.getSelectedItem()) {
          return options;
        }
        //if selected field type is string then only add the use layer name option
        if (this._fieldType === "esriFieldTypeString") {
          options.push({
            "label": this.nls.intersectionPage.useLayerName,
            "value": "esriCTUseLayerName"
          });
        }
        //get valid field for current field type
        validFieldSet = this.ValidFieldsByType[this._fieldType];
        selectedLayer = row.layerSelector.getSelectedItem().layerInfo.layerObject;
        array.forEach(selectedLayer.fields, lang.hitch(this, function (currentField) {
          //Filter fields based on type
          if (currentField.type !== "esriFieldTypeGeometry" &&
            currentField.type !== "esriFieldTypeBlob" &&
            currentField.type !== "esriFieldTypeRaster" &&
            currentField.type !== "esriFieldTypeXML" &&
            validFieldSet.indexOf(currentField.type) > -1) {
            options.push({
              "label": currentField.alias || currentField.name,
              "value": currentField.name
            });
          }
        }));
        return options;
      },
      showDialog: function () {
        var maxHeight = 600, autoHeight = false;
        if (!this.isGroup) {
          domClass.add(this.groupInfoNode1, "esriCTHidden");
          domClass.add(this.groupInfoNode2, "esriCTHidden");
          domClass.add(this.layerTableNode, "esriCTIntersectionTableMaxHeight");
          autoHeight = true;
          maxHeight = 400;
        }
        var fieldsPopup = new Popup({
          titleLabel: this.nls.actionPage.copyAction.intersection,
          width: 950,
          maxHeight: maxHeight,
          autoHeight: autoHeight,
          content: this,
          'class': this.baseClass,
          buttons: [{
            label: this.nls.ok,
            onClick: lang.hitch(this, function () {
              var data = {}, groupInfo = {};
              data.enabled = this.isEnabled;
              data.ignoreLayerRanking = this.ignoreLayerRanking.checked;
              data.fields = this._getTableData();
              if (this.isGroup) {
                //validate is groupname is valid
                if (!this.groupNameTextBox.isValid()) {
                  this.groupNameTextBox.focus();
                  return;
                }
              } else {
                delete this._fieldValues.Intersection.attributeActionGroupName;
              }
              if (!this._fieldValues.Intersection) {
                this._fieldValues.Intersection = {
                  "actionName": "Intersection"
                };
              }
              lang.mixin(this._fieldValues.Intersection, data);
              if (this.isGroup) {
                groupInfo.name = this.groupNameTextBox.get("value");
                groupInfo.dataType = this.dataTypeDropdown.get("value");
                groupInfo.attributeInfo = data;
                groupInfo.appliedOn = this._layerAndFieldsApplyOnObj.getCheckedFields(groupInfo);
                this.emit("groupInfoUpdated", groupInfo);
              } else {
                this.emit("attributeActionUpdated");
              }
              fieldsPopup.close();
            })
          }, {
            label: this.nls.cancel,
            classNames: ['jimu-btn-vacation'],
            onClick: lang.hitch(this, function () {
              fieldsPopup.close();
            })
          }],
          onClose: lang.hitch(this, function () {
          })
        });
      },
      _getTableData: function () {
        var fields = [], layerInfo;
        array.forEach(this._layerTable.getRows(), lang.hitch(this, function (currentRow) {
          if (currentRow.layerSelector) {
            layerInfo = {};
            layerInfo.layerId = currentRow.layerSelector.getSelectedItem().layerInfo.id;
            layerInfo.field = currentRow.layerFields.getValue();
            layerInfo.toleranceSettings = lang.clone(currentRow.toleranceSettings);
            fields.push(layerInfo);
          }
        }));
        return fields;
      },

      /**
      * This function is used to filter layerFields based on Data type selected
      */
      _createLayerFieldsFilter: function (fieldType) {
        var validFieldSet = [], layerDetails = {};
        array.forEach(this._layersForApplyOn, lang.hitch(this, function (layer) {
          if (!layer.isTable) {
            array.forEach(layer.layerObject.fields, lang.hitch(this, function (field) {
              if (this.ValidFieldsByTypeToApplyOn[fieldType]) {
                validFieldSet = this.ValidFieldsByTypeToApplyOn[fieldType];
                if (validFieldSet.indexOf(field.type) > -1 && field.editable) {
                  if (!layerDetails[layer.id]) {
                    layerDetails[layer.id] = {};
                  }
                  layerDetails[layer.id][field.name] = field;
                }
              }
            }));
          }
        }));
        return layerDetails;
      },

      /**
      * This function is used to create layersAndFieldsApplyOn instance
      * which will create UI for layer and fields to apply on
      */
      _createLayersAndFields: function () {
        this._layerAndFieldsApplyOnObj = new layersAndFieldsApplyOn({
          map: this.map,
          layerInfos: this.layerInfos,
          _configInfos: this._configInfos,
          actionName: "Intersection",
          nls: this.nls,
          prevName: this.prevName,
          existingGroups: this.existingGroups,
          layerDetails: this._createLayerFieldsFilter(this.dataTypeDropdown.get("value")),
          appliedOn: this.appliedOn
        });
        domConstruct.empty(this.tableParentContainer);
        this._layerAndFieldsApplyOnObj.placeAt(this.tableParentContainer);
        this._layerAndFieldsApplyOnObj.startup();
      },

      deleteGroup: function () {
        this._layerAndFieldsApplyOnObj.deleteGroup();
      }
    });
  });


text:
module Shoppe
  class SubscriberTransaction < ActiveRecord::Base

    TYPES = ['invoice']

    belongs_to :subscriber
  end
end

redpajama_set_name: RedPajamaGithub


text:
<configuration scan="true" scanPeriod="30 seconds">
  <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
    <resetJUL>true</resetJUL>
  </contextListener>

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} %-5level [%thread] %logger{36} - %msg%n</pattern>
    </encoder>
    <filter class="ch.qos.logback.classic.filter.LevelFilter">
      <level>TRACE</level>
      <onMatch>DENY</onMatch>
      <onMismatch>ACCEPT</onMismatch>
    </filter>
  </appender>

  <appender name="access-log" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>access.log</file>

    <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <fileNamePattern>access.%i.log.zip</fileNamePattern>
      <minIndex>1</minIndex>
      <maxIndex>10</maxIndex>
    </rollingPolicy>

    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
      <maxFileSize>10MB</maxFileSize>
    </triggeringPolicy>
    <encoder>
      <pattern>%msg%n</pattern>
    </encoder>
  </appender>

  <logger name="access-log" level="trace">
    <appender-ref ref="access-log"/>
  </logger>
  <logger name="access-log-combined" level="OFF">
    <appender-ref ref="access-log"/>
  </logger>

  <root level="debug">
    <appender-ref ref="STDOUT"/>
  </root>
</configuration>


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using Mono.Options;

namespace RunTests
{
    internal enum Display
    {
        None,
        All,
        Succeeded,
        Failed,
    }

    internal class Options
    {
        /// <summary>
        /// Use HTML output files.
        /// </summary>
        public bool IncludeHtml { get; set; }

        /// <summary>
        /// Display the results files.
        /// </summary>
        public Display Display { get; set; }

        /// <summary>
        /// Trait string to pass to xunit.
        /// </summary>
        public string? Trait { get; set; }

        /// <summary>
        /// The no-trait string to pass to xunit.
        /// </summary>
        public string? NoTrait { get; set; }

        public string Configuration { get; set; }

        /// <summary>
        /// The set of target frameworks that should be probed for test assemblies.
        /// </summary>
        public List<string> TargetFrameworks { get; set; } = new List<string>();

        public List<string> IncludeFilter { get; set; } = new List<string>();

        public List<string> ExcludeFilter { get; set; } = new List<string>();

        public string ArtifactsDirectory { get; }

        /// <summary>
        /// Time after which the runner should kill the xunit process and exit with a failure.
        /// </summary>
        public TimeSpan? Timeout { get; set; }

        /// <summary>
        /// Retry tests on failure
        /// </summary>
        public bool Retry { get; set; }

        /// <summary>
        /// Whether or not to collect dumps on crashes and timeouts.
        /// </summary>
        public bool CollectDumps { get; set; }

        /// <summary>
        /// The path to procdump.exe
        /// </summary>
        public string? ProcDumpFilePath { get; set; }

        /// <summary>
        /// Disable partitioning and parallelization across test assemblies.
        /// </summary>
        public bool Sequential { get; set; }

        /// <summary>
        /// Path to the dotnet executable we should use for running dotnet test
        /// </summary>
        public string DotnetFilePath { get; set; }

        /// <summary>
        /// Directory to hold all of the xml files created as test results.
        /// </summary>
        public string TestResultsDirectory { get; set; }

        /// <summary>
        /// Directory to hold dump files and other log files created while running tests.
        /// </summary>
        public string LogFilesDirectory { get; set; }

        public string Platform { get; set; }

        public Options(
            string dotnetFilePath,
            string artifactsDirectory,
            string configuration,
            string testResultsDirectory,
            string logFilesDirectory,
            string platform)
        {
            DotnetFilePath = dotnetFilePath;
            ArtifactsDirectory = artifactsDirectory;
            Configuration = configuration;
            TestResultsDirectory = testResultsDirectory;
            LogFilesDirectory = logFilesDirectory;
            Platform = platform;
        }

        internal static Options? Parse(string[] args)
        {
            string? dotnetFilePath = null;
            var platform = "x64";
            var includeHtml = false;
            var targetFrameworks = new List<string>();
            var configuration = "Debug";
            var includeFilter = new List<string>();
            var excludeFilter = new List<string>();
            var sequential = false;
            var retry = false;
            string? traits = null;
            string? noTraits = null;
            int? timeout = null;
            string? resultFileDirectory = null;
            string? logFileDirectory = null;
            var display = Display.None;
            var collectDumps = false;
            string? procDumpFilePath = null;
            string? artifactsPath = null;
            var optionSet = new OptionSet()
            {
                { "dotnet=", "Path to dotnet", (string s) => dotnetFilePath = s },
                { "configuration=", "Configuration to test: Debug or Release", (string s) => configuration = s },
                { "tfm=", "Target framework to test", (string s) => targetFrameworks.Add(s) },
                { "include=", "Expression for including unit test dlls: default *.UnitTests.dll", (string s) => includeFilter.Add(s) },
                { "exclude=", "Expression for excluding unit test dlls: default is empty", (string s) => excludeFilter.Add(s) },
                { "platform=", "Platform to test: x86 or x64", (string s) => platform = s },
                { "html", "Include HTML file output", o => includeHtml = o is object },
                { "sequential", "Run tests sequentially", o => sequential = o is object },
                { "traits=", "xUnit traits to include (semicolon delimited)", (string s) => traits = s },
                { "notraits=", "xUnit traits to exclude (semicolon delimited)", (string s) => noTraits = s },
                { "timeout=", "Minute timeout to limit the tests to", (int i) => timeout = i },
                { "out=", "Test result file directory", (string s) => resultFileDirectory = s },
                { "logs=", "Log file directory", (string s) => logFileDirectory = s },
                { "display=", "Display", (Display d) => display = d },
                { "artifactspath=", "Path to the artifacts directory", (string s) => artifactsPath = s },
                { "procdumppath=", "Path to procdump", (string s) => procDumpFilePath = s },
                { "collectdumps", "Whether or not to gather dumps on timeouts and crashes", o => collectDumps = o is object },
                { "retry", "Retry failed test a few times", o => retry = o is object },
            };

            List<string> assemblyList;
            try
            {
                assemblyList = optionSet.Parse(args);
            }
            catch (OptionException e)
            {
                Console.WriteLine($"Error parsing command line arguments: {e.Message}");
                optionSet.WriteOptionDescriptions(Console.Out);
                return null;
            }

            artifactsPath ??= TryGetArtifactsPath();
            dotnetFilePath ??= TryGetDotNetPath();
            if (includeFilter.Count == 0)
            {
                includeFilter.Add(".*UnitTests.*");
            }

            if (targetFrameworks.Count == 0)
            {
                targetFrameworks.Add("net472");
            }

            if (artifactsPath is null || !Directory.Exists(artifactsPath))
            {
                Console.WriteLine($"Did not find artifacts directory at {artifactsPath}");
                return null;
            }
            resultFileDirectory ??= Path.Combine(artifactsPath, "TestResults", configuration);

            if (dotnetFilePath is null || !File.Exists(dotnetFilePath))
            {
                Console.WriteLine($"Did not find 'dotnet' at {dotnetFilePath}");
                return null;
            }

            if (retry && includeHtml)
            {
                Console.WriteLine($"Cannot specify both --retry and --html");
                return null;
            }

            if (procDumpFilePath is { } && !collectDumps)
            {
                Console.WriteLine($"procdumppath was specified without collectdumps hence it will not be used");
            }

            if (logFileDirectory is null)
            {
                logFileDirectory = resultFileDirectory;
            }

            return new Options(
                dotnetFilePath: dotnetFilePath,
                artifactsDirectory: artifactsPath,
                configuration: configuration,
                testResultsDirectory: resultFileDirectory,
                logFilesDirectory: logFileDirectory,
                platform: platform)
            {
                TargetFrameworks = targetFrameworks,
                IncludeFilter = includeFilter,
                ExcludeFilter = excludeFilter,
                Display = display,
                ProcDumpFilePath = procDumpFilePath,
                CollectDumps = collectDumps,
                Sequential = sequential,
                IncludeHtml = includeHtml,
                Trait = traits,
                NoTrait = noTraits,
                Timeout = timeout is { } t ? TimeSpan.FromMinutes(t) : null,
                Retry = retry,
            };

            static string? TryGetArtifactsPath()
            {
                var path = AppContext.BaseDirectory;
                while (path is object && Path.GetFileName(path) != "artifacts")
                {
                    path = Path.GetDirectoryName(path);
                }

                return path;
            }

            static string? TryGetDotNetPath()
            {
                var dir = RuntimeEnvironment.GetRuntimeDirectory();
                var programName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "dotnet.exe" : "dotnet";

                while (dir != null && !File.Exists(Path.Combine(dir, programName)))
                {
                    dir = Path.GetDirectoryName(dir);
                }

                return dir == null ? null : Path.Combine(dir, programName);
            }
        }
    }
}


text:
<?php

class ProductDomain
{
	private $productName;
	private $domainName;

	function  __construct($product, $domain) {
		$this->productName = $product;
		$this->domainName = $domain;
	}

	public function getProductName() {
		return $this->productName;
	}
	public function setProductName($productName) {
		$this->productName = $productName;
	}
	public function getDomainName() {
		return $this->domainName;
	}
	public function setDomainName($domainName) {
		$this->domainName = $domainName;
	}

}


text:
using Handyman.Mediator;
using Maestro;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace Mediator.CustomRequestProcessing
{
    internal class Program
    {
        private static async Task Main(string[] args)
        {
            var container = new Container(x =>
            {
                x.Add<IMediator>().Factory(ctx => new Handyman.Mediator.Mediator(ctx.Container.GetService,
                    new Configuration
                    {
                        RequestHandlerProvider = new RequestHandlerProvider()
                    }));
                x.Add<IRequestHandler<Request, string>>().Type<FixedDurationRequestHandler>();
                x.Add<IRequestHandler<Request, string>>().Type<RandomDurationRequestHandler>().Singleton();
            });

            var mediator = container.GetService<IMediator>();

            while (true)
            {
                Console.Write("press enter to execute");
                Console.ReadLine();
                Console.WriteLine(await mediator.Send(new Request()));
                Console.WriteLine();
            }
        }

        private class Request : IRequest<string> { }

        private class FixedDurationRequestHandler : IRequestHandler<Request, string>
        {
            public async Task<string> Handle(Request request, CancellationToken cancellationToken)
            {
                var delay = 50;
                await Task.Delay(delay, cancellationToken);
                return $"fixed:{delay}";
            }
        }

        private class RandomDurationRequestHandler : IRequestHandler<Request, string>
        {
            private static readonly Random Random = new Random();

            public async Task<string> Handle(Request request, CancellationToken cancellationToken)
            {
                var delay = Random.Next(100);
                await Task.Delay(delay, cancellationToken);
                return $"random:{delay}";
            }
        }

        private class RequestHandlerProvider : IRequestHandlerProvider
        {
            public IRequestHandler<TRequest, TResponse> GetHandler<TRequest, TResponse>(ServiceProvider serviceProvider)
                where TRequest : IRequest<TResponse>
            {
                var type = typeof(IEnumerable<IRequestHandler<TRequest, TResponse>>);
                var handlers = (IEnumerable<IRequestHandler<TRequest, TResponse>>)serviceProvider.Invoke(type);
                return new WhenAnyRequestHandler<TRequest, TResponse>(handlers);
            }
        }

        private class WhenAnyRequestHandler<TRequest, TResponse> : IRequestHandler<TRequest, TResponse>
            where TRequest : IRequest<TResponse>
        {
            private readonly IEnumerable<IRequestHandler<TRequest, TResponse>> _handlers;

            public WhenAnyRequestHandler(IEnumerable<IRequestHandler<TRequest, TResponse>> handlers)
            {
                _handlers = handlers;
            }

            public async Task<TResponse> Handle(TRequest request, CancellationToken cancellationToken)
            {
                var tasks = _handlers.Select(handler => handler.Handle(request, cancellationToken)).ToArray();
                return await (await Task.WhenAny(tasks));
            }
        }
    }
}


text:
using System.Collections.Generic;
using System.Linq;
using DBA;
using Entity;

namespace BULogic
{
    public class Chains
    {
        private readonly List<IChain> _chains;

        public Chains()
        {
            var chainsData = ReadFromXml.GetChains();
            _chains = new List<IChain>();
            _chains = chainsData.Select(chain => new Chain(chain.Id, chain.Name) as IChain).ToList();
        }

        public void AddItem(string itemName)
        {
            if (!_chains[0].CheckIfThereIsAnItem(itemName))
                _chains.ForEach(
                    chain =>
                        chain.AddItem(itemName,
                            ReadFromXml.GetPrice(chain.Name, ReadFromXml.GetItemId(itemName, chain.Name))));
        }

        public string[] GetChainsName()
        {
            return _chains.Where(chain => chain.IsWanted).Select(chain => chain.Name).ToArray();
        }

        public List<string> GetChainInfo(string chainName, List<IItem> items)
        {
            var result = new List<string>();
            var relleventChain = _chains.Where(chain => chain.Name == chainName).ElementAt(0);
            var itemPrices = items.Select(item => relleventChain.GetItemPrice(item.Name)).ToList();
            for (var i = 0; (i < 3) && (0 < itemPrices.Count); i++)
                result.Add(lineToShow(itemPrices, items));

            while (3 < itemPrices.Count)
                lineToShow(itemPrices, items);

            while (0 < itemPrices.Count)
                result.Add(lineToShow(itemPrices, items));
            return result;
        }

        private string lineToShow(List<double> itemPrices, List<IItem> items)
        {
            var index = itemPrices.IndexOf(itemPrices.Min());
            var result = items[index].Name + "=" + itemPrices[index];
            itemPrices.RemoveAt(index);
            items.RemoveAt(index);
            return result;
        }

        public List<double> GetSum(List<IItem> items)
        {
            var chainPrices =
                _chains.Where(chain => chain.IsWanted)
                    .Select(chain => items.Select(item => chain.GetItemPrice(item.Name)*item.GetCapacity()).ToList())
                    .ToList();
            return chainPrices.Select(chainPrice => chainPrice.Sum()).ToList();
        }

        public Dictionary<string, bool> GetChainNamesAndAvailability()
        {
            var chainsDictionary = new Dictionary<string, bool>();
            _chains.ForEach(chain => { chainsDictionary.Add(chain.Name, chain.IsWanted); });
            return chainsDictionary;
        }

        public void SetChains(Dictionary<string, bool> chainsDictonary)
        {
            _chains.ForEach(chain =>
            {
                if (chain.IsWanted != chainsDictonary[chain.Name])
                    chain.ChangeValue();
            });
        }
    }
}


text:
import Text.Trifecta
import Control.Applicative

type NumberingPlanArea = Int
type Exchange = Int
type LineNumber = Int

data PhoneNumber =
    PhoneNumber NumberingPlanArea Exchange LineNumber
    deriving (Eq, Show)

npa :: Parser String
npa = count 3 digit <* many (char '-')

npa' :: Parser String
npa' = char '(' *> count 3 digit <* char ')' <* char ' '

npa'' :: Parser String
npa'' = char '1' >> char '-' >> npa

parseNpa :: Parser NumberingPlanArea
parseNpa = do
    x <- try npa <|> try npa' <|> npa''
    return $ read x

parseExchange :: Parser Exchange
parseExchange = do
    x <- try (count 3 digit <* char '-') <|> count 3 digit
    return $ read x

parseLine :: Parser LineNumber
parseLine = do
    x <- count 4 digit
    return $ read x

parsePhone :: Parser PhoneNumber
parsePhone = do
    n <- parseNpa
    exchange <- parseExchange
    l <- parseLine
    return $ PhoneNumber n exchange l


text:
describe Facts::Solaris::Networking::Netmask6 do
  describe '#call_the_resolver' do
    subject(:fact) { Facts::Solaris::Networking::Netmask6.new }

    let(:value) { 'fe80::5989:97ff:75ae:dae7' }

    before do
      allow(Facter::Resolvers::Solaris::Networking).to receive(:resolve).with(:netmask6).and_return(value)
    end

    it 'calls Facter::Resolvers::Solaris::Networking with netmask6' do
      fact.call_the_resolver
      expect(Facter::Resolvers::Solaris::Networking).to have_received(:resolve).with(:netmask6)
    end

    it 'returns netmask6 fact' do
      expect(fact.call_the_resolver).to be_an_instance_of(Array).and \
        contain_exactly(an_object_having_attributes(name: 'networking.netmask6', value: value),
                        an_object_having_attributes(name: 'netmask6', value: value, type: :legacy))
    end

    context 'when netmask6 can not be retrieved' do
      let(:value) { nil }

      it 'returns nil' do
        expect(fact.call_the_resolver).to be_an_instance_of(Array).and \
          contain_exactly(an_object_having_attributes(name: 'networking.netmask6', value: value),
                          an_object_having_attributes(name: 'netmask6', value: value, type: :legacy))
      end
    end
  end
end


text:
function [varargout] = nop(varargin)
%nop Does nothing (but can take any number of inputs)
%
% Part of Burgbox

% 2013-09 CB created

if nargout > 0
  [varargout{1:nargout}] = deal([]);
end

end


text:
welcome, {{admin.username}}

    <button ng-click="admin.sidebar='core/html/profile.html';showAdminPanel=true" translate>edit_profile</button>
    <button ng-click="logout()" translate>log_out</button>

    Hide

    <li ng-show="admin.roleNum<=3" ng-class="{active: active=='content'}" ng-click="contentDropdown=!contentDropdown">
        sidebar_content

                sidebar_new_page

                sidebar_browse

                sidebar_edit_page

                revisions

                files_media

        menus

        blocks

        theme

        users

        modules

        settings


text:
<?xml version="1.0" encoding="UTF-8"?><!--
DISCLAIMER

THE INFORMATION CONTAINED HEREIN AND THE FINANCIAL INFORMATION EXCHANGE PROTOCOL (COLLECTIVELY, THE "FIX PROTOCOL") ARE PROVIDED "AS IS" AND NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL MAKES ANY REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, AS TO THE FIX PROTOCOL (OR THE RESULTS TO BE OBTAINED BY THE USE THEREOF) OR ANY OTHER MATTER AND EACH SUCH PERSON AND ENTITY SPECIFICALLY DISCLAIMS ANY WARRANTY OF ORIGINALITY, ACCURACY, COMPLETENESS, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SUCH PERSONS AND ENTITIES DO NOT WARRANT THAT THE FIX PROTOCOL WILL CONFORM TO ANY DESCRIPTION THEREOF OR BE FREE OF ERRORS. THE ENTIRE RISK OF ANY USE OF THE FIX PROTOCOL IS ASSUMED BY THE USER.

NO PERSON OR ENTITY ASSOCIATED WITH THE FIX PROTOCOL SHALL HAVE ANY LIABILITY FOR DAMAGES OF ANY KIND ARISING IN ANY MANNER OUT OF OR IN CONNECTION WITH ANY USER'S USE OF (OR ANY INABILITY TO USE) THE FIX PROTOCOL, WHETHER DIRECT, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL (INCLUDING, WITHOUT LIMITATION, LOSS OF DATA, LOSS OF USE, CLAIMS OF THIRD PARTIES OR LOST PROFITS OR REVENUES OR OTHER ECONOMIC LOSS), WHETHER IN TORT (INCLUDING NEGLIGENCE AND STRICT LIABILITY), CONTRACT OR OTHERWISE, WHETHER OR NOT ANY SUCH PERSON OR ENTITY HAS BEEN ADVISED OF, OR OTHERWISE MIGHT HAVE ANTICIPATED THE POSSIBILITY OF, SUCH DAMAGES.

No proprietary or ownership interest of any kind is granted with respect to the FIX Protocol (or any rights therein).

Copyright 2003-2009 FIX Protocol Limited, all rights reserved

REPRODUCTION

FIX Protocol Limited grants permission to print in hard copy form or reproduce the FIX Protocol specification in its entirety provided that the duplicated pages retain the "Copyright FIX Protocol Limited" statement at the bottom of the page.

Portions of the FIX Protocol specification may be extracted or cited in other documents (such as a document which describes one's implementation of the FIX Protocol) provided that one reference the origin of the FIX Protocol specification (HTUhttp://www.fixprotocol.orgUTH) and that the specification itself is "Copyright FIX Protocol Limited".
FIX Protocol Limited claims no intellectual property over one's implementation (programming code) of an application which implements the behavior and details from the FIX Protocol specification.
--><MsgContents xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" copyright="Copyright (c) FIX Protocol Ltd. All Rights Reserved." edition="2010" version="FIXT.1.1" xsi:noNamespaceSchemaLocation="../../schema/MsgContents.xsd">
	<MsgContent added="FIX.2.7">
		<ComponentID>1</ComponentID>
		<TagText>StandardHeader</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>1</Reqd>
		<Description>MsgType = 0</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1</ComponentID>
		<TagText>112</TagText>
		<Indent>0</Indent>
		<Position>2</Position>
		<Reqd>0</Reqd>
		<Description>Required when the heartbeat is the result of a Test Request message.</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>1</ComponentID>
		<TagText>StandardTrailer</TagText>
		<Indent>0</Indent>
		<Position>3</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>2</ComponentID>
		<TagText>StandardHeader</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>1</Reqd>
		<Description>MsgType = 1</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>2</ComponentID>
		<TagText>112</TagText>
		<Indent>0</Indent>
		<Position>2</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>2</ComponentID>
		<TagText>StandardTrailer</TagText>
		<Indent>0</Indent>
		<Position>3</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>3</ComponentID>
		<TagText>StandardHeader</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>1</Reqd>
		<Description>MsgType = 2</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>3</ComponentID>
		<TagText>7</TagText>
		<Indent>0</Indent>
		<Position>2</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>3</ComponentID>
		<TagText>16</TagText>
		<Indent>0</Indent>
		<Position>3</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>3</ComponentID>
		<TagText>StandardTrailer</TagText>
		<Indent>0</Indent>
		<Position>4</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>4</ComponentID>
		<TagText>StandardHeader</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>1</Reqd>
		<Description>MsgType = 3</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>4</ComponentID>
		<TagText>45</TagText>
		<Indent>0</Indent>
		<Position>2</Position>
		<Reqd>1</Reqd>
		<Description>MsgSeqNum of rejected message</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>4</ComponentID>
		<TagText>371</TagText>
		<Indent>0</Indent>
		<Position>3</Position>
		<Reqd>0</Reqd>
		<Description>The tag number of the FIX field being referenced.</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>4</ComponentID>
		<TagText>372</TagText>
		<Indent>0</Indent>
		<Position>4</Position>
		<Reqd>0</Reqd>
		<Description>The MsgType of the FIX message being referenced.</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>4</ComponentID>
		<TagText>1130</TagText>
		<Indent>0</Indent>
		<Position>4.1</Position>
		<Reqd>0</Reqd>
		<Description>Recommended when rejecting an application message that does not explicitly provide ApplVerID ( 1128) on the message being rejected. In this case the value from the DefaultApplVerID(1137) or the default value specified in the NoMsgTypes repeating group on the logon message should be provided.</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>4</ComponentID>
		<TagText>1406</TagText>
		<Indent>0</Indent>
		<Position>4.2</Position>
		<Reqd>0</Reqd>
		<Description>Recommended when rejecting an application message that does not explicitly provide ApplExtID(1156) on the rejected message. In this case the value from the DefaultApplExtID(1407) or the default value specified in the NoMsgTypes repeating group on the logon message should be provided.</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>4</ComponentID>
		<TagText>1131</TagText>
		<Indent>0</Indent>
		<Position>4.3</Position>
		<Reqd>0</Reqd>
		<Description>Recommended when rejecting an application message that does not explicitly provide CstmApplVerID(1129) on the message being rejected. In this case the value from the DefaultCstmApplVerID(1408) or the default value specified in the NoMsgTypes repeating group on the logon message should be provided.</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>4</ComponentID>
		<TagText>373</TagText>
		<Indent>0</Indent>
		<Position>5</Position>
		<Reqd>0</Reqd>
		<Description>Code to identify reason for a session-level Reject message.</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>4</ComponentID>
		<TagText>58</TagText>
		<Indent>0</Indent>
		<Position>6</Position>
		<Reqd>0</Reqd>
		<Description>Where possible, message to explain reason for rejection</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>4</ComponentID>
		<TagText>354</TagText>
		<Indent>0</Indent>
		<Position>7</Position>
		<Reqd>0</Reqd>
		<Description>Must be set if EncodedText field is specified and must immediately precede it.</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>4</ComponentID>
		<TagText>355</TagText>
		<Indent>0</Indent>
		<Position>8</Position>
		<Reqd>0</Reqd>
		<Description>Encoded (non-ASCII characters) representation of the Text field in the encoded format specified via the MessageEncoding field.</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>4</ComponentID>
		<TagText>StandardTrailer</TagText>
		<Indent>0</Indent>
		<Position>9</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>5</ComponentID>
		<TagText>StandardHeader</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>1</Reqd>
		<Description>MsgType = 4</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>5</ComponentID>
		<TagText>123</TagText>
		<Indent>0</Indent>
		<Position>2</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>5</ComponentID>
		<TagText>36</TagText>
		<Indent>0</Indent>
		<Position>3</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>5</ComponentID>
		<TagText>StandardTrailer</TagText>
		<Indent>0</Indent>
		<Position>4</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>6</ComponentID>
		<TagText>StandardHeader</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>1</Reqd>
		<Description>MsgType = 5</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>6</ComponentID>
		<TagText>1409</TagText>
		<Indent>0</Indent>
		<Position>1.01</Position>
		<Reqd>0</Reqd>
		<Description>Session status at time of logout.</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>6</ComponentID>
		<TagText>58</TagText>
		<Indent>0</Indent>
		<Position>2</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>6</ComponentID>
		<TagText>354</TagText>
		<Indent>0</Indent>
		<Position>3</Position>
		<Reqd>0</Reqd>
		<Description>Must be set if EncodedText field is specified and must immediately precede it.</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>6</ComponentID>
		<TagText>355</TagText>
		<Indent>0</Indent>
		<Position>4</Position>
		<Reqd>0</Reqd>
		<Description>Encoded (non-ASCII characters) representation of the Text field in the encoded format specified via the MessageEncoding field.</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>6</ComponentID>
		<TagText>StandardTrailer</TagText>
		<Indent>0</Indent>
		<Position>5</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>11</ComponentID>
		<TagText>StandardHeader</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>1</Reqd>
		<Description>MsgType = A</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>11</ComponentID>
		<TagText>98</TagText>
		<Indent>0</Indent>
		<Position>2</Position>
		<Reqd>1</Reqd>
		<Description>(Always unencrypted)</Description>
	</MsgContent>
	<MsgContent added="FIX.3.0">
		<ComponentID>11</ComponentID>
		<TagText>108</TagText>
		<Indent>0</Indent>
		<Position>3</Position>
		<Reqd>1</Reqd>
		<Description>Note same value used by both sides</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>11</ComponentID>
		<TagText>95</TagText>
		<Indent>0</Indent>
		<Position>4</Position>
		<Reqd>0</Reqd>
		<Description>Required for some authentication methods</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>11</ComponentID>
		<TagText>96</TagText>
		<Indent>0</Indent>
		<Position>5</Position>
		<Reqd>0</Reqd>
		<Description>Required for some authentication methods</Description>
	</MsgContent>
	<MsgContent added="FIX.4.1">
		<ComponentID>11</ComponentID>
		<TagText>141</TagText>
		<Indent>0</Indent>
		<Position>6</Position>
		<Reqd>0</Reqd>
		<Description>Indicates both sides of a FIX session should reset sequence numbers</Description>
	</MsgContent>
	<MsgContent added="FIX.4.4">
		<ComponentID>11</ComponentID>
		<TagText>789</TagText>
		<Indent>0</Indent>
		<Position>7</Position>
		<Reqd>0</Reqd>
		<Description>Optional, alternative via counterparty bi-lateral agreement message gap detection and recovery approach (see "Logon Message NextExpectedMsgSeqNum Processing" section)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>11</ComponentID>
		<TagText>383</TagText>
		<Indent>0</Indent>
		<Position>8</Position>
		<Reqd>0</Reqd>
		<Description>Can be used to specify the maximum number of bytes supported for messages received</Description>
	</MsgContent>
	<MsgContent added="FIX.4.4" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>MsgTypeGrp</TagText>
		<Indent>0</Indent>
		<Position>8.1</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.4.3">
		<ComponentID>11</ComponentID>
		<TagText>464</TagText>
		<Indent>0</Indent>
		<Position>12</Position>
		<Reqd>0</Reqd>
		<Description>Can be used to specify that this FIX session will be sending and receiving "test" vs. "production" messages.</Description>
	</MsgContent>
	<MsgContent added="FIX.4.3">
		<ComponentID>11</ComponentID>
		<TagText>553</TagText>
		<Indent>0</Indent>
		<Position>13</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.4.3">
		<ComponentID>11</ComponentID>
		<TagText>554</TagText>
		<Indent>0</Indent>
		<Position>14</Position>
		<Reqd>0</Reqd>
		<Description>Note: minimal security exists without transport-level encryption.</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>925</TagText>
		<Indent>0</Indent>
		<Position>15</Position>
		<Reqd>0</Reqd>
		<Description>Specifies a new password for the FIX Logon. The new password is used for subsequent logons.</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>1400</TagText>
		<Indent>0</Indent>
		<Position>16</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>1401</TagText>
		<Indent>0</Indent>
		<Position>17</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>1402</TagText>
		<Indent>0</Indent>
		<Position>18</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>1403</TagText>
		<Indent>0</Indent>
		<Position>19</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>1404</TagText>
		<Indent>0</Indent>
		<Position>20</Position>
		<Reqd>0</Reqd>
		<Description>Encrypted new password- encrypted via the method specified in the field EncryptedPasswordMethod(1400)</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>1409</TagText>
		<Indent>0</Indent>
		<Position>21</Position>
		<Reqd>0</Reqd>
		<Description>Session status at time of logon. Field is intended to be used when the logon is sent as an acknowledgement from acceptor of the FIX session.</Description>
	</MsgContent>
	<MsgContent added="FIX.4.4" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>1137</TagText>
		<Indent>0</Indent>
		<Position>30</Position>
		<Reqd>1</Reqd>
		<Description>The default version of FIX messages used in this session.</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>1407</TagText>
		<Indent>0</Indent>
		<Position>31</Position>
		<Reqd>0</Reqd>
		<Description>The default extension pack for FIX messages used in this session</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>1408</TagText>
		<Indent>0</Indent>
		<Position>32</Position>
		<Reqd>0</Reqd>
		<Description>The default custom application version (dictionary) for FIX messages used in this session</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>58</TagText>
		<Indent>0</Indent>
		<Position>50</Position>
		<Reqd>0</Reqd>
		<Description>Available to provide a response to logon when used as a logon acknowledgement from acceptor back to the logon initiator.</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>354</TagText>
		<Indent>0</Indent>
		<Position>51</Position>
		<Reqd>0</Reqd>
		<Description>Must be set if EncodedText field is specified and must immediately precede it.</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>11</ComponentID>
		<TagText>355</TagText>
		<Indent>0</Indent>
		<Position>52</Position>
		<Reqd>0</Reqd>
		<Description>Encoded (non-ASCII characters) representation of the Text field in the encoded format specified via the MessageEncoding field.</Description>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>11</ComponentID>
		<TagText>StandardTrailer</TagText>
		<Indent>0</Indent>
		<Position>100</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>8</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>1</Reqd>
		<Description>FIXT.1.1 (Always unencrypted, must be first field in message)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>9</TagText>
		<Indent>0</Indent>
		<Position>2</Position>
		<Reqd>1</Reqd>
		<Description>(Always unencrypted, must be second field in message)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>35</TagText>
		<Indent>0</Indent>
		<Position>3</Position>
		<Reqd>1</Reqd>
		<Description>(Always unencrypted, must be third field in message)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.4" addedEP="-1">
		<ComponentID>1024</ComponentID>
		<TagText>1128</TagText>
		<Indent>0</Indent>
		<Position>3.1</Position>
		<Reqd>0</Reqd>
		<Description>Indicates application version using a service pack identifier. The ApplVerID applies to a specific message occurrence.</Description>
	</MsgContent>
	<MsgContent added="FIX.5.0" addedEP="-1">
		<ComponentID>1024</ComponentID>
		<TagText>1156</TagText>
		<Indent>0</Indent>
		<Position>3.11</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.4.4" addedEP="-1">
		<ComponentID>1024</ComponentID>
		<TagText>1129</TagText>
		<Indent>0</Indent>
		<Position>3.2</Position>
		<Reqd>0</Reqd>
		<Description>Used to support bilaterally agreed custom functionality</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>49</TagText>
		<Indent>0</Indent>
		<Position>4</Position>
		<Reqd>1</Reqd>
		<Description>(Always unencrypted)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>56</TagText>
		<Indent>0</Indent>
		<Position>5</Position>
		<Reqd>1</Reqd>
		<Description>(Always unencrypted)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>115</TagText>
		<Indent>0</Indent>
		<Position>6</Position>
		<Reqd>0</Reqd>
		<Description>Trading partner company ID used when sending messages via a third party (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>128</TagText>
		<Indent>0</Indent>
		<Position>7</Position>
		<Reqd>0</Reqd>
		<Description>Trading partner company ID used when sending messages via a third party (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>90</TagText>
		<Indent>0</Indent>
		<Position>8</Position>
		<Reqd>0</Reqd>
		<Description>Required to identify length of encrypted section of message. (Always unencrypted)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>91</TagText>
		<Indent>0</Indent>
		<Position>9</Position>
		<Reqd>0</Reqd>
		<Description>Required when message body is encrypted. Always immediately follows SecureDataLen field.</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>34</TagText>
		<Indent>0</Indent>
		<Position>10</Position>
		<Reqd>1</Reqd>
		<Description>(Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>50</TagText>
		<Indent>0</Indent>
		<Position>11</Position>
		<Reqd>0</Reqd>
		<Description>(Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.1">
		<ComponentID>1024</ComponentID>
		<TagText>142</TagText>
		<Indent>0</Indent>
		<Position>12</Position>
		<Reqd>0</Reqd>
		<Description>Sender's LocationID (i.e. geographic location and/or desk) (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>57</TagText>
		<Indent>0</Indent>
		<Position>13</Position>
		<Reqd>0</Reqd>
		<Description>"ADMIN" reserved for administrative messages not intended for a specific user. (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.1">
		<ComponentID>1024</ComponentID>
		<TagText>143</TagText>
		<Indent>0</Indent>
		<Position>14</Position>
		<Reqd>0</Reqd>
		<Description>Trading partner LocationID (i.e. geographic location and/or desk) (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>116</TagText>
		<Indent>0</Indent>
		<Position>15</Position>
		<Reqd>0</Reqd>
		<Description>Trading partner SubID used when delivering messages via a third party. (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.1">
		<ComponentID>1024</ComponentID>
		<TagText>144</TagText>
		<Indent>0</Indent>
		<Position>16</Position>
		<Reqd>0</Reqd>
		<Description>Trading partner LocationID (i.e. geographic location and/or desk) used when delivering messages via a third party. (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>129</TagText>
		<Indent>0</Indent>
		<Position>17</Position>
		<Reqd>0</Reqd>
		<Description>Trading partner SubID used when delivering messages via a third party. (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.1">
		<ComponentID>1024</ComponentID>
		<TagText>145</TagText>
		<Indent>0</Indent>
		<Position>18</Position>
		<Reqd>0</Reqd>
		<Description>Trading partner LocationID (i.e. geographic location and/or desk) used when delivering messages via a third party. (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>43</TagText>
		<Indent>0</Indent>
		<Position>19</Position>
		<Reqd>0</Reqd>
		<Description>Always required for retransmitted messages, whether prompted by the sending system or as the result of a resend request. (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>97</TagText>
		<Indent>0</Indent>
		<Position>20</Position>
		<Reqd>0</Reqd>
		<Description>Required when message may be duplicate of another message sent under a different sequence number. (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>52</TagText>
		<Indent>0</Indent>
		<Position>21</Position>
		<Reqd>1</Reqd>
		<Description>(Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1024</ComponentID>
		<TagText>122</TagText>
		<Indent>0</Indent>
		<Position>22</Position>
		<Reqd>0</Reqd>
		<Description>Required for message resent as a result of a ResendRequest. If data is not available set to same value as SendingTime (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>1024</ComponentID>
		<TagText>212</TagText>
		<Indent>0</Indent>
		<Position>23</Position>
		<Reqd>0</Reqd>
		<Description>Required when specifying XmlData to identify the length of a XmlData message block. (Can be embedded within encrypted data section.)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>1024</ComponentID>
		<TagText>213</TagText>
		<Indent>0</Indent>
		<Position>24</Position>
		<Reqd>0</Reqd>
		<Description>Can contain a XML formatted message block (e.g. FIXML). Always immediately follows XmlDataLen field. (Can be embedded within encrypted data section.)
See Volume 1: FIXML Support</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>1024</ComponentID>
		<TagText>347</TagText>
		<Indent>0</Indent>
		<Position>25</Position>
		<Reqd>0</Reqd>
		<Description>Type of message encoding (non-ASCII characters) used in a message's "Encoded" fields. Required if any "Encoding" fields are used.</Description>
	</MsgContent>
	<MsgContent added="FIX.4.2">
		<ComponentID>1024</ComponentID>
		<TagText>369</TagText>
		<Indent>0</Indent>
		<Position>26</Position>
		<Reqd>0</Reqd>
		<Description>The last MsgSeqNum value received by the FIX engine and processed by downstream application, such as trading system or order routing system. Can be specified on every message sent. Useful for detecting a backlog with a counterparty.</Description>
	</MsgContent>
	<MsgContent added="FIX.4.4" addedEP="-1">
		<ComponentID>1024</ComponentID>
		<TagText>HopGrp</TagText>
		<Indent>0</Indent>
		<Position>27</Position>
		<Reqd>0</Reqd>
		<Description>Number of repeating groups of historical "hop" information. Only applicable if OnBehalfOfCompID is used, however, its use is optional. Note that some market regulations or counterparties may require tracking of message hops.</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1025</ComponentID>
		<TagText>93</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>0</Reqd>
		<Description>Required when trailer contains signature. Note: Not to be included within SecureData field</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1025</ComponentID>
		<TagText>89</TagText>
		<Indent>0</Indent>
		<Position>2</Position>
		<Reqd>0</Reqd>
		<Description>Note: Not to be included within SecureData field</Description>
	</MsgContent>
	<MsgContent added="FIX.4.0">
		<ComponentID>1025</ComponentID>
		<TagText>10</TagText>
		<Indent>0</Indent>
		<Position>3</Position>
		<Reqd>1</Reqd>
		<Description>(Always unencrypted, always last field in message)</Description>
	</MsgContent>
	<MsgContent added="FIX.4.4" addedEP="-1">
		<ComponentID>2085</ComponentID>
		<TagText>627</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.4.4" addedEP="-1">
		<ComponentID>2085</ComponentID>
		<TagText>628</TagText>
		<Indent>1</Indent>
		<Position>2</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.4.4" addedEP="-1">
		<ComponentID>2085</ComponentID>
		<TagText>629</TagText>
		<Indent>1</Indent>
		<Position>3</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.4.4" addedEP="-1">
		<ComponentID>2085</ComponentID>
		<TagText>630</TagText>
		<Indent>1</Indent>
		<Position>4</Position>
		<Reqd>0</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>47</ComponentID>
		<TagText>StandardHeader</TagText>
		<Indent>0</Indent>
		<Position>1</Position>
		<Reqd>1</Reqd>
	</MsgContent>
	<MsgContent added="FIX.2.7">
		<ComponentID>47</ComponentID>
		<TagText>StandardTrailer</TagText>
		<Indent>0</Indent>
		<Position>2</Position>
		<Reqd>1</Reqd>
	</MsgContent>
</MsgContents>


text:
import sys
import os
from optparse import OptionParser
import docker
import json

dir_path = os.path.dirname(os.path.realpath(__file__))
path, folder_name = os.path.split(dir_path)

def main(argv):
    parser = OptionParser()

    parser.add_option(
        "-i", "--imagename", dest="imagename", help="name for the image", default=folder_name)

    parser.add_option(
        "-v", "--version", dest="version", help="version for the image", default='')

    parser.add_option(
        "-r", "--registry", dest="registry", help="docker registry to use", default='')

    parser.add_option(
        "-n", "--namespace", dest="namespace",
        help="which namespace to use", default="")

    (options, args) = parser.parse_args(sys.argv)

    registry = ""
    namespace = ""
    image_name = ""
    version = ""

    _settings = {}
    _input = {}
    _output = {}

    labels = {}
    for f in ["settings", "input", "output"]:
        json_file = ''.join((f, ".json"))
        with open(json_file) as json_data:
            label_dict = json.load(json_data)
            labels["io.simcore." + f] = str(label_dict[f])

    tag = ''
    if options.registry:
        tag = options.registry + "/"
    if options.namespace:
        tag = tag + options.namespace + "/"
    tag = tag + options.imagename
    if options.version:
        tag = tag + ":" + options.version
    print tag
    client = docker.from_env(version='auto')
    client.images.build(path='.', tag=tag, labels=labels)

if __name__ == "__main__":
    main(sys.argv[1:])


text:
angular
	.module('application')

	.factory('ChatService', function($http, $q, $rootScope, UserService) {
		var ChatService = {};

		ChatService.getAll = function() {
			var deferred = $q.defer();

			$http
				.get(apiUrl + '/members-area/chat/messages')
				.then( function(response) {
					deferred.resolve( response.data.results );
				}, function(error) {
					deferred.reject( error );
				})
			;

			return deferred.promise;
		};

		ChatService.newMessage = function(message) {
			var data = {
				content : message,
			};
			var deferred = $q.defer();

			$http({
				method : 'post',
				url : apiUrl + '/members-area/chat/messages?token=' + UserService.getToken(),
				headers : {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
				transformRequest : function(obj) {
					var str = [];

					for(var p in obj)
						str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));

					return str.join("&");
				},
				data : data,
			})
				.then( function(response) {
					deferred.resolve( response.data );
				}, function(error) {
					deferred.reject( error );
				})
			;

			return deferred.promise;
		};

		return ChatService;
	})
;


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Fro_support_ct extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->model('Captcha_model');
	}

	public function index()
	{
		$data['main'] = 'front-end/support';
		$this->load->view('front-end/template/template',$data);
	}

	public function create_capt()
	{
		$vals = array(
	        'img_path'      => './upload/images/frontend/captcha/',
	        'img_url'       => base_url().'upload/images/frontend/captcha/'
		);
		$cap = create_captcha($vals);
		$time = $cap['time'];
		$ip = $this->input->ip_address();
		$word = $cap['word'];
		$this->Captcha_model->insert_capt($time,$ip,$word);
		return $cap['image'];
	}

	public function addsupport()
	{
		$this->form_validation->set_rules('fname','FirstName','trim|required|max_length[300]');
		$this->form_validation->set_rules('lname','LastName','trim|required|max_length[300]');
		$this->form_validation->set_rules('email','Email','trim|required|valid_email');
		$this->form_validation->set_rules('phone','Phone','trim|is_natural|min_length[10]|max_length[11]');
		$this->form_validation->set_rules('cmt','Address','trim|required|max_length[300]');
		$this->form_validation->set_rules('zip','Zipcode','trim|is_natural');
		$this->form_validation->set_rules('recaptcha','ReCaptcha','callback_check_recaptcha');
		if (!$this->form_validation->run()) {
			$result = array(
				'ajax' =>1,
				'error_fname' => form_error('fname'),
				'error_lname' => form_error('lname'),
				'error_email' => form_error('email'),
				'error_phone' => form_error('phone'),
				'error_cmt' => form_error('cmt'),
				'error_zip' => form_error('zip'),
				'error_recaptcha' => form_error('recaptcha'),
				'capt' => $this->create_capt()
			);
			echo json_encode($result);
		}
		else
		{
			$this->email->from('nhokgalai@gmail.com', 'Email Support');
		    $this->email->to($this->input->post('email'));
		    $this->email->cc('nhoxgalai@gmail.com');
		    $this->email->subject($this->input->post('fname').' Need to support!');
		    $this->email->message(
		    	'First Name: '.$this->input->post('fname').'
'.
		    	'Last Name: '.$this->input->post('lname').'
'.
		    	'Phone: '.$this->input->post('phone').'
'.
		    	'Address: '.$this->input->post('address').'
'.
		    	'City: '.$this->input->post('city').'
'.
		    	'State/Province: '.$this->input->post('s_p').'
'.
		    	'Zip/Postal Code: '.$this->input->post('zip').'
'.
		    	'Industry: '.$this->input->post('indus').'
'.
		    	'Message:
'.
		    	$this->input->post('cmt')
		    );
		    if ($this->email->send())
		    {
		        $result['result'] = "

					Well done!Thanks for your mail. We will contact you as soon as posible!

				  	Back to Home Page!

				";
				$result['kt'] = 0;
				echo json_encode($result);
		    }
		    else
		    {
		    	$result['result'] = "

					Warning!There are Errors! Please try againt!

				  	Back to Home Page!

				";
				$result['kt'] = 1;
				echo json_encode($result);
		    }
		}
	}

	function check_recaptcha()
	    {

		$recaptcha = $this->input->post('g-recaptcha-response');
		if (!empty($recaptcha)) {
		    $response = $this->recaptcha->verifyResponse($recaptcha);
		    if (isset($response['success']) and $response['success'] === true) {
		        return true;
		    }
		}
		$this->form_validation->set_message('check_recaptcha','Please Check Captcha!');
		return false;
	    }

	public function if_not_submit_captcha()
	{
		$kq = $this->Captcha_model->check_captcha();
		if ($kq) {
			return true;
		}
		else
		{
			$this->form_validation->set_message('if_not_submit_captcha','You must submit the word that appears in the image.');
			return false;
		}
	}

}

/* End of file fro_support_ct.php */
/* Location: ./application/controllers/fro_support_ct.php */


text:
module Devise
  module LDAP
    class Connection
      attr_reader :ldap, :login

      def initialize(params = {})
        if ::Devise.ldap_config.is_a?(Proc)
          ldap_config = ::Devise.ldap_config.call
        else
          ldap_config = YAML.load(ERB.new(File.read(::Devise.ldap_config || "#{Rails.root}/config/ldap.yml")).result)[Rails.env]
        end
        ldap_options = params
        ldap_config['ssl'] = :simple_tls if ldap_config['ssl'] === true
        ldap_options[:encryption] = ldap_config['ssl'].to_sym if ldap_config['ssl']

        @ldap = Net::LDAP.new(ldap_options)
        @ldap.host = ldap_config['host']
        @ldap.port = ldap_config['port']
        @ldap.base = ldap_config['base']
        @attribute = ldap_config['attribute']
        @allow_unauthenticated_bind = ldap_config['allow_unauthenticated_bind']

        @ldap_auth_username_builder = params[:ldap_auth_username_builder]

        @group_base = ldap_config['group_base']
        @check_group_membership = ldap_config.has_key?('check_group_membership') ? ldap_config['check_group_membership'] : ::Devise.ldap_check_group_membership

        @allowed_groups = ldap_config['allowed_groups'] || []
        @allowed_groups = @allowed_groups.split(' ') if @allowed_groups.is_a? ::String

        @required_attributes = ldap_config["require_attribute"]

        @ldap.auth ldap_config["admin_user"], ldap_config["admin_password"] if params[:admin]
        @ldap.auth params[:login], params[:password] if ldap_config["admin_as_user"]

        @login = (params[:login] || '').gsub(/[^-\w.@]/i, '')
        @password = params[:password]
        @new_password = params[:new_password]
      end

      def delete_param(param)
        update_ldap [[:delete, param.to_sym, nil]]
      end

      def set_param(param, new_value)
        update_ldap( { param.to_sym => new_value } )
      end

      def dn
        @dn ||= begin
          DeviseLdapNorm::Logger.send("LDAP dn lookup: #{@attribute}=#{@login}")
          ldap_entry = search_for_login
          if ldap_entry.nil?
            @ldap_auth_username_builder.call(@attribute,@login,@ldap)
          else
            ldap_entry.dn
          end
        end
      end

      def ldap_param_value(param)
        ldap_entry = search_for_login

        if ldap_entry
          unless ldap_entry[param].empty?
            value = ldap_entry.send(param)
            DeviseLdapNorm::Logger.send("Requested param #{param} has value #{value}")
            value
          else
            DeviseLdapNorm::Logger.send("Requested param #{param} does not exist")
            value = nil
          end
        else
          DeviseLdapNorm::Logger.send("Requested ldap entry does not exist")
          value = nil
        end
      end

      def authenticate!
        return false unless (@password.present? || @allow_unauthenticated_bind)
        @ldap.auth(dn, @password)
        @ldap.bind
      end

      def authenticated?
        authenticate!
      end

      def authorized?
        DeviseLdapNorm::Logger.send("Authorizing user #{dn}")
        if !authenticated?
          DeviseLdapNorm::Logger.send("Not authorized because not authenticated.")
          return false
        elsif !in_allowed_groups?
          DeviseLdapNorm::Logger.send("Not authorized because not in allowed groups.")
          return false
        elsif !has_required_attribute?
          DeviseLdapNorm::Logger.send("Not authorized because does not have required attribute.")
          return false
        else
          return true
        end
      end

      def change_password!
        update_ldap(:userpassword => Net::LDAP::Password.generate(:sha, @new_password))
      end

      def in_allowed_groups?
        return true unless @check_group_membership

        memberships = self.ldap_param_value("memberOf")

        return false if memberships.blank?

        memberships.map! do |g|
          m = g.match(/cn=([A-Za-z0-9\._-]+),./)
          m[1] unless m.nil?
        end

        # array bisect to determine if any of the groups in groups is allowed access
        (memberships & @allowed_groups).length > 0
      end

      def in_required_groups?
        return true unless @check_group_membership

        ## FIXME set errors here, the ldap.yml isn't set properly.
        return false if @required_groups.nil?

        for group in @required_groups
          if group.is_a?(Array)
            return false unless in_group?(group[1], group[0])
          else
            return false unless in_group?(group)
          end
        end
        return true
      end

      def in_group?(group_name, group_attribute = LDAP::DEFAULT_GROUP_UNIQUE_MEMBER_LIST_KEY)
        in_group = false

        admin_ldap = Connection.admin

        unless ::Devise.ldap_ad_group_check
          admin_ldap.search(:base => group_name, :scope => Net::LDAP::SearchScope_BaseObject) do |entry|
            if entry[group_attribute].include? dn
              in_group = true
            end
          end
        else
          # AD optimization - extension will recursively check sub-groups with one query
          # "(memberof:1.2.840.113556.1.4.1941:=group_name)"
          search_result = admin_ldap.search(:base => dn,
                            :filter => Net::LDAP::Filter.ex("memberof:1.2.840.113556.1.4.1941", group_name),
                            :scope => Net::LDAP::SearchScope_BaseObject)
          # Will return  the user entry if belongs to group otherwise nothing
          if search_result.length == 1 && search_result[0].dn.eql?(dn)
            in_group = true
          end
        end

        unless in_group
          DeviseLdapNorm::Logger.send("User #{dn} is not in group: #{group_name}")
        end

        return in_group
      end

      def has_required_attribute?
        return true unless ::Devise.ldap_check_attributes

        admin_ldap = Connection.admin

        user = find_ldap_user(admin_ldap)

        @required_attributes.each do |key,val|
          unless user[key].include? val
            DeviseLdapNorm::Logger.send("User #{dn} did not match attribute #{key}:#{val}")
            return false
          end
        end

        return true
      end

      def user_groups
        admin_ldap = Connection.admin

        DeviseLdapNorm::Logger.send("Getting groups for #{dn}")
        filter = Net::LDAP::Filter.eq("uniqueMember", dn)
        admin_ldap.search(:filter => filter, :base => @group_base).collect(&:dn)
      end

      def valid_login?
        !search_for_login.nil?
      end

      # Searches the LDAP for the login
      #
      # @return [Object] the LDAP entry found; nil if not found
      def search_for_login
        @login_ldap_entry ||= begin
          DeviseLdapNorm::Logger.send("LDAP search for login: #{@attribute}=#{@login}")
          filter = Net::LDAP::Filter.eq(@attribute.to_s, @login.to_s)
          ldap_entry = nil
          match_count = 0
          @ldap.search(:filter => filter) {|entry| ldap_entry = entry; match_count+=1}
          DeviseLdapNorm::Logger.send("LDAP search yielded #{match_count} matches")
          ldap_entry
        end
      end

      private

      def self.admin
        ldap = Connection.new(:admin => true).ldap

        unless ldap.bind
          DeviseLdapNorm::Logger.send("Cannot bind to admin LDAP user")
          raise DeviseLdapNorm::LdapException, "Cannot connect to admin LDAP user"
        end

        return ldap
      end

      def find_ldap_user(ldap)
        DeviseLdapNorm::Logger.send("Finding user: #{dn}")
        ldap.search(:base => dn, :scope => Net::LDAP::SearchScope_BaseObject).try(:first)
      end

      def update_ldap(ops)
        operations = []
        if ops.is_a? Hash
          ops.each do |key,value|
            operations << [:replace,key,value]
          end
        elsif ops.is_a? Array
          operations = ops
        end

        if ::Devise.ldap_use_admin_to_bind
          privileged_ldap = Connection.admin
        else
          authenticate!
          privileged_ldap = self.ldap
        end

        DeviseLdapNorm::Logger.send("Modifying user #{dn}")
        privileged_ldap.modify(:dn => dn, :operations => operations)
      end
    end
  end
end