<commit_before>/**
 * The Tooltip Utility - A standard tooltip implementation for providing additional information when hovering over a target element.
 *
 * @module aui-tooltip
 */

var L = A.Lang,
	isString = L.isString,
	isUndefined = L.isUndefined,
	isBoolean = L.isBoolean,

	BL = 'bl',
	TR = 'tr',
	BLANK = '',
	ATTR = 'attr',
	TITLE = 'title',
	CURRENT_NODE = 'currentNode',
	SECTION = 'section',
	TRIGGER = 'trigger',
	BODY_CONTENT = 'bodyContent',
	TOOLTIP = 'tooltip';

/**
 *

 *
 * A base class for Tooltip, providing:
 *

 *
Widget Lifecycle (initializer, renderUI, bindUI, syncUI, destructor)

 *
Additional information when hovering over a target element

 *

 *
 * Quick Example:

 *
 *
var instance = new A.Tooltip({
 *	trigger: '#element',
 *	align: { points: [ 'lc', 'rc' ] },
 *	bodyContent: 'Simple tooltip'
 * }).render();
 *

 *
 * Check the list of Configuration Attributes available for
 * Tooltip.
 *
 * @param config {Object} Object literal specifying widget configuration properties.
 *
 * @class Tooltip
 * @constructor
 * @extends OverlayContextPanel
 */
var Tooltip = A.Component.create(
	{
		/**
		 * Static property provides a string to identify the class.
		 *
		 * @property Tooltip.NAME
		 * @type String
		 * @static
		 */
		NAME: TOOLTIP,

		/**
		 * Static property used to define the default attribute
		 * configuration for the Tooltip.
		 *
		 * @property Tooltip.ATTRS
		 * @type Object
		 * @static
		 */
		ATTRS: {
			/**
			 * See OverlayContextPanel anim.
			 *
			 * @attribute anim
			 * @default { show: false }
			 * @type Object
			 */
			anim: {
				value: {
					show: false
				}
			},

			/**
			 * See OverlayContextPanel align.
			 *
			 * @attribute align
			 * @default { node: null, points: [ BL, TR ] }
			 * @type Object
			 */
			align: {
				value: { node: null, points: [ BL, TR ] }
			},

			/**
			 * See OverlayContext showOn.
			 *
			 * @attribute showOn
			 * @default mouseover
			 * @type String
			 */
			showOn: {
				value: 'mouseover'
			},

			/**
			 * See OverlayContext showOn.
			 *
			 * @attribute hideOn
			 * @default mouseout
			 * @type String
			 */
			hideOn: {
				value: 'mouseout'
			},

			/**
			 * See OverlayContext hideDelay.
			 *
			 * @attribute hideDelay
			 * @default 500
			 * @type Number
			 */
			hideDelay: {
				value: 500
			},

			/**
			 * Use the content of the title attribute as the Tooltip
	         * content.
			 *
			 * @attribute title
			 * @default false
			 * @type boolean
			 */
			title: {
				value: false,
				validator: isBoolean
			}
		},

		EXTENDS: A.OverlayContextPanel,

		prototype: {
			/**
			 * Bind the events on the Tooltip UI. Lifecycle.
			 *
			 * @method bindUI
			 * @protected
			 */
			bindUI: function() {
				var instance = this;

				Tooltip.superclass.bindUI.apply(instance, arguments);
			},

			/**
			 * Over-ride the show to invoke the
		     * _loadBodyContentFromTitle.
		     * See OverlayContext show.
			 *
			 * @method show
			 */
			show: function() {
				var instance = this;
				var bodyContent = instance.get(BODY_CONTENT);

				Tooltip.superclass.show.apply(instance, arguments);

				if (instance.get(TITLE)) {
					instance._loadBodyContentFromTitle( instance.get(CURRENT_NODE) );
				}
			},

			/**
			 * Use the title content of the currentNode as
		     * the content of the Tooltip.
			 *
			 * @method _loadBodyContentFromTitle
			 * @param {Node} currentNode Current node being used by the Tooltip
			 * @protected
			 */
			_loadBodyContentFromTitle: function(currentNode) {
				var instance = this;
				var trigger = instance.get(TRIGGER);

				if (!instance._titles) {
					instance._titles = trigger.attr(TITLE);

					// prevent default browser tooltip for title
					trigger.attr(TITLE, BLANK);
				}

				if (currentNode) {
					var index = trigger.indexOf(currentNode);
					var title = instance._titles[index];

					instance.set(BODY_CONTENT, title);
				}
			},

			/**
			 * Fires after the attribute bodyContent change.
			 *
			 * @method _afterBodyChange
			 * @param {EventFacade} e
			 * @protected
			 */
			_afterBodyChange: function(e) {
				var instance = this;

				Tooltip.superclass._afterBodyChange.apply(this, arguments);

				// need to refreshAlign() after body change
				instance.refreshAlign();
			}
		}
	}
);

A.Tooltip = Tooltip;<commit_msg>LPS-23358 Don't use display:none for hiding the tooltips because they cannot then be properly aligned in Webkit<commit_after>/**
 * The Tooltip Utility - A standard tooltip implementation for providing additional information when hovering over a target element.
 *
 * @module aui-tooltip
 */

var L = A.Lang,
	isString = L.isString,
	isUndefined = L.isUndefined,
	isBoolean = L.isBoolean,

	BL = 'bl',
	TR = 'tr',
	BLANK = '',
	ATTR = 'attr',
	TITLE = 'title',
	CURRENT_NODE = 'currentNode',
	SECTION = 'section',
	TRIGGER = 'trigger',
	BODY_CONTENT = 'bodyContent',
	TOOLTIP = 'tooltip';

/**
 *

 *
 * A base class for Tooltip, providing:
 *

 *
Widget Lifecycle (initializer, renderUI, bindUI, syncUI, destructor)

 *
Additional information when hovering over a target element

 *

 *
 * Quick Example:

 *
 *
var instance = new A.Tooltip({
 *	trigger: '#element',
 *	align: { points: [ 'lc', 'rc' ] },
 *	bodyContent: 'Simple tooltip'
 * }).render();
 *

 *
 * Check the list of Configuration Attributes available for
 * Tooltip.
 *
 * @param config {Object} Object literal specifying widget configuration properties.
 *
 * @class Tooltip
 * @constructor
 * @extends OverlayContextPanel
 */
var Tooltip = A.Component.create(
	{
		/**
		 * Static property provides a string to identify the class.
		 *
		 * @property Tooltip.NAME
		 * @type String
		 * @static
		 */
		NAME: TOOLTIP,

		/**
		 * Static property used to define the default attribute
		 * configuration for the Tooltip.
		 *
		 * @property Tooltip.ATTRS
		 * @type Object
		 * @static
		 */
		ATTRS: {
			/**
			 * See OverlayContextPanel anim.
			 *
			 * @attribute anim
			 * @default { show: false }
			 * @type Object
			 */
			anim: {
				value: {
					show: false
				}
			},

			/**
			 * See OverlayContextPanel align.
			 *
			 * @attribute align
			 * @default { node: null, points: [ BL, TR ] }
			 * @type Object
			 */
			align: {
				value: { node: null, points: [ BL, TR ] }
			},

			/**
			 * See OverlayContext showOn.
			 *
			 * @attribute showOn
			 * @default mouseover
			 * @type String
			 */
			showOn: {
				value: 'mouseover'
			},

			/**
			 * See OverlayContext showOn.
			 *
			 * @attribute hideOn
			 * @default mouseout
			 * @type String
			 */
			hideOn: {
				value: 'mouseout'
			},

			/**
			 * Prevents display:none from being applied to the tooltip when it is hidden because we
			 * cannot properly align a hidden tooltip with display:none since we can't accurately
			 * get its computed x and y position.
			 */
			hideClass: {
				value: false
			},

			/**
			 * See OverlayContext hideDelay.
			 *
			 * @attribute hideDelay
			 * @default 500
			 * @type Number
			 */
			hideDelay: {
				value: 500
			},

			/**
			 * Use the content of the title attribute as the Tooltip
	         * content.
			 *
			 * @attribute title
			 * @default false
			 * @type boolean
			 */
			title: {
				value: false,
				validator: isBoolean
			}
		},

		EXTENDS: A.OverlayContextPanel,

		prototype: {
			/**
			 * Bind the events on the Tooltip UI. Lifecycle.
			 *
			 * @method bindUI
			 * @protected
			 */
			bindUI: function() {
				var instance = this;

				Tooltip.superclass.bindUI.apply(instance, arguments);
			},

			/**
			 * Over-ride the show to invoke the
		     * _loadBodyContentFromTitle.
		     * See OverlayContext show.
			 *
			 * @method show
			 */
			show: function() {
				var instance = this;
				var bodyContent = instance.get(BODY_CONTENT);

				Tooltip.superclass.show.apply(instance, arguments);

				if (instance.get(TITLE)) {
					instance._loadBodyContentFromTitle( instance.get(CURRENT_NODE) );
				}
			},

			/**
			 * Use the title content of the currentNode as
		     * the content of the Tooltip.
			 *
			 * @method _loadBodyContentFromTitle
			 * @param {Node} currentNode Current node being used by the Tooltip
			 * @protected
			 */
			_loadBodyContentFromTitle: function(currentNode) {
				var instance = this;
				var trigger = instance.get(TRIGGER);

				if (!instance._titles) {
					instance._titles = trigger.attr(TITLE);

					// prevent default browser tooltip for title
					trigger.attr(TITLE, BLANK);
				}

				if (currentNode) {
					var index = trigger.indexOf(currentNode);
					var title = instance._titles[index];

					instance.set(BODY_CONTENT, title);
				}
			},

			/**
			 * Fires after the attribute bodyContent change.
			 *
			 * @method _afterBodyChange
			 * @param {EventFacade} e
			 * @protected
			 */
			_afterBodyChange: function(e) {
				var instance = this;

				Tooltip.superclass._afterBodyChange.apply(this, arguments);

				// need to refreshAlign() after body change
				instance.refreshAlign();
			}
		}
	}
);

A.Tooltip = Tooltip;<|endoftext|>


<commit_before>// Dependencies
var sassLint = require('sass-lint');
var path = require('path');

// Helper Utils
var formatter = require('./formatter');
var getImportsToResolve = require('./importResolver');

/**
 * Linter
 *
 * @param {String|Buffer} input Javascript string
 * @param {Object} config scsslint configuration
 * @param {Object} webpack webpack instance
 * @param {Function} callback optional callback for async loader
 * @return {void}
 */
function lint(input, options, webpack, callback) {
  // Run sassLint
  var report = sassLint.lintText({
    'text': input,
    'format': path.extname(webpack.resourcePath).replace('.',  ''),
    'filename': path.relative(process.cwd(), webpack.resourcePath)
  }, {}, options.configFile);

  if (report.messages.length) {
    if (report.warningCount && options.quiet) {
      report.warningCount = 0;
      report.messages = report.messages
        .filter(function(message) {
          return message.severity !== 1;
        });
    }

    if (report.errorCount || report.warningCount) {
      var messages = formatter(report.messages, webpack.resourcePath);

      // Default emitter behavior
      var emitter = report.errorCount ? webpack.emitError : webpack.emitWarning;

      // Force emitError or emitWarning by setting option
      if (options.emitError) {
        emitter = webpack.emitError;
      } else if (options.emitWarning) {
        emitter = webpack.emitWarning;
      }

      if (emitter) {
        emitter(messages);
        if (options.failOnError && report.errorCount) {
          throw new Error('Module failed because of a sasslint error.\n' + messages);
        } else if (options.failOnWarning && report.warningCount) {
          throw new Error('Module failed because of a sasslint warning.\n' + messages);
        }
      } else {
        throw new Error(
          'Your module system doesn\'t support emitWarning.' +
          'Update available? \n' +
          messages
        );
      }
    }
  }

  if (callback) {
    callback(null, input);
  }
}

/**
 * Iternate through files for linter
 *
 * @param {String|Buffer} input Javascript string
 * @param {Object} config scsslint configuration
 * @param {Object} webpack webpack instance
 * @param {Function} callback optional callback for async loader
 * @return {void}
 */
module.exports = function(input, options, webpack, callback) {
  getImportsToResolve(webpack);
  try {
    lint(input, options, webpack, callback);
  } catch(e) {
    callback(e);
  }

  // If directory name is included in the resource path, replace it with .
}<commit_msg>removed some legacy code<commit_after>// Dependencies
var sassLint = require('sass-lint');
var path = require('path');

// Helper Utils
var formatter = require('./formatter');

/**
 * Linter
 *
 * @param {String|Buffer} input Javascript string
 * @param {Object} config scsslint configuration
 * @param {Object} webpack webpack instance
 * @param {Function} callback optional callback for async loader
 * @return {void}
 */
function lint(input, options, webpack, callback) {
  // Run sassLint
  var report = sassLint.lintText({
    'text': input,
    'format': path.extname(webpack.resourcePath).replace('.',  ''),
    'filename': path.relative(process.cwd(), webpack.resourcePath)
  }, {}, options.configFile);

  if (report.messages.length) {
    if (report.warningCount && options.quiet) {
      report.warningCount = 0;
      report.messages = report.messages
        .filter(function(message) {
          return message.severity !== 1;
        });
    }

    if (report.errorCount || report.warningCount) {
      var messages = formatter(report.messages, webpack.resourcePath);

      // Default emitter behavior
      var emitter = report.errorCount ? webpack.emitError : webpack.emitWarning;

      // Force emitError or emitWarning by setting option
      if (options.emitError) {
        emitter = webpack.emitError;
      } else if (options.emitWarning) {
        emitter = webpack.emitWarning;
      }

      if (emitter) {
        emitter(messages);
        if (options.failOnError && report.errorCount) {
          throw new Error('Module failed because of a sasslint error.\n' + messages);
        } else if (options.failOnWarning && report.warningCount) {
          throw new Error('Module failed because of a sasslint warning.\n' + messages);
        }
      } else {
        throw new Error(
          'Your module system doesn\'t support emitWarning.' +
          'Update available? \n' +
          messages
        );
      }
    }
  }

  if (callback) {
    callback(null, input);
  }
}

/**
 * Iternate through files for linter
 *
 * @param {String|Buffer} input Javascript string
 * @param {Object} config scsslint configuration
 * @param {Object} webpack webpack instance
 * @param {Function} callback optional callback for async loader
 * @return {void}
 */
module.exports = function(input, options, webpack, callback) {
  try {
    lint(input, options, webpack, callback);
  } catch(e) {
    callback(e);
  }

  // If directory name is included in the resource path, replace it with .
}<|endoftext|>


<commit_before>var finalhandler = require('finalhandler')
var http = require('http')
var serveStatic = require('serve-static')
var qs = require('querystring')
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('ManyHands');

var serve = serveStatic('.', {"index": ['index.html','index.htm']})

var server = http.createServer(function (req, res){
    //look at dmcc_server line 170

    if(req.url === "/register"){
        var body = "";

        req.on('data', function (chunk){
            body += chunk.toString();
        });

        req.on('end', function(){
            registerReqCB(body, res);
        });
        //If the req url is "register", parse the posted params and add them to central server.
    }

    else if(req.url === "/login"){
        var body = "";

        req.on('data', function (chunk){
            body += chunk.toString();
        });

        req.on('end', function(){
            loginReqCB(body, res);
        });

        //If the req url is "login", parse the posted params and get link from CS.
        //Go to public link to TLD
        //Get file
        //Parse file.
        //Get link to access_token
        //download encrypted access token
        //decrypt access token with password posted.
    }

    else{
        var done = finalhandler(req, res)
        serve(req, res, done)
    }
});

server.listen(8080);

console.log("Server Running on 8080");

function loginReqCB(body, res){
    var postParams = qs.parse(body);

    var username = postParams['uid'];

    getTLDLink(username, res);
}

function registerReqCB(body, res){
    var postParams = qs.parse(body);

    var username = postParams['uid'];
    var tldLink = postParams['link'];

    createUser(username, tldLink, res);

}

function getTLDLink(username, res){
    db.each("SELECT publink FROM user WHERE uid="+username+"",
        function (err, row){
            if (err){
                res.writeHead(400, "NOK", {"Content-Type": "text/html"});
                res.end("Something went terribly awry!");
                console.log("Database error: ", err)
            }
            else{
                onTLDLink(row, res);
            }
        }
    );
}

function onTLDLink(row, res){
    var dbRow = JSON.stringify(row);
    res.writeHead(200, "OK", {"Content-Type": "text/html"});
    res.end(dbRow);

}

function createUser(username, publink, res){
    db.run('INSERT INTO user VALUES (?,?)', username, publink,
        function (err){
            onUserInserted(err, res);
        });

}

function onUserInserted(err, res){
    if(err === null){
        console.log("Successfully registered");
        res.writeHead(200, "OK", {"Content-Type": 'text/html'});
    }
    else{
        console.log("err: ", err);
        res.writeHead(400, "NOK", {"Content-Type": "text/html"})
    }
    res.end("");
}

function checkUserCB(err, dbResp){
    console.log(dbResp);
}

function checkUser(username, callback){
    var json = '';
    db.all("SELECT uid, publink from user where uid="+username+"",function(err, rows){
        if(err){
            console.log("error: "+err);
            callback(err, null);
        }

        else if(rows.length === 0){
            callback(err, null);

        }
        else{
            json = JSON.stringify(rows);
            callback(null, json);
        }
    })

}
<commit_msg>fixed minor typos<commit_after>var finalhandler = require('finalhandler')
var http = require('http')
var serveStatic = require('serve-static')
var qs = require('querystring')
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('ManyHands');

var serve = serveStatic('.', {"index": ['index.html','index.htm']})

function serveDynamic(req, res){
    if(req.url === "/register"){
        var body = "";

        req.on('data', function (chunk){
            body += chunk.toString();
        });

        req.on('end', function(){
            registerReqCB(body, res);
        });
        //If the req url is "register", parse the posted params and add them to central server.
    }

    else if(req.url === "/login"){
        var body = "";

        req.on('data', function (chunk){
            body += chunk.toString();
        });

        req.on('end', function(){
            loginReqCB(body, res);
        });

        //If the req url is "login", parse the posted params and get link from CS.
        //Go to public link to TLD
        //Get file
        //Parse file.
        //Get link to access_token
        //download encrypted access token
        //decrypt access token with password posted.
    }
    else{
        finalhandler(req, res);
    }
}

var server = http.createServer(function (req, res){
    //look at dmcc_server line 170

        serve(req, res, function(){ serveDynamic(req, res)});
});

server.listen(8080);

console.log("Server Running on 8080");

function loginReqCB(body, res){
    var postParams = qs.parse(body);

    var username = postParams['uid'];

    getTLDLink(username, res);
}

function registerReqCB(body, res){
    var postParams = qs.parse(body);

    var username = postParams['uid'];
    var tldLink = postParams['link'];

    createUser(username, tldLink, res);

}

function getTLDLink(username, res){
    db.each("SELECT publink FROM user WHERE uid='"+username+"'",
        function (err, row){
            if (err){
                res.writeHead(400, "NOK", {"Content-Type": "text/html"});
                res.end("Something went terribly awry!");
                console.log("Database error: ", err)
            }
            else{
                onTLDLink(row, res);
            }
        }
    );
}

function onTLDLink(row, res){
    var dbRow = JSON.stringify(row);
    res.writeHead(200, "OK", {"Content-Type": "text/html"});
    res.end(dbRow);

}

function createUser(username, publink, res){
    db.run('INSERT INTO user VALUES (?,?)', username, publink,
        function (err){
            onUserInserted(err, res);
        });

}

function onUserInserted(err, res){
    if(err === null){
        console.log("Successfully registered");
        res.writeHead(200, "OK", {"Content-Type": 'text/html'});
    }
    else{
        console.log("err: ", err);
        res.writeHead(400, "NOK", {"Content-Type": "text/html"})
    }
    res.end("");
}

function checkUserCB(err, dbResp){
    console.log(dbResp);
}

function checkUser(username, callback){
    var json = '';
    db.all("SELECT uid, publink from user where uid="+username+"",function(err, rows){
        if(err){
            console.log("error: "+err);
            callback(err, null);
        }

        else if(rows.length === 0){
            callback(err, null);

        }
        else{
            json = JSON.stringify(rows);
            callback(null, json);
        }
    })

}
<|endoftext|>


<commit_before>import React, { Component, PropTypes } from 'react'

const COMPOSE_DEEPLY = 'deeply'
const COMPOSE_SOFTLY = 'softly'
const DONT_COMPOSE = false

const DEFAULT_OPTIONS = {
  composeTheme: COMPOSE_DEEPLY
}

export default (componentName, localTheme, options = DEFAULT_OPTIONS) => (ThemedComponent) => {
  const { composeTheme: optionComposeTheme } = options
  validateComposeOption(optionComposeTheme)
  return class Themed extends Component {
    static displayName = `Themed ${ThemedComponent.name}`;

    static contextTypes = {
      themr: PropTypes.object
    }

    static propTypes = {
      composeTheme: PropTypes.oneOf([ COMPOSE_DEEPLY, COMPOSE_SOFTLY, DONT_COMPOSE ]),
      theme: PropTypes.object
    }

    static defaultProps = {
      composeTheme: optionComposeTheme
    }

    getThemeNotComposed() {
      if (this.props.theme) return this.props.theme
      if (localTheme) return localTheme
      return this.getContextTheme()
    }

    getContextTheme() {
      return this.context.themr
        ? this.context.themr.theme[componentName]
        : {}
    }

    getTheme() {
      return this.props.composeTheme === COMPOSE_SOFTLY
        ? Object.assign({}, this.getContextTheme(), localTheme, this.props.theme)
        : themeable(themeable(this.getContextTheme(), localTheme), this.props.theme)
    }

    render() {
      return React.createElement(ThemedComponent, {
        ...this.props,
        theme: this.props.composeTheme
          ? this.getTheme()
          : this.getThemeNotComposed()
      })
    }
  }
}

function themeable(style = {}, theme) {
  if (!theme) return style
  return [ ...Object.keys(theme), ...Object.keys(style) ].reduce((result, key) => (
    theme[key] && style[key] && theme[key].indexOf(style[key]) === -1
      ? { ...result, [key]: `${style[key]} ${theme[key]}` }
      : { ...result, [key]: theme[key] || style[key] }
  ), {})
}

function validateComposeOption(composeTheme) {
  if ([ COMPOSE_DEEPLY, COMPOSE_SOFTLY, DONT_COMPOSE ].indexOf(composeTheme) === -1) {
    throw new Error(
      `Invalid composeTheme option for react-css-themr. Valid composition options\
 are ${COMPOSE_DEEPLY}, ${COMPOSE_SOFTLY} and ${DONT_COMPOSE}. The given\
 option was ${composeTheme}`
    )
  }
}
<commit_msg>Remove composeTheme prop spreading<commit_after>import React, { Component, PropTypes } from 'react'

const COMPOSE_DEEPLY = 'deeply'
const COMPOSE_SOFTLY = 'softly'
const DONT_COMPOSE = false

const DEFAULT_OPTIONS = {
  composeTheme: COMPOSE_DEEPLY
}

export default (componentName, localTheme, options = DEFAULT_OPTIONS) => (ThemedComponent) => {
  const { composeTheme: optionComposeTheme } = options
  validateComposeOption(optionComposeTheme)
  return class Themed extends Component {
    static displayName = `Themed ${ThemedComponent.name}`;

    static contextTypes = {
      themr: PropTypes.object
    }

    static propTypes = {
      composeTheme: PropTypes.oneOf([ COMPOSE_DEEPLY, COMPOSE_SOFTLY, DONT_COMPOSE ]),
      theme: PropTypes.object
    }

    static defaultProps = {
      composeTheme: optionComposeTheme
    }

    getThemeNotComposed() {
      if (this.props.theme) return this.props.theme
      if (localTheme) return localTheme
      return this.getContextTheme()
    }

    getContextTheme() {
      return this.context.themr
        ? this.context.themr.theme[componentName]
        : {}
    }

    getTheme() {
      return this.props.composeTheme === COMPOSE_SOFTLY
        ? Object.assign({}, this.getContextTheme(), localTheme, this.props.theme)
        : themeable(themeable(this.getContextTheme(), localTheme), this.props.theme)
    }

    render() {
      const { composeTheme } = this.props
      return React.createElement(ThemedComponent, {
        ...this.props,
        theme: composeTheme
          ? this.getTheme()
          : this.getThemeNotComposed()
      })
    }
  }
}

function themeable(style = {}, theme) {
  if (!theme) return style
  return [ ...Object.keys(theme), ...Object.keys(style) ].reduce((result, key) => (
    theme[key] && style[key] && theme[key].indexOf(style[key]) === -1
      ? { ...result, [key]: `${style[key]} ${theme[key]}` }
      : { ...result, [key]: theme[key] || style[key] }
  ), {})
}

function validateComposeOption(composeTheme) {
  if ([ COMPOSE_DEEPLY, COMPOSE_SOFTLY, DONT_COMPOSE ].indexOf(composeTheme) === -1) {
    throw new Error(
      `Invalid composeTheme option for react-css-themr. Valid composition options\
 are ${COMPOSE_DEEPLY}, ${COMPOSE_SOFTLY} and ${DONT_COMPOSE}. The given\
 option was ${composeTheme}`
    )
  }
}
<|endoftext|>


<commit_before>var Client = require(__dirname + '/../lib/client').Client;
var EventEmitter = require('events').EventEmitter;
var xml2js = require('xml2js');

var statusCodeTable = {
  500: 'Inetnal Server Error',
  404: 'Not Found',
  409: 'Conflict',
  400: 'Bad Request',
  200: 'OK'
};

function ScenariosRunner(options) {
  this.options = options;
}

ScenariosRunner.prototype = new EventEmitter();

ScenariosRunner.prototype.run = function(scenarios) {
  var params = { scenarios: expandScenarios(scenarios) };
  this._process(params);
};

function cloneArray(array) {
  return array.map(function(aElement) {
    if (Array.isArray(aElement))
      return cloneArray(aElement);
    else
      return Object.create(aElement);
  });
};

function expandScenarios(scenarios) {
  if (!Array.isArray(scenarios))
    scenarios = [scenarios];

  var expanded = [];
  scenarios.forEach(function(scenario) {
    expanded = expanded.concat(expandScenario(scenario));
  });
  return expanded;
};
ScenariosRunner.expandScenarios =
  ScenarioRunner.expandScenarios = expandScenarios;

function expandScenario(scenario) {
  if (!scenario.requests)
    scenario = { requests: scenario };

  if (scenario.setup) {
    if (!Array.isArray(scenario.setup))
      scenario.setup = [scenario.setup];
  } else {
    scenario.setup = [];
  }

  if (scenario.teardown) {
    if (!Array.isArray(scenario.teardown))
      scenario.teardown = [scenario.teardown];
  } else {
    scenario.teardown = [];
  }

  var scenarios = [];
  scenario.requests.forEach(function(requests) {
    if (!Array.isArray(requests))
      requests = [requests];

    var expanded = Object.create(scenario);
    expanded.name = requests[0].name;
    expanded.requests = cloneArray(scenario.setup)
                          .concat(requests)
                          .concat(cloneArray(scenario.teardown));
    scenarios.push(expanded);
  });

  // make request names unique
  var names = {};
  scenarios.forEach(function(scenario) {
    scenario.requests.forEach(function(request) {
      request.name = scenario.name + ': ' + request.name;

      var count = 1;
      var name = request.name;
      while (name in names) {
        name = request.name + '-' + count++;
      }
      request.name = name;
      names[name] = true;
    });
  });

  return scenarios;
};
ScenariosRunner.expandScenario =
  ScenarioRunner.expandScenario = expandScenario;

ScenariosRunner.prototype._process = function(params) {
  if (!params.start) params.start = Date.now();
  var scenario = params.scenarios.shift();
  var self = this;

  var runner = new ScenarioRunner(this.options);

  runner.on('error:fatal', function(event) {
    self.emit('error:fatal', event);
  });

  runner.on('start', function(event) {
    self.emit('scenario', { runner: runner,
                            scenario: event.scenario });

    runner.on('end', function(event) {
      if (params.scenarios.length) {
        if (self.options.scenarioInterval && !event.skipped) {
          self.emit('wait', { message: 'waiting ' + self.options.scenarioInterval + 'msec for the next scenario...' });
          setTimeout(function() { self._process(params); },
                     self.options.scenarioInterval);
        } else {
          self._process(params);
        }
      } else {
        var elapsedTime = Date.now() - params.start;
        self.emit('end', { elapsedTime: elapsedTime });
      }
    });
  });

  runner.run(scenario);
};

function ScenarioRunner(options) {
  this.client = new Client(options);
  this.options = options;
  if (options.documentEndpoint)
    this.client.docEndpoint = options.documentEndpoint;
}

ScenarioRunner.prototype = new EventEmitter();

ScenarioRunner.prototype.run = function(scenario) {
  if (this.options.ignoreDirtyEnvironment) {
    this._process(scenario);
  } else {
    var self = this;
    this.client.assertNoDomain(function(error) {
      if (error)
        self.emit('error:fatal', { error: error });
      else
        self._process(scenario);
    });
  }
};

ScenarioRunner.prototype.assertNoDomain = function(callback) {
  this.client.assertNoDomain(function(error) {
    callback();
  });
};

ScenarioRunner.prototype.initializeScenario = function(scenario) {
  if (!scenario.requests)
    scenario = { requests: scenario };

  scenario.toBeProcessedRequests = scenario.requests.slice(0);
  scenario.start = Date.now();
  scenario.processed = {};

  return scenario;
};

ScenarioRunner.prototype.shouldAccept = function(name) {
  if (!this.options.accept)
    return true;

  if (!this._acceptFilter) {
    this._acceptFilter = this.options.accept;
    if (typeof this._acceptFilter == 'string' &&
        /^\/(.+\)/([gim]*)/.test(this._acceptFilter)) {
      this._acceptFilter = new RegExp(RegExp.$1, RegExp.$2 || '');
    }
  }

  if (typeof this._acceptFilter == 'string')
    return name.indexOf(this._acceptFilter) > -1;
  else
    return this._acceptFilter.test(name);
};

ScenarioRunner.prototype.shouldReject = function(name) {
  if (!this.options.reject)
    return false;

  if (!this._rejectFilter) {
    this._rejectFilter = this.options.reject;
    if (typeof this._rejectFilter == 'string' &&
        /^\/(.+\)/([gim]*)/.test(this._rejectFilter)) {
      this._rejectFilter = new RegExp(RegExp.$1, RegExp.$2 || '');
    }
  }

  if (typeof this._rejectFilter == 'string')
    return name.indexOf(this._rejectFilter) > -1;
  else
    return this._rejectFilter.test(name);
};

ScenarioRunner.prototype._process = function(scenario, callback) {
  if (!scenario.toBeProcessedRequests) {
    scenario = this.initializeScenario(scenario);
    this.emit('start', { scenario: scenario });
  }

  var request = scenario.toBeProcessedRequests.shift();
  var self = this;
  var skipped = false;
  function processNext() {
    if (scenario.toBeProcessedRequests.length) {
      self._process(scenario, callback);
    } else {
      var elapsedTime = Date.now() - scenario.start;
      var event = {
        elapsedTime: elapsedTime,
        scenario: scenario,
        skipped: skipped
      };
      self.emit('end', event);
    }
  }

  var name = request.name;

  if (!this.shoudlAccept(name) || this.shouldReject(name)) {
    skipped = true;
    return processNext();
  }

  var count = 1;
  while (name in scenario.processed) {
    name = request.name + count++;
  }

  this.emit('request:start', { scenario: scenario, request: request });

  this.client.rawConfigurationRequest(request.params.Action, request.params, function(error, response) {
    if (error) response = error;

    var statusCode = response.StatusCode;
    if (statusCode == 400) {
      var parser = new xml2js.Parser({ explicitRoot: true });
      parser.parseString(response.Body, function(error, result) {
        var errorCode = result.ErrorResponse.Error.Code;
        if (errorCode === 'Throttling') {
          self.emit('error:throttling');
        }
      });
    }
    if (!statusCodeTable[statusCode]) {
      self.emit('error:status_unknown', { statusCode: statusCode });
      if (callback)
        callback(statusCode, null);
      return;
    }

    var output = '';
    output += 'HTTP/1.1 ' + statusCode + ' ' + statusCodeTable[statusCode] + '\r\n';
    for (var key in response.Headers) {
      output += key + ': ' + response.Headers[key] + '\r\n';
    };
    output += '\r\n';
    output += response.Body.toString();

    request.response = output;
    self.emit('request:end', { scenario: scenario, request: request });
    if (self.options.interval) {
      self.emit('request:wait', { message: 'waiting ' + self.options.interval + 'msec for the next request...' });
      setTimeout(processNext, self.options.interval);
    } else {
      processNext();
    }
  });
};

function toSafeName(name) {
  return name
           .replace(/[^a-zA-Z0-9]+/g, '-')
           .replace(/-$/, '');
};
ScenariosRunner.toSafeName =
  ScenarioRunner.toSafeName = toSafeName;

function Response(source) {
  source = source.split('\r\n\r\n');
  this.rawHeaders = source[0];
  this.rawBody = source.slice(1).join('\r\n\r\n');
}
Response.prototype = {
  get body() {
    if (!this._body) {
      if (/^\s*</.test(this.rawBody)) {
        this._body = this._XMLStringToJSON(this.rawBody);
      } else {
        try {
          this._body = JSON.parse(this.rawBody);
        } catch(error) {
          this._body = this.rawBody;
        }
      }
    }
    return this._body;
  },
  _XMLStringToJSON: function(xml) {
    var parser = new xml2js.Parser({
                   explicitRoot: true
                 });
    var json;
    parser.addListener('end', function(result) {
      json = result;
    });
    try {
      parser.parseString(xml);
    } catch (e) {
      console.log(xml);
      throw e;
    }
    return json;
  },

  get sortedBody() {
    if (!this._sortedBody) {
      if (this.body && typeof this.body == 'object')
        this._sortedBody = this._toSortedJSON(this.body, true);
      else
        this._sortedBody = this.body;
    }
    return this._sortedBody;
  },
  _toSortedJSON: function(fragment, doSort) {
    switch (typeof fragment) {
      default:
        return fragment;
      case 'object':
        var format = {};
        var keys = Object.keys(fragment);
        if (doSort) keys.sort();
        keys.forEach(function(key) {
          if (!fragment.hasOwnProperty(key))
            return;
          var doSort = this._orderedContainers.indexOf(key) < 0;
          format[key] = this._toSortedJSON(fragment[key], doSort);
        }, this);
        return format;
    }
  },
  _orderedContainers: [
    'DomainStatusList',
    'IndexFields',
    'FieldNames'
  ],

  get normalizedBody() {
    if (!this._normalizedBody)
      this._normalizedBody = this._normalize(this.sortedBody);
    return this._normalizedBody;
  },
  _normalize: function(fragment) {
    switch (typeof fragment) {
      default:
        return fragment;
      case 'object':
        var format = {};
        Object.keys(fragment).forEach(function(key) {
          if (!fragment.hasOwnProperty(key))
            return;

          var value = fragment[key];
          var normalized;
          switch (key) {
            case 'RequestId':
              normalized = '%REQUEST_ID%';
              break;

            case 'DomainId':
              normalized = value.replace(/^.+\//, '%DOMAIN_ID%/');
              break;

            case 'Endpoint':
              return; // this doesn't appear in ACS's response!

            case 'Arn':
              normalized = value.replace(/^(arn:aws:cs:us-east-1:)[^:]+(:[^\/]+\/[^\/]+)$/, '$1%DOMAIN_ID%$2');
              break;

            case 'CreationDate':
              normalized = '%CREATION_DATE%';
              break;

            case 'UpdateDate':
              normalized = '%UPDATE_DATE%';
              break;

            case 'UpdateVersion':
              normalized = '%UPDATE_VERSION%';

            case 'Processing':
              normalized = '%PROCESSING_STATE%';
              break;

            case 'State':
              if (value == 'Active' || value == 'RequiresIndexDocuments')
                normalized = '%ACTIVE_OR_REQUIRES_INDEX_DOCUMENTS%';
              break;

            default:
              normalized = this._normalize(value);
              break;
          }
          format[key] = normalized;
        }, this);
        return format;
    }
  },

  get normalized() {
    if (!this._normalized)
      this._normalized = {
        status: this.rawHeaders.split('\r\n')[0],
        body: this.normalizedBody
      };
    return this._normalized;
  },

  equals: function(anotherResponse) {
    if (!anotherResponse) return false;
    var normalizedSelf = JSON.stringify(this.normalized);
    var normalizedAnother = JSON.stringify(anotherResponse.normalized);
    return normalizedSelf == normalizedAnother;
  }
};

exports.ScenariosRunner = ScenariosRunner;
exports.ScenarioRunner = ScenarioRunner;
exports.Response = Response;
<commit_msg>Fix broken regexp<commit_after>var Client = require(__dirname + '/../lib/client').Client;
var EventEmitter = require('events').EventEmitter;
var xml2js = require('xml2js');

var statusCodeTable = {
  500: 'Inetnal Server Error',
  404: 'Not Found',
  409: 'Conflict',
  400: 'Bad Request',
  200: 'OK'
};

function ScenariosRunner(options) {
  this.options = options;
}

ScenariosRunner.prototype = new EventEmitter();

ScenariosRunner.prototype.run = function(scenarios) {
  var params = { scenarios: expandScenarios(scenarios) };
  this._process(params);
};

function cloneArray(array) {
  return array.map(function(aElement) {
    if (Array.isArray(aElement))
      return cloneArray(aElement);
    else
      return Object.create(aElement);
  });
};

function expandScenarios(scenarios) {
  if (!Array.isArray(scenarios))
    scenarios = [scenarios];

  var expanded = [];
  scenarios.forEach(function(scenario) {
    expanded = expanded.concat(expandScenario(scenario));
  });
  return expanded;
};
ScenariosRunner.expandScenarios =
  ScenarioRunner.expandScenarios = expandScenarios;

function expandScenario(scenario) {
  if (!scenario.requests)
    scenario = { requests: scenario };

  if (scenario.setup) {
    if (!Array.isArray(scenario.setup))
      scenario.setup = [scenario.setup];
  } else {
    scenario.setup = [];
  }

  if (scenario.teardown) {
    if (!Array.isArray(scenario.teardown))
      scenario.teardown = [scenario.teardown];
  } else {
    scenario.teardown = [];
  }

  var scenarios = [];
  scenario.requests.forEach(function(requests) {
    if (!Array.isArray(requests))
      requests = [requests];

    var expanded = Object.create(scenario);
    expanded.name = requests[0].name;
    expanded.requests = cloneArray(scenario.setup)
                          .concat(requests)
                          .concat(cloneArray(scenario.teardown));
    scenarios.push(expanded);
  });

  // make request names unique
  var names = {};
  scenarios.forEach(function(scenario) {
    scenario.requests.forEach(function(request) {
      request.name = scenario.name + ': ' + request.name;

      var count = 1;
      var name = request.name;
      while (name in names) {
        name = request.name + '-' + count++;
      }
      request.name = name;
      names[name] = true;
    });
  });

  return scenarios;
};
ScenariosRunner.expandScenario =
  ScenarioRunner.expandScenario = expandScenario;

ScenariosRunner.prototype._process = function(params) {
  if (!params.start) params.start = Date.now();
  var scenario = params.scenarios.shift();
  var self = this;

  var runner = new ScenarioRunner(this.options);

  runner.on('error:fatal', function(event) {
    self.emit('error:fatal', event);
  });

  runner.on('start', function(event) {
    self.emit('scenario', { runner: runner,
                            scenario: event.scenario });

    runner.on('end', function(event) {
      if (params.scenarios.length) {
        if (self.options.scenarioInterval && !event.skipped) {
          self.emit('wait', { message: 'waiting ' + self.options.scenarioInterval + 'msec for the next scenario...' });
          setTimeout(function() { self._process(params); },
                     self.options.scenarioInterval);
        } else {
          self._process(params);
        }
      } else {
        var elapsedTime = Date.now() - params.start;
        self.emit('end', { elapsedTime: elapsedTime });
      }
    });
  });

  runner.run(scenario);
};

function ScenarioRunner(options) {
  this.client = new Client(options);
  this.options = options;
  if (options.documentEndpoint)
    this.client.docEndpoint = options.documentEndpoint;
}

ScenarioRunner.prototype = new EventEmitter();

ScenarioRunner.prototype.run = function(scenario) {
  if (this.options.ignoreDirtyEnvironment) {
    this._process(scenario);
  } else {
    var self = this;
    this.client.assertNoDomain(function(error) {
      if (error)
        self.emit('error:fatal', { error: error });
      else
        self._process(scenario);
    });
  }
};

ScenarioRunner.prototype.assertNoDomain = function(callback) {
  this.client.assertNoDomain(function(error) {
    callback();
  });
};

ScenarioRunner.prototype.initializeScenario = function(scenario) {
  if (!scenario.requests)
    scenario = { requests: scenario };

  scenario.toBeProcessedRequests = scenario.requests.slice(0);
  scenario.start = Date.now();
  scenario.processed = {};

  return scenario;
};

ScenarioRunner.prototype.shouldAccept = function(name) {
  if (!this.options.accept)
    return true;

  if (!this._acceptFilter) {
    this._acceptFilter = this.options.accept;
    if (typeof this._acceptFilter == 'string' &&
        /^\/(.+)\/([gim]*)/.test(this._acceptFilter)) {
      this._acceptFilter = new RegExp(RegExp.$1, RegExp.$2 || '');
    }
  }

  if (typeof this._acceptFilter == 'string')
    return name.indexOf(this._acceptFilter) > -1;
  else
    return this._acceptFilter.test(name);
};

ScenarioRunner.prototype.shouldReject = function(name) {
  if (!this.options.reject)
    return false;

  if (!this._rejectFilter) {
    this._rejectFilter = this.options.reject;
    if (typeof this._rejectFilter == 'string' &&
        /^\/(.+\)/([gim]*)/.test(this._rejectFilter)) {
      this._rejectFilter = new RegExp(RegExp.$1, RegExp.$2 || '');
    }
  }

  if (typeof this._rejectFilter == 'string')
    return name.indexOf(this._rejectFilter) > -1;
  else
    return this._rejectFilter.test(name);
};

ScenarioRunner.prototype._process = function(scenario, callback) {
  if (!scenario.toBeProcessedRequests) {
    scenario = this.initializeScenario(scenario);
    this.emit('start', { scenario: scenario });
  }

  var request = scenario.toBeProcessedRequests.shift();
  var self = this;
  var skipped = false;
  function processNext() {
    if (scenario.toBeProcessedRequests.length) {
      self._process(scenario, callback);
    } else {
      var elapsedTime = Date.now() - scenario.start;
      var event = {
        elapsedTime: elapsedTime,
        scenario: scenario,
        skipped: skipped
      };
      self.emit('end', event);
    }
  }

  var name = request.name;

  if (!this.shoudlAccept(name) || this.shouldReject(name)) {
    skipped = true;
    return processNext();
  }

  var count = 1;
  while (name in scenario.processed) {
    name = request.name + count++;
  }

  this.emit('request:start', { scenario: scenario, request: request });

  this.client.rawConfigurationRequest(request.params.Action, request.params, function(error, response) {
    if (error) response = error;

    var statusCode = response.StatusCode;
    if (statusCode == 400) {
      var parser = new xml2js.Parser({ explicitRoot: true });
      parser.parseString(response.Body, function(error, result) {
        var errorCode = result.ErrorResponse.Error.Code;
        if (errorCode === 'Throttling') {
          self.emit('error:throttling');
        }
      });
    }
    if (!statusCodeTable[statusCode]) {
      self.emit('error:status_unknown', { statusCode: statusCode });
      if (callback)
        callback(statusCode, null);
      return;
    }

    var output = '';
    output += 'HTTP/1.1 ' + statusCode + ' ' + statusCodeTable[statusCode] + '\r\n';
    for (var key in response.Headers) {
      output += key + ': ' + response.Headers[key] + '\r\n';
    };
    output += '\r\n';
    output += response.Body.toString();

    request.response = output;
    self.emit('request:end', { scenario: scenario, request: request });
    if (self.options.interval) {
      self.emit('request:wait', { message: 'waiting ' + self.options.interval + 'msec for the next request...' });
      setTimeout(processNext, self.options.interval);
    } else {
      processNext();
    }
  });
};

function toSafeName(name) {
  return name
           .replace(/[^a-zA-Z0-9]+/g, '-')
           .replace(/-$/, '');
};
ScenariosRunner.toSafeName =
  ScenarioRunner.toSafeName = toSafeName;

function Response(source) {
  source = source.split('\r\n\r\n');
  this.rawHeaders = source[0];
  this.rawBody = source.slice(1).join('\r\n\r\n');
}
Response.prototype = {
  get body() {
    if (!this._body) {
      if (/^\s*</.test(this.rawBody)) {
        this._body = this._XMLStringToJSON(this.rawBody);
      } else {
        try {
          this._body = JSON.parse(this.rawBody);
        } catch(error) {
          this._body = this.rawBody;
        }
      }
    }
    return this._body;
  },
  _XMLStringToJSON: function(xml) {
    var parser = new xml2js.Parser({
                   explicitRoot: true
                 });
    var json;
    parser.addListener('end', function(result) {
      json = result;
    });
    try {
      parser.parseString(xml);
    } catch (e) {
      console.log(xml);
      throw e;
    }
    return json;
  },

  get sortedBody() {
    if (!this._sortedBody) {
      if (this.body && typeof this.body == 'object')
        this._sortedBody = this._toSortedJSON(this.body, true);
      else
        this._sortedBody = this.body;
    }
    return this._sortedBody;
  },
  _toSortedJSON: function(fragment, doSort) {
    switch (typeof fragment) {
      default:
        return fragment;
      case 'object':
        var format = {};
        var keys = Object.keys(fragment);
        if (doSort) keys.sort();
        keys.forEach(function(key) {
          if (!fragment.hasOwnProperty(key))
            return;
          var doSort = this._orderedContainers.indexOf(key) < 0;
          format[key] = this._toSortedJSON(fragment[key], doSort);
        }, this);
        return format;
    }
  },
  _orderedContainers: [
    'DomainStatusList',
    'IndexFields',
    'FieldNames'
  ],

  get normalizedBody() {
    if (!this._normalizedBody)
      this._normalizedBody = this._normalize(this.sortedBody);
    return this._normalizedBody;
  },
  _normalize: function(fragment) {
    switch (typeof fragment) {
      default:
        return fragment;
      case 'object':
        var format = {};
        Object.keys(fragment).forEach(function(key) {
          if (!fragment.hasOwnProperty(key))
            return;

          var value = fragment[key];
          var normalized;
          switch (key) {
            case 'RequestId':
              normalized = '%REQUEST_ID%';
              break;

            case 'DomainId':
              normalized = value.replace(/^.+\//, '%DOMAIN_ID%/');
              break;

            case 'Endpoint':
              return; // this doesn't appear in ACS's response!

            case 'Arn':
              normalized = value.replace(/^(arn:aws:cs:us-east-1:)[^:]+(:[^\/]+\/[^\/]+)$/, '$1%DOMAIN_ID%$2');
              break;

            case 'CreationDate':
              normalized = '%CREATION_DATE%';
              break;

            case 'UpdateDate':
              normalized = '%UPDATE_DATE%';
              break;

            case 'UpdateVersion':
              normalized = '%UPDATE_VERSION%';

            case 'Processing':
              normalized = '%PROCESSING_STATE%';
              break;

            case 'State':
              if (value == 'Active' || value == 'RequiresIndexDocuments')
                normalized = '%ACTIVE_OR_REQUIRES_INDEX_DOCUMENTS%';
              break;

            default:
              normalized = this._normalize(value);
              break;
          }
          format[key] = normalized;
        }, this);
        return format;
    }
  },

  get normalized() {
    if (!this._normalized)
      this._normalized = {
        status: this.rawHeaders.split('\r\n')[0],
        body: this.normalizedBody
      };
    return this._normalized;
  },

  equals: function(anotherResponse) {
    if (!anotherResponse) return false;
    var normalizedSelf = JSON.stringify(this.normalized);
    var normalizedAnother = JSON.stringify(anotherResponse.normalized);
    return normalizedSelf == normalizedAnother;
  }
};

exports.ScenariosRunner = ScenariosRunner;
exports.ScenarioRunner = ScenarioRunner;
exports.Response = Response;
<|endoftext|>


<commit_before>// --
// Core.UI.Popup.js - provides functionality to open popup windows
// Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
// --
// This software comes with ABSOLUTELY NO WARRANTY. For details, see
// the enclosed file COPYING for license information (AGPL). If you
// did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
// --

"use strict";

var Core = Core || {};
Core.UI = Core.UI || {};

/**
 * @namespace
 * @exports TargetNS as Core.UI.Popup
 * @description
 *      Popup windows
 */
Core.UI.Popup = (function (TargetNS) {
    var OpenPopups = {},
        PopupProfiles,
        PopupDefaultProfile = 'Default',
        RegisterPopupTimeOut = 1000;

    if (!Core.Debug.CheckDependency('Core.UI.Dialog', 'Core.Config', 'Core.Config')) {
        return;
    }

    PopupProfiles = {
        'Default': {
            WindowURLParams: "dependent=yes,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no",
            Left:            100,
            Top:             100,
            Width:           1000,
            Height:          700
        }
    };

    /**
     * @function
     * @private
     * @description Check which popup window are still open
     */
    function CheckOpenPopups() {
        $.each(OpenPopups, function (Key, Value) {
            if (Value.closed) {
                delete OpenPopups[Key];
            }
        });
    }

    /**
     * @function
     * @private
     * @param {string} Type The type of a window, e.g. 'Action'
     * @description Get window object by popup type
     */
    function GetPopupObjectByType(Type) {
        return OpenPopups[Type];
    }

    /**
     * @function
     * @description
     *      Adds a popup profile.
     * @param {String} Key      Name of the Profile (UID).
     * @param {String} Value    Profile string as expected by window.open(),
     *          e. g. "dependent=yes,height=700,left=100,top=100,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=1000"
     * @return nothing
     */
    TargetNS.ProfileAdd = function (Key, Values) {
        PopupProfiles[Key] = Values;
    };

    /**
     * @function
     * @description
     *      Get the list of registered popup profiles.
     * @return {Object} PopupProfiles object.
     */
    TargetNS.ProfileList = function () {
        return PopupProfiles;
    };

    /**
     * @function
     * @description
     *      Register the pop-up event for a window.
     * @return nothing
     */
    TargetNS.RegisterPopupEvent = function () {
        $(window).bind('Popup', function (Event, Type, Param) {
            if (Type && typeof Type !== 'undefined') {
                if (Type === 'Reload') {
                    window.location.reload();
                }
                else if (Type === 'URL') {
                    if (Param && typeof Param.URL !== 'undefined') {
                        window.location.href = Param.URL;
                    }
                }
            }
        });
    };

    /**
     * @function
     * @description
     *      This function starts the pop-up event.
     * @param {String} Type The event type that will be launched
     * @param {Object} Param The element that contain information about the new screen address
     * @return nothing
     */
    TargetNS.FirePopupEvent = function (Type, Param) {
        $(window).unbind('beforeunload.Popup').unbind('unload.Popup');
        $(window).trigger('Popup', [Type, Param]);
    };

    /**
     * @function
     * @description
     *      This review if some popup windows are open, then try to send a warning.
     * @return nothing or a string for a warning sign.
     */
    TargetNS.CheckPopupsOnUnload = function () {
        var Size = 0;
        CheckOpenPopups();
        $.each(OpenPopups, function (Key, Value) {
            // IE(7) treats windows in new tabs (opened with right-click) also as popups
            // Therefore we check if the popup is a real OTRS popup.
            // IE9 can't read the WindowType property from the window object,
            // so we check for the correct popup window name now.
            if (Value.name.match(/OTRSPopup_.+/)) {
                Size++;
            }
        });
        if (Size) {
            return Core.Config.Get('PopupLeaveParentWindowMsg');
        }
    };

    /**
     * @function
     * @description
     *      This function close the active popup windows.
     * @return nothing
     */
    TargetNS.ClosePopupsOnUnload = function () {
        CheckOpenPopups();
        $.each(OpenPopups, function (Key, Value) {
            // IE(7) treats windows in new tabs (opened with right-click) also as popups
            // Therefore we check if the popup is a real OTRS popup.
            // IE9 can't read the WindowType property from the window object,
            // so we check for the correct popup window name now.
            if (Value.name.match(/OTRSPopup_.+/)) {
                TargetNS.ClosePopup(Value);
            }
        });
    };

    /**
     * @function
     * @description
     *      This function set the type for a popup window.
     * @param {Object} WindowObject The element is a javascript window object
     * @return nothing
     */
    TargetNS.RegisterPopupAtParentWindow = function (WindowObject) {
        var TypeRegEx = /OTRSPopup_([^_]+)_.*/.exec(WindowObject.name),
            Type = RegExp.$1;
        if (typeof OpenPopups[Type] === 'undefined') {
            OpenPopups[Type] = WindowObject;
        }
        else {
            if (OpenPopups[Type] !== WindowObject) {
                OpenPopups[Type] = WindowObject;
            }
        }
    };

    /**
     * @function
     * @description
     *      This function set a timeout and after that try to register a popup at a parent window.
     * @return nothing
     */
    TargetNS.InitRegisterPopupAtParentWindow = function () {
        window.setTimeout(function () {
            if (window.name.match(/OTRSPopup_.+/) &&
                window.opener &&
                window.opener.Core &&
                window.opener.Core.UI &&
                window.opener.Core.UI.Popup
            ) {
                try {
                    window.opener.Core.UI.Popup.RegisterPopupAtParentWindow(window);
                }
                catch (Error) {}
            }
            Core.UI.Popup.InitRegisterPopupAtParentWindow();
        }, RegisterPopupTimeOut);
    };

    /**
     * @function
     * @description
     *      Get window object by popup type.
     * @param {String} Type The type of a window, e.g. 'Action'
     * @return {Object} The window object of the popup or undefined
     */
    TargetNS.GetPopupObject = function (Type) {
        return GetPopupObjectByType(Type);
    };

    /**
     * @function
     * @description
     *      This function resizes an opened window.
     * @param {String} Type The type of a window, e.g. 'Action'
     * @param {String} Width Width in pixels
     * @param {String} Height Height in pixels
     * @return nothing
     */
    TargetNS.Resize = function (Type, Width, Height) {
        var Object = GetPopupObjectByType(Type);
        if (typeof Object !== 'undefined') {
            Object.resizeTo(Width, Height);
        }
    };

    /**
     * @function
     * @description
     *      This function opens a popup window. Every popup is of a specific type and there can only be one window of a type at a time.
     * @param {String} URL The URL to be open in the new window
     * @param {String} Type The type of a window, e.g. 'Action'
     * @param {String} Profile The profile of a window, which defines the window parameters. Optional, default is 'Default'
     * @return nothing
     */
    TargetNS.OpenPopup = function (URL, Type, Profile) {
        var PopupObject,
            PopupProfile,
            NewWindow,
            WindowName,
            ConfirmClosePopup = true,
            PopupFeatures,
            SessionData,
            SessionStringURL = '';

        CheckOpenPopups();
        if (URL) {
            PopupObject = GetPopupObjectByType(Type);

            if (typeof PopupObject !== 'undefined') {
                ConfirmClosePopup = window.confirm(Core.Config.Get('PopupAlreadyOpenMsg'));
                if (ConfirmClosePopup) {
                    TargetNS.ClosePopup(PopupObject);
                }
            }

            // Only load new popup if the user accepted that the old popup is closed
            if (ConfirmClosePopup) {
                PopupProfile = PopupProfiles[Profile] ? Profile : PopupDefaultProfile;
                /*
                 * Special treatment for the window name. At least in some browsers, window names
                 *  are global, so only one popup window with a particular name may exist across
                 *  all browser tabs. To avoid conflicts with that, we use 'randomized' names
                 *  by including the current time in the name string. This name is also needed
                 *  to save the Type parameter.
                 */
                WindowName = 'OTRSPopup_' + Type + '_' + Date.parse(new Date());
                PopupFeatures = PopupProfiles[PopupProfile].WindowURLParams;
                // Get the position of the current screen on browsers which support it (non-IE) and
                //  use it to open the popup on the same screen
                PopupFeatures += ',left=' + ((window.screen.left || 0) + PopupProfiles[PopupProfile].Left);
                PopupFeatures += ',top=' + ((window.screen.top || 0) + PopupProfiles[PopupProfile].Top);
                PopupFeatures += ',width=' + PopupProfiles[PopupProfile].Width;
                PopupFeatures += ',height=' + PopupProfiles[PopupProfile].Height;

                // append SessionID (if needed)
                SessionData = Core.App.GetSessionInformation();
                if ( !$.isEmptyObject(SessionData) && URL.indexOf(SessionData[Core.Config.Get('SessionName')]) === -1 ) {
                    URL += ';' + encodeURIComponent(Core.Config.Get('SessionName')) + '=' + encodeURIComponent(SessionData[Core.Config.Get('SessionName')]);
                }

                NewWindow = window.open(URL, WindowName, PopupFeatures);

                // check for popup blockers.
                // currently, popup windows cannot easily be detected in chrome, because it will
                //      load the entire content in an invisible window.
                if (!NewWindow ||  NewWindow.closed || typeof NewWindow.closed === 'undefined') {
                    window.alert(Core.Config.Get('PopupBlockerMsg'));
                }
                else {
                    OpenPopups[Type] = NewWindow;
                }
            }
        }
    };

    /**
     * @function
     * @description
     *      Checks if there are open popups on the page.
     * @return
     *      {Boolean} True or false.
     */
    TargetNS.HasOpenPopups = function() {
        var HasOpenPopups = false,
            Popup;

        CheckOpenPopups();
        for (Popup in OpenPopups) {
            if (OpenPopups.hasOwnProperty(Popup)) {
                HasOpenPopups = true;
                break;
            }
         }

        return HasOpenPopups;
    };

    /**
     * @function
     * @description
     *      This function closes a opened popup.
     * @param {String or Object} Popup The type of a popup or the window object
     * @return nothing
     */
    TargetNS.ClosePopup = function (Popup) {
        if (typeof Popup === 'string') {
            Popup = GetPopupObjectByType(Popup);
        }
        if (typeof Popup !== 'undefined') {
            Popup.close();
            CheckOpenPopups();
        }
    };

    /**
     * @function
     * @description
     *      The init function.
     * @return nothing
     */
    TargetNS.Init = function () {
        $(window).bind('beforeunload.Popup', function () {
            return Core.UI.Popup.CheckPopupsOnUnload();
        });
        $(window).bind('unload.Popup', function () {
            Core.UI.Popup.ClosePopupsOnUnload();
        });
        Core.UI.Popup.RegisterPopupEvent();

        // if this window is a popup itself, register another function
        if (window.name.match(/OTRSPopup_.+/) && window.opener !== null) {
            Core.UI.Popup.InitRegisterPopupAtParentWindow();
            $('.CancelClosePopup').bind('click', function () {
                window.close();
            });
            $('.UndoClosePopup').bind('click', function () {
                var RedirectURL = $(this).attr('href');
                window.opener.Core.UI.Popup.FirePopupEvent('URL', { URL: RedirectURL });
                window.close();
            });
        }
    };

    return TargetNS;
}(Core.UI.Popup || {}));
<commit_msg>Modified check for session data.<commit_after>// --
// Core.UI.Popup.js - provides functionality to open popup windows
// Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
// --
// This software comes with ABSOLUTELY NO WARRANTY. For details, see
// the enclosed file COPYING for license information (AGPL). If you
// did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
// --

"use strict";

var Core = Core || {};
Core.UI = Core.UI || {};

/**
 * @namespace
 * @exports TargetNS as Core.UI.Popup
 * @description
 *      Popup windows
 */
Core.UI.Popup = (function (TargetNS) {
    var OpenPopups = {},
        PopupProfiles,
        PopupDefaultProfile = 'Default',
        RegisterPopupTimeOut = 1000;

    if (!Core.Debug.CheckDependency('Core.UI.Dialog', 'Core.Config', 'Core.Config')) {
        return;
    }

    PopupProfiles = {
        'Default': {
            WindowURLParams: "dependent=yes,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no",
            Left:            100,
            Top:             100,
            Width:           1000,
            Height:          700
        }
    };

    /**
     * @function
     * @private
     * @description Check which popup window are still open
     */
    function CheckOpenPopups() {
        $.each(OpenPopups, function (Key, Value) {
            if (Value.closed) {
                delete OpenPopups[Key];
            }
        });
    }

    /**
     * @function
     * @private
     * @param {string} Type The type of a window, e.g. 'Action'
     * @description Get window object by popup type
     */
    function GetPopupObjectByType(Type) {
        return OpenPopups[Type];
    }

    /**
     * @function
     * @description
     *      Adds a popup profile.
     * @param {String} Key      Name of the Profile (UID).
     * @param {String} Value    Profile string as expected by window.open(),
     *          e. g. "dependent=yes,height=700,left=100,top=100,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,width=1000"
     * @return nothing
     */
    TargetNS.ProfileAdd = function (Key, Values) {
        PopupProfiles[Key] = Values;
    };

    /**
     * @function
     * @description
     *      Get the list of registered popup profiles.
     * @return {Object} PopupProfiles object.
     */
    TargetNS.ProfileList = function () {
        return PopupProfiles;
    };

    /**
     * @function
     * @description
     *      Register the pop-up event for a window.
     * @return nothing
     */
    TargetNS.RegisterPopupEvent = function () {
        $(window).bind('Popup', function (Event, Type, Param) {
            if (Type && typeof Type !== 'undefined') {
                if (Type === 'Reload') {
                    window.location.reload();
                }
                else if (Type === 'URL') {
                    if (Param && typeof Param.URL !== 'undefined') {
                        window.location.href = Param.URL;
                    }
                }
            }
        });
    };

    /**
     * @function
     * @description
     *      This function starts the pop-up event.
     * @param {String} Type The event type that will be launched
     * @param {Object} Param The element that contain information about the new screen address
     * @return nothing
     */
    TargetNS.FirePopupEvent = function (Type, Param) {
        $(window).unbind('beforeunload.Popup').unbind('unload.Popup');
        $(window).trigger('Popup', [Type, Param]);
    };

    /**
     * @function
     * @description
     *      This review if some popup windows are open, then try to send a warning.
     * @return nothing or a string for a warning sign.
     */
    TargetNS.CheckPopupsOnUnload = function () {
        var Size = 0;
        CheckOpenPopups();
        $.each(OpenPopups, function (Key, Value) {
            // IE(7) treats windows in new tabs (opened with right-click) also as popups
            // Therefore we check if the popup is a real OTRS popup.
            // IE9 can't read the WindowType property from the window object,
            // so we check for the correct popup window name now.
            if (Value.name.match(/OTRSPopup_.+/)) {
                Size++;
            }
        });
        if (Size) {
            return Core.Config.Get('PopupLeaveParentWindowMsg');
        }
    };

    /**
     * @function
     * @description
     *      This function close the active popup windows.
     * @return nothing
     */
    TargetNS.ClosePopupsOnUnload = function () {
        CheckOpenPopups();
        $.each(OpenPopups, function (Key, Value) {
            // IE(7) treats windows in new tabs (opened with right-click) also as popups
            // Therefore we check if the popup is a real OTRS popup.
            // IE9 can't read the WindowType property from the window object,
            // so we check for the correct popup window name now.
            if (Value.name.match(/OTRSPopup_.+/)) {
                TargetNS.ClosePopup(Value);
            }
        });
    };

    /**
     * @function
     * @description
     *      This function set the type for a popup window.
     * @param {Object} WindowObject The element is a javascript window object
     * @return nothing
     */
    TargetNS.RegisterPopupAtParentWindow = function (WindowObject) {
        var TypeRegEx = /OTRSPopup_([^_]+)_.*/.exec(WindowObject.name),
            Type = RegExp.$1;
        if (typeof OpenPopups[Type] === 'undefined') {
            OpenPopups[Type] = WindowObject;
        }
        else {
            if (OpenPopups[Type] !== WindowObject) {
                OpenPopups[Type] = WindowObject;
            }
        }
    };

    /**
     * @function
     * @description
     *      This function set a timeout and after that try to register a popup at a parent window.
     * @return nothing
     */
    TargetNS.InitRegisterPopupAtParentWindow = function () {
        window.setTimeout(function () {
            if (window.name.match(/OTRSPopup_.+/) &&
                window.opener &&
                window.opener.Core &&
                window.opener.Core.UI &&
                window.opener.Core.UI.Popup
            ) {
                try {
                    window.opener.Core.UI.Popup.RegisterPopupAtParentWindow(window);
                }
                catch (Error) {}
            }
            Core.UI.Popup.InitRegisterPopupAtParentWindow();
        }, RegisterPopupTimeOut);
    };

    /**
     * @function
     * @description
     *      Get window object by popup type.
     * @param {String} Type The type of a window, e.g. 'Action'
     * @return {Object} The window object of the popup or undefined
     */
    TargetNS.GetPopupObject = function (Type) {
        return GetPopupObjectByType(Type);
    };

    /**
     * @function
     * @description
     *      This function resizes an opened window.
     * @param {String} Type The type of a window, e.g. 'Action'
     * @param {String} Width Width in pixels
     * @param {String} Height Height in pixels
     * @return nothing
     */
    TargetNS.Resize = function (Type, Width, Height) {
        var Object = GetPopupObjectByType(Type);
        if (typeof Object !== 'undefined') {
            Object.resizeTo(Width, Height);
        }
    };

    /**
     * @function
     * @description
     *      This function opens a popup window. Every popup is of a specific type and there can only be one window of a type at a time.
     * @param {String} URL The URL to be open in the new window
     * @param {String} Type The type of a window, e.g. 'Action'
     * @param {String} Profile The profile of a window, which defines the window parameters. Optional, default is 'Default'
     * @return nothing
     */
    TargetNS.OpenPopup = function (URL, Type, Profile) {
        var PopupObject,
            PopupProfile,
            NewWindow,
            WindowName,
            ConfirmClosePopup = true,
            PopupFeatures,
            SessionData,
            SessionStringURL = '';

        CheckOpenPopups();
        if (URL) {
            PopupObject = GetPopupObjectByType(Type);

            if (typeof PopupObject !== 'undefined') {
                ConfirmClosePopup = window.confirm(Core.Config.Get('PopupAlreadyOpenMsg'));
                if (ConfirmClosePopup) {
                    TargetNS.ClosePopup(PopupObject);
                }
            }

            // Only load new popup if the user accepted that the old popup is closed
            if (ConfirmClosePopup) {
                PopupProfile = PopupProfiles[Profile] ? Profile : PopupDefaultProfile;
                /*
                 * Special treatment for the window name. At least in some browsers, window names
                 *  are global, so only one popup window with a particular name may exist across
                 *  all browser tabs. To avoid conflicts with that, we use 'randomized' names
                 *  by including the current time in the name string. This name is also needed
                 *  to save the Type parameter.
                 */
                WindowName = 'OTRSPopup_' + Type + '_' + Date.parse(new Date());
                PopupFeatures = PopupProfiles[PopupProfile].WindowURLParams;
                // Get the position of the current screen on browsers which support it (non-IE) and
                //  use it to open the popup on the same screen
                PopupFeatures += ',left=' + ((window.screen.left || 0) + PopupProfiles[PopupProfile].Left);
                PopupFeatures += ',top=' + ((window.screen.top || 0) + PopupProfiles[PopupProfile].Top);
                PopupFeatures += ',width=' + PopupProfiles[PopupProfile].Width;
                PopupFeatures += ',height=' + PopupProfiles[PopupProfile].Height;

                // append SessionID (if needed)
                SessionData = Core.App.GetSessionInformation();
                if ( !Core.Config.Get('SessionIDCookie') && URL.indexOf(SessionData[Core.Config.Get('SessionName')]) === -1 ) {
                    URL += ';' + encodeURIComponent(Core.Config.Get('SessionName')) + '=' + encodeURIComponent(SessionData[Core.Config.Get('SessionName')]);
                }

                NewWindow = window.open(URL, WindowName, PopupFeatures);

                // check for popup blockers.
                // currently, popup windows cannot easily be detected in chrome, because it will
                //      load the entire content in an invisible window.
                if (!NewWindow ||  NewWindow.closed || typeof NewWindow.closed === 'undefined') {
                    window.alert(Core.Config.Get('PopupBlockerMsg'));
                }
                else {
                    OpenPopups[Type] = NewWindow;
                }
            }
        }
    };

    /**
     * @function
     * @description
     *      Checks if there are open popups on the page.
     * @return
     *      {Boolean} True or false.
     */
    TargetNS.HasOpenPopups = function() {
        var HasOpenPopups = false,
            Popup;

        CheckOpenPopups();
        for (Popup in OpenPopups) {
            if (OpenPopups.hasOwnProperty(Popup)) {
                HasOpenPopups = true;
                break;
            }
         }

        return HasOpenPopups;
    };

    /**
     * @function
     * @description
     *      This function closes a opened popup.
     * @param {String or Object} Popup The type of a popup or the window object
     * @return nothing
     */
    TargetNS.ClosePopup = function (Popup) {
        if (typeof Popup === 'string') {
            Popup = GetPopupObjectByType(Popup);
        }
        if (typeof Popup !== 'undefined') {
            Popup.close();
            CheckOpenPopups();
        }
    };

    /**
     * @function
     * @description
     *      The init function.
     * @return nothing
     */
    TargetNS.Init = function () {
        $(window).bind('beforeunload.Popup', function () {
            return Core.UI.Popup.CheckPopupsOnUnload();
        });
        $(window).bind('unload.Popup', function () {
            Core.UI.Popup.ClosePopupsOnUnload();
        });
        Core.UI.Popup.RegisterPopupEvent();

        // if this window is a popup itself, register another function
        if (window.name.match(/OTRSPopup_.+/) && window.opener !== null) {
            Core.UI.Popup.InitRegisterPopupAtParentWindow();
            $('.CancelClosePopup').bind('click', function () {
                window.close();
            });
            $('.UndoClosePopup').bind('click', function () {
                var RedirectURL = $(this).attr('href');
                window.opener.Core.UI.Popup.FirePopupEvent('URL', { URL: RedirectURL });
                window.close();
            });
        }
    };

    return TargetNS;
}(Core.UI.Popup || {}));
<|endoftext|>


<commit_before>var departments = ['Corporate Affairs' ,'Business Development ' ,'Corporate Strategy' ,'Other' ,'CDO' ,'Common Hardware Group' ,'Data Center BG/ DCCSG (Switching)' ,'Data Center BG/CSPG' ,'Data Center BG/Insieme' ,'Enterprise Networking/ Software Engineering/ENG' ,'Enterprise Networking/ Software Engineering/India Core SW' ,'Enterprise Networking/ Software Engineering/Ops' ,'Enterprise Networking/ Software Engineering/PI' ,'Enterprise Networking/Network Mgmt' ,'Enterprise Networking/Product Management' ,'IoT & Apps/ Internet of Things' ,'IoT & Apps/CBABU' ,'IoT & Apps/CTO' ,'IoT & Apps/CTTG' ,'IoT & Apps/CVTG' ,'IoT & Apps/Data Analytics Arch.' ,'IoT & Apps/DevNet' ,'IoT & Apps/Industry BU' ,'IoT & Apps/Spectre' ,'IoT & Apps/SPG' ,'IoT & Apps/Strategy & Planning' ,'IoT & Apps/Tropo' ,'IoT & Apps/UCTG' ,'IoT & Apps/Jasper' ,'Networking/Data Center BG/Security-Biz Ops' ,'Networking/Data Center BG/Security-CTAO' ,'Next Generation Cloud' ,'Security BG/Chief Architect' ,'Security BG/ODNS' ,'Security BG/Product Marketing' ,'Security BG/Security Engineering' ,'Service Provider BG/ CTO' ,'Service Provider BG/Apps & Platforms' ,'Service Provider BG/Cable' ,'Service Provider BG/Optical' ,'Service Provider BG/Routing' ,'Service Provider BG/SP Ops' ,'Service Provider BG/Strategic Partnerships' ,'BTOF' ,'CCG' ,'Cisco Capital' ,'Corporate Finance' ,'CRG' ,'LIFT' ,'Other' ,'Customer Partner Services' ,'Employee Services' ,'Operations Architecture' ,'Procurement' ,'Customer Success Transformation' ,'' ,'Cisco Commerce Workspace' ,'Customer Strategy & Success' ,'Enterprise Data Services' ,'Global Architecture and Technology Services' ,'Global Infrastructure Services' ,'Global IT Services' ,'PB' ,'IT Business Operations' ,'Compliance Brand Protection' ,'Ethics' ,'IP ' ,'Legal' ,'Digital Strategy Enablement' ,'Global Corporate Communications' ,'Global Corporate Marketing and Branding' ,'Go To Market' ,'Government Affairs and Technology Policy' ,'Marketing & Communications' ,'Marketing Operations Transformation' ,'MBA Leadership Development Program' ,'Undergrad New Hire Program' ,'Services Marketing' ,'' ,'CSAP' ,'EIU' ,'WW Sales' ,'Sales, Strategy and Ops (SSO)' ,'Global Service Provider' ,'CPOC' ,'Other' ,'Executive Ops' ,'GMO' ,'GP&F' ,'GSM' ,'Product Ops' ,'SCT' ,'T&Q' ,'Advanced Services' ,'Technical Services' ,'Services Strategy & Operations' ,'Advanced Security Research & Government' ,'ASIG' ,'Business Development ' ,'Engineering' ,'Information Security' ,'Other' ,'Planning Intelligence & Operations' ,'Strategic Comms' ,'TIP' ,'Trust Security Office']<commit_msg>Updated blank spaces<commit_after>var departments = ['Corporate Affairs' ,'Business Development ' ,'Corporate Strategy' ,'Other' ,'CDO' ,'Common Hardware Group' ,'Data Center BG/ DCCSG (Switching)' ,'Data Center BG/CSPG' ,'Data Center BG/Insieme' ,'Enterprise Networking/ Software Engineering/ENG' ,'Enterprise Networking/ Software Engineering/India Core SW' ,'Enterprise Networking/ Software Engineering/Ops' ,'Enterprise Networking/ Software Engineering/PI' ,'Enterprise Networking/Network Mgmt' ,'Enterprise Networking/Product Management' ,'IoT & Apps/ Internet of Things' ,'IoT & Apps/CBABU' ,'IoT & Apps/CTO' ,'IoT & Apps/CTTG' ,'IoT & Apps/CVTG' ,'IoT & Apps/Data Analytics Arch.' ,'IoT & Apps/DevNet' ,'IoT & Apps/Industry BU' ,'IoT & Apps/Spectre' ,'IoT & Apps/SPG' ,'IoT & Apps/Strategy & Planning' ,'IoT & Apps/Tropo' ,'IoT & Apps/UCTG' ,'IoT & Apps/Jasper' ,'Networking/Data Center BG/Security-Biz Ops' ,'Networking/Data Center BG/Security-CTAO' ,'Next Generation Cloud' ,'Security BG/Chief Architect' ,'Security BG/ODNS' ,'Security BG/Product Marketing' ,'Security BG/Security Engineering' ,'Service Provider BG/ CTO' ,'Service Provider BG/Apps & Platforms' ,'Service Provider BG/Cable' ,'Service Provider BG/Optical' ,'Service Provider BG/Routing' ,'Service Provider BG/SP Ops' ,'Service Provider BG/Strategic Partnerships' ,'BTOF' ,'CCG' ,'Cisco Capital' ,'Corporate Finance' ,'CRG' ,'LIFT' ,'Other' ,'Customer Partner Services' ,'Employee Services' ,'Operations Architecture' ,'Procurement' ,'Customer Success Transformation' ,'Cisco Commerce Workspace' ,'Customer Strategy & Success' ,'Enterprise Data Services' ,'Global Architecture and Technology Services' ,'Global Infrastructure Services' ,'Global IT Services' ,'PB' ,'IT Business Operations' ,'Compliance Brand Protection' ,'Ethics' ,'IP ' ,'Legal' ,'Digital Strategy Enablement' ,'Global Corporate Communications' ,'Global Corporate Marketing and Branding' ,'Go To Market' ,'Government Affairs and Technology Policy' ,'Marketing & Communications' ,'Marketing Operations Transformation' ,'MBA Leadership Development Program' ,'Undergrad New Hire Program' ,'Services Marketing' ,'CSAP' ,'EIU' ,'WW Sales' ,'Sales, Strategy and Ops (SSO)' ,'Global Service Provider' ,'CPOC' ,'Other' ,'Executive Ops' ,'GMO' ,'GP&F' ,'GSM' ,'Product Ops' ,'SCT' ,'T&Q' ,'Advanced Services' ,'Technical Services' ,'Services Strategy & Operations' ,'Advanced Security Research & Government' ,'ASIG' ,'Business Development ' ,'Engineering' ,'Information Security' ,'Other' ,'Planning Intelligence & Operations' ,'Strategic Comms' ,'TIP' ,'Trust Security Office']<|endoftext|>


<commit_before>// Import React
import React from "react";
import styled from "styled-components";

// Import image preloader util
import preloader from "spectacle/lib/utils/preloader";

// Import Spectacle Core tags
import { Deck, Heading, Image, Slide, Text, List, ListItem } from "spectacle";

import withPartecipants from "../modules/partecipants";
import Raffle from "../components/raffle";
import Counter from "../components/counter";
import QRCode from "../components/qrcode";
import Logo from "../components/mfe-logo";

import { theme, url, poll, prices, timer, nextTalk } from "../configuration";

// Require CSS
require("normalize.css");
require("spectacle/lib/themes/default/index.css");

const images = {
  wwy: require("../assets/wwy.jpg"),
  natale: require("../assets/natale.png")
};
preloader(images);

@withPartecipants(url)
class MFERaffle extends React.Component {
  render() {
    return <Raffle {...this.props} />;
  }
}

@withPartecipants(url)
class MFERafflePartecipants extends React.Component {
  render() {
    return <Counter {...this.props} />;
  }
}

const A = styled.a`
  color: currentColor;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 3px;
`;

export default class Presentation extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      winners: JSON.parse(localStorage.getItem("winners")) || []
    };
    this.onRaffle = this.onRaffle.bind(this);
  }

  onRaffle(winners) {
    this.setState({ winners });
    localStorage.setItem("winners", JSON.stringify(winners));
  }

  render() {
    return (

        <Deck
          transition={["zoom", "slide"]}
          transitionDuration={500}
          theme={theme}
        >
          <Slide
            transition={["fade"]}
            bgColor="dark"
            textColor="primary"
            id="💬"
          >
            <Heading size={3} textColor="primary">
              Follow up
            </Heading>
            <Logo />

              milanofrontend.herokuapp.com

          </Slide>
          <Slide transition={["fade"]} bgColor="primary" id="⁉">
            <Heading size={6} textColor="secondary" caps>
              Feedback please
            </Heading>
            <Heading size={3} textColor="secondary">
              Join the raffle!
            </Heading>
            <QRCode url={poll} />

              {poll}

          </Slide>
          <Slide transition={["fade"]} bgColor="primary" id="👇">
            <Heading size={3} textColor="secondary" caps>
              We want you
            </Heading>
            <Image src={images.wwy} />

              github.com/milanofrontend/talks

          </Slide>
          <Slide transition={["fade"]} bgColor="primary" id="🗣">
            <Heading size={6} textColor="secondary" caps>
              Next talk: {nextTalk.date}
            </Heading>
            <Heading size={3} textColor="secondary">
              {nextTalk.title}
            </Heading>
            <Text textColor="secondary">
              {nextTalk.speaker} {nextTalk.twitter}
            </Text>
          </Slide>
          <Slide transition={["fade"]} bgColor="primary" id="🍕">
            <Heading size={6} textColor="secondary" caps>
              Thanks to:
            </Heading>
            <List>
              <ListItem>
                Mikamai.com ➡ <big>🏠</big>
              </ListItem>
              <ListItem>
                Codemotion.it ➡ <big>🍺</big>
              </ListItem>
              <ListItem>
                Crebs.it ➡ <big>🍕</big>
              </ListItem>
              <ListItem>
                JetBrains.com ➡ <big>🔏</big>
              </ListItem>
            </List>
          </Slide>
          <Slide transition={["fade"]} bgColor="primary" id="🏆">
            <Heading size={3} textColor="secondary">
              Raffle
            </Heading>
            <MFERaffle
              prices={prices}
              timer={timer}
              winners={this.state.winners}
              handleRaffle={this.onRaffle}
            />
          </Slide>
          <Slide transition={["fade"]} bgColor="secondary" id="😎">
            {/* <Heading size={3} textColor="primary">
              Buon Natale 🎄
            </Heading>
            <Image src={images.natale} /> */}
            {/* <Heading size={4} textColor="primary">
              ⚔
            </Heading> */}
            <Heading size={6} textColor="primary">
              Thank you
            </Heading>
          </Slide>
        </Deck>
        <MFERafflePartecipants />

    );
  }
}
<commit_msg>removed codemotion from sponsor<commit_after>// Import React
import React from "react";
import styled from "styled-components";

// Import image preloader util
import preloader from "spectacle/lib/utils/preloader";

// Import Spectacle Core tags
import { Deck, Heading, Image, Slide, Text, List, ListItem } from "spectacle";

import withPartecipants from "../modules/partecipants";
import Raffle from "../components/raffle";
import Counter from "../components/counter";
import QRCode from "../components/qrcode";
import Logo from "../components/mfe-logo";

import { theme, url, poll, prices, timer, nextTalk } from "../configuration";

// Require CSS
require("normalize.css");
require("spectacle/lib/themes/default/index.css");

const images = {
  wwy: require("../assets/wwy.jpg"),
  natale: require("../assets/natale.png")
};
preloader(images);

@withPartecipants(url)
class MFERaffle extends React.Component {
  render() {
    return <Raffle {...this.props} />;
  }
}

@withPartecipants(url)
class MFERafflePartecipants extends React.Component {
  render() {
    return <Counter {...this.props} />;
  }
}

const A = styled.a`
  color: currentColor;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 3px;
`;

export default class Presentation extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      winners: JSON.parse(localStorage.getItem("winners")) || []
    };
    this.onRaffle = this.onRaffle.bind(this);
  }

  onRaffle(winners) {
    this.setState({ winners });
    localStorage.setItem("winners", JSON.stringify(winners));
  }

  render() {
    return (

        <Deck
          transition={["zoom", "slide"]}
          transitionDuration={500}
          theme={theme}
        >
          <Slide
            transition={["fade"]}
            bgColor="dark"
            textColor="primary"
            id="💬"
          >
            <Heading size={3} textColor="primary">
              Follow up
            </Heading>
            <Logo />

              milanofrontend.herokuapp.com

          </Slide>
          <Slide transition={["fade"]} bgColor="primary" id="⁉">
            <Heading size={6} textColor="secondary" caps>
              Feedback please
            </Heading>
            <Heading size={3} textColor="secondary">
              Join the raffle!
            </Heading>
            <QRCode url={poll} />

              {poll}

          </Slide>
          <Slide transition={["fade"]} bgColor="primary" id="👇">
            <Heading size={3} textColor="secondary" caps>
              We want you
            </Heading>
            <Image src={images.wwy} />

              github.com/milanofrontend/talks

          </Slide>
          <Slide transition={["fade"]} bgColor="primary" id="🗣">
            <Heading size={6} textColor="secondary" caps>
              Next talk: {nextTalk.date}
            </Heading>
            <Heading size={3} textColor="secondary">
              {nextTalk.title}
            </Heading>
            <Text textColor="secondary">
              {nextTalk.speaker} {nextTalk.twitter}
            </Text>
          </Slide>
          <Slide transition={["fade"]} bgColor="primary" id="🍕">
            <Heading size={6} textColor="secondary" caps>
              Thanks to:
            </Heading>
            <List>
              <ListItem>
                Mikamai.com ➡ <big>🏠</big>
              </ListItem>
              {/* <ListItem>
                Codemotion.it ➡ <big>🍺</big>
              </ListItem> */}
              <ListItem>
                Crebs.it ➡ <big>🍕</big>
              </ListItem>
              <ListItem>
                JetBrains.com ➡ <big>🔏</big>
              </ListItem>
            </List>
          </Slide>
          <Slide transition={["fade"]} bgColor="primary" id="🏆">
            <Heading size={3} textColor="secondary">
              Raffle
            </Heading>
            <MFERaffle
              prices={prices}
              timer={timer}
              winners={this.state.winners}
              handleRaffle={this.onRaffle}
            />
          </Slide>
          <Slide transition={["fade"]} bgColor="secondary" id="😎">
            {/* <Heading size={3} textColor="primary">
              Buon Natale 🎄
            </Heading>
            <Image src={images.natale} /> */}
            {/* <Heading size={4} textColor="primary">
              ⚔
            </Heading> */}
            <Heading size={6} textColor="primary">
              Thank you
            </Heading>
          </Slide>
        </Deck>
        <MFERafflePartecipants />

    );
  }
}
<|endoftext|>


<commit_before>import './techs.scss'
import template from './techItem.html';
import controller from './techs.controller';

export default {
  template: template,
  controller: controller
};
<commit_msg>template name fix<commit_after>import './techs.scss'
import template from './techs.html';
import controller from './techs.controller';

export default {
  template: template,
  controller: controller
};
<|endoftext|>