Maps strings in arrays of layoutData into the properties of pageData
@param {object} pageData
@param {object} layoutData
@returns {*}
339476
function mapLayoutToPageData(pageData, layoutData) {
  // quickly (and shallowly) go through the layout's properties,
  // finding strings that map to page properties
  _.each(layoutData, function (list, key) {
    if (_.isString(list)) {
      if (_.isArray(pageData[key])) {
        // if you find a match and the data exists,
        // replace the property in the layout data
        layoutData[key] = _.map(pageData[key], refToObj);
      } else {
        // otherwise replace it with an empty list
        // as all layout properties are component lists
        layoutData[key] = [];
      }
    }
  });

  return layoutData;
}
341967
function convertPatternProperties (data) {
  if (!data.patternProperties) {
    return data
  }
  data.properties = data.properties || {}
  const patternProperties = data.patternProperties
  delete data.patternProperties
  Object.keys(patternProperties).map(function (pattern) {
    data.properties['/' + pattern + '/'] = patternProperties[pattern]
  })
  if (data.additionalProperties) delete data.additionalProperties
  return data
}
1097693
function createRenderData(tableData, cellIndexData) {
  const headerAligns = _getHeaderAligns(tableData);
  const renderData = cellIndexData.map(row => row.map(({rowIndex, colIndex}) => (util.extend({
    align: headerAligns[colIndex]
  }, tableData[rowIndex][colIndex]))));

  if (tableData.className) {
    renderData.className = tableData.className;
  }

  return renderData;
}
1257468
function map(data) {
    var result = {}
      , i = this.properties.length;

    while (i--) result[this.properties[i]] = data[i];
    return result;
  }
675229
function convertPatternProperties (data) {
  Object.keys(data.properties).map(function (key) {
    if (/^\/.*\/$/.test(key)) {
      data.patternProperties = data.patternProperties || {}
      const stringRegex = key.slice(1, -1)
      data.patternProperties[stringRegex] = data.properties[key]
      delete data.properties[key]
    }
  })
  return data
}
157265
function(schemaData) {
    var fields = [];

    if (schemaData &&
           'object' === typeof schemaData &&
           schemaData['fields'] &&
            Array.isArray(schemaData['fields'])) {
      schemaData['fields'].forEach((f) => {
        if (f['field'] && f['type'] && 'nested' !== f['type']) {
          fields.push(f['field']);
        }
      });

    }

    if (fields.length) {
      fields = fields.filter(this.uniqueFilter);
    }

    return fields;
  }
602251
function layoutToHTML( d ) {
  var content = [];
  var laCls = '';
  var layoutId = '';
  if ( d.layoutId && d.layoutId != '' ) { 
    laCls = ' class="'+d.layoutId+'"'; 
    layoutId = d.layoutId; 
  }
  content.push( '<div id="header" '+laCls+'></div>' );
  content = content.concat( rowsToHTML( d.rows, d.page_width, layoutId ) );
  content.push( '<div id="footer" '+laCls+'></div>' );
  return content;
}
738665
function layoutEditorUpdateData( divId, paramsObj ) {
	log( "layout-editor", "start '"+JSON.stringify(paramsObj)+"'");
	//alert(divId+": ... try to load "+paramsObj.rowId ); 
	if ( ( paramsObj != null ) && ( paramsObj.page_id != null ) ) {
		moduleConfig[ divId ].page_id = paramsObj.page_id;
	} else { 
		paramsObj = { "page_id":moduleConfig[ divId ].page_id };
	}
	pongLayoutBackendCall( "GET", divId, paramsObj, false );
	log( "layout-editor", "end.");
}
192330
function(p) {

			var _this = this;
			var w = window;
			var data = p.data;

			// Is data a form object
			if (_this.domInstance('form', data)) {
				data = _this.nodeListToJSON(data.elements);
			}
			else if ('NodeList' in w && data instanceof NodeList) {
				data = _this.nodeListToJSON(data);
			}
			else if (_this.domInstance('input', data)) {
				data = _this.nodeListToJSON([data]);
			}

			// Is data a blob, File, FileList?
			if (('File' in w && data instanceof w.File) ||
				('Blob' in w && data instanceof w.Blob) ||
				('FileList' in w && data instanceof w.FileList)) {
				data = {file: data};
			}

			// Loop through data if it's not form data it must now be a JSON object
			if (!('FormData' in w && data instanceof w.FormData)) {

				for (var x in data) if (data.hasOwnProperty(x)) {

					if ('FileList' in w && data[x] instanceof w.FileList) {
						if (data[x].length === 1) {
							data[x] = data[x][0];
						}
					}
					else if (_this.domInstance('input', data[x]) && data[x].type === 'file') {
						continue;
					}
					else if (_this.domInstance('input', data[x]) ||
						_this.domInstance('select', data[x]) ||
						_this.domInstance('textArea', data[x])) {
						data[x] = data[x].value;
					}
					else if (_this.domInstance(null, data[x])) {
						data[x] = data[x].innerHTML || data[x].innerText;
					}
				}
			}

			p.data = data;
			return data;
		}
15985
function applyLayout(chunk) {
    chunk.data.contents = String(chunk.contents);
    var layout = getLayout(chunk.data.layout),
        contents = options.renderTemplate(layout.contents, chunk.data, layout.path);
    chunk.contents = new Buffer(contents);
    return chunk;
  }
609890
protected void setInheritContainerData(Map<String, CmsContainerElementData> elementsData) {

        m_elementData = elementsData.get(getGroupContainerWidget().getId());
        if (m_elementData != null) {
            m_inputDescription.setFormValueAsString(m_elementData.getDescription());
            m_inputTitle.setFormValueAsString(m_elementData.getTitle());
            removeAllChildren();
            CmsContainerpageUtil util = getController().getContainerpageUtil();
            for (CmsInheritanceInfo info : m_elementData.getInheritanceInfos()) {
                if (info.isVisible()) {
                    CmsContainerElementData element = getController().getCachedElement(info.getClientId());
                    try {
                        CmsContainerPageElementPanel elementWidget = util.createElement(
                            element,
                            getGroupContainerWidget(),
                            false);
                        elementWidget.setInheritanceInfo(info);
                        setOptionBar(elementWidget);
                        getGroupContainerWidget().add(elementWidget);
                    } catch (Exception e) {
                        CmsDebugLog.getInstance().printLine(e.getMessage());
                    }
                }
            }
            boolean hasInvisible = false;
            for (CmsInheritanceInfo info : m_elementData.getInheritanceInfos()) {
                if (!info.isVisible()) {
                    CmsContainerElementData element = getController().getCachedElement(info.getClientId());
                    try {
                        CmsContainerPageElementPanel elementWidget = util.createElement(
                            element,
                            getGroupContainerWidget(),
                            false);
                        elementWidget.setInheritanceInfo(info);
                        elementWidget.addStyleName(HIDDEN_ELEMENT_CLASS);
                        setOptionBar(elementWidget);
                        getGroupContainerWidget().add(elementWidget);
                        Element elementOverlay = DOM.createDiv();
                        elementOverlay.setClassName(HIDDEN_ELEMENT_OVERLAY_CLASS);
                        elementWidget.getElement().appendChild(elementOverlay);
                        hasInvisible = true;
                    } catch (Exception e) {
                        CmsDebugLog.getInstance().printLine(e.getMessage());
                    }
                }
            }
            if (hasInvisible) {
                m_showElementsButton.enable();
            }
        }

        getGroupContainerWidget().refreshHighlighting();
        setSaveEnabled(true, null);
    }
173976
function (patternData, iframePassback, switchText) {

		Dispatcher.addListener('checkPanels', panelsViewer.checkPanels);

		// set-up defaults
		var template, templateCompiled, templateRendered, panel;

		// get the base panels
		var panels = Panels.get();

		// evaluate panels array and create content
		for (var i = 0; i < panels.length; ++i) {

			panel = panels[i];

			// catch pattern panel since it doesn't have a name defined by default
			if (panel.name === undefined) {
				panel.name = patternData.patternEngineName || patternData.patternExtension;
		        panel.language = patternData.patternExtension;
			}

			// if httpRequestReplace has not been set, use the extension. this is likely for the raw template
			if (panel.httpRequestReplace === '') {
				panel.httpRequestReplace = panel.httpRequestReplace + '.' + patternData.patternExtension;
			}

			if ((panel.templateID !== undefined) && (panel.templateID)) {

				if ((panel.httpRequest !== undefined) && (panel.httpRequest)) {

					// need a file and then render
					var fileBase = urlHandler.getFileName(patternData.patternPartial, false);
					var e = new XMLHttpRequest();
					e.onload = (function (i, panels, patternData, iframeRequest) {
						return function () {
							prismedContent = Prism.highlight(this.responseText, Prism.languages['html']);
							template = document.getElementById(panels[i].templateID);
							templateCompiled = Hogan.compile(template.innerHTML);
							templateRendered = templateCompiled.render({
								'language': 'html',
								'code': prismedContent
							});
							panels[i].content = templateRendered;
							Dispatcher.trigger('checkPanels', [panels, patternData, iframePassback, switchText]);
						};
					})(i, panels, patternData, iframePassback);

					e.open('GET', fileBase + panel.httpRequestReplace + '?' + (new Date()).getTime(), true);
					e.send();

				} else {

					// vanilla render of pattern data
					template = document.getElementById(panel.templateID);
					templateCompiled = Hogan.compile(template.innerHTML);
					templateRendered = templateCompiled.render(patternData);
					panels[i].content = templateRendered;
					Dispatcher.trigger('checkPanels', [panels, patternData, iframePassback, switchText]);

				}

			}

		}

	}
51520
function pageArrayFromDict (pageDict) {
  if (pageDict.id) {
    // the page is already translated, so wrap in an array and pass back
    return [pageDict];
  }
  let newPageArray = [];
  for (const dict of _.values(pageDict)) {
    // count only WIRTypeWeb pages and ignore all others (WIRTypeJavaScript etc)
    if (_.isUndefined(dict.WIRTypeKey) || dict.WIRTypeKey === 'WIRTypeWeb') {
      newPageArray.push({
        id: dict.WIRPageIdentifierKey,
        title: dict.WIRTitleKey,
        url: dict.WIRURLKey,
        isKey: !_.isUndefined(dict.WIRConnectionIdentifierKey),
      });
    }
  }
  return newPageArray;
}
695551
function normalizePage(content) {
    var data = {
        "head-start": [],
        "head": [],
        "head-end": [],
        body: []
    };

    if (typeof content === "string") {
        data.body.push(content);
    } else {
        ["head-start", "head", "head-end", "body"].forEach(function (section) {
            var sectionContent = content[section];
            if (!sectionContent) {
                return;
            }

            if (!_.isArray(sectionContent)) {
                data[section].push(sectionContent);
            } else {
                data[section] = sectionContent;
            }
        });
    }

    return data;
}
446041
function padData(data) {
  let result = []
  for (let [ targetString, ...rest ] of data) {
    // We are testing for up to 3 spaces and for empty strings we’ll use this
    // condition to prevent duplicates.
    if (targetString === '') {
      result.push([ ' ', ...rest ])
      result.push([ '  ', ...rest ])
      result.push([ '   ', ...rest ])
      continue
    }
    // Other strings, add up to 3 spaces to the left and right.
    for (let i = 1; i <= 3; i++) {
      const LENGHT = targetString.length
      // Add spaces to the right.
      result.push([ pad(targetString, LENGHT + i), ...rest ])
      // Add spaces to the left.
      result.push([ pad(LENGHT + i, targetString), ...rest ])
    }
  }
  return result
}
246583
public static void extendData(SheetTemplate template, Map<String, String> data) {
        if (data == null)
            return;
        for (Row row : template.sheet) {
            for (Cell c : row) {
                if (c.getCellTypeEnum() != CellType.STRING)
                    continue;
                String str = c.getStringCellValue().trim();
                if (str.startsWith("#") && data.containsKey(str.substring(1))) {
                    c.setCellValue(data.get(str.substring(1)));
                }
            }
        }
    }
912625
function(clipboardData) {
        var clipboardModel = this.clipboardModel;
        var data = clipboardData.getData('text/html');
        var table;

        if (data && $(data).find('tbody').length > 0) {
            // step 1: Append copied data on contenteditable element to parsing correctly table data.
            this.$el.html('<table>' + $(data).find('tbody').html() + '</table>');

            // step 2: Make grid data from cell data of appended table element.
            table = this.$el.find('table')[0];
            data = clipboardUtil.convertTableToData(table);

            // step 3: Empty contenteditable element to reset.
            this.$el.html('');
        } else {
            data = clipboardData.getData('text/plain');
            data = clipboardUtil.convertTextToData(data);
        }

        clipboardModel.pasteClipboardDataToGrid(data);
    }