');
+ el.addClass('ludo-column-resize-handle');
+ el.css({
+ 'top':0,
+ 'position':'absolute',
+ 'height':'100%',
+ 'cursor':'col-resize',
+ 'z-index':15000,
+ display:isVisible ? '' : 'none'
+ });
+ el.attr('col-reference', key);
+ el.on(ludo.util.getDragStartEvent(), this.startColResize.bind(this));
+ if (!ludo.util.isTabletOrMobile()) {
+ el.on('mouseenter', this.mouseOverResizeHandle.bind(this));
+ el.on('mouseleave', this.mouseOutResizeHandle.bind(this));
+ }
+ this.resizeHandles[key] = el;
+ return el;
+ },
+
+ startColResize:function (e) {
+ var columnName = jQuery(e.target).attr('col-reference');
+ this.fireEvent('startresize', columnName);
+ jQuery(e.target).addClass('ludo-resize-handle-active');
+ var offset = this.getLeftOffsetOfColResizeHandle();
+
+ var r = this.resizeProperties;
+ r.min = this.getMinPos() - offset;
+ r.max = this.getMaxPos() - offset;
+
+ r.mouseX = this.resizeProperties.currentX = e.pageX;
+ r.elX = parseInt(jQuery(e.target).css('left').replace('px', ''));
+ r.currentX = this.resizeProperties.elX;
+
+ r.active = true;
+ r.el = jQuery(e.target);
+ r.index = columnName;
+
+ return false;
+ },
+
+ getLeftOffsetOfColResizeHandle:function () {
+ if (!this.resizeHandles[0]) {
+ return 3;
+ }
+ if (!this.handleOffset) {
+ var offset = Math.ceil(this.resizeHandles[0].getSize().x / 2);
+ if (offset > 0) {
+ this.handleOffset = offset;
+ } else {
+ return 3;
+ }
+ }
+ return this.handleOffset;
+ },
+
+ moveColResizeHandle:function (e) {
+
+ if (this.resizeProperties.active) {
+ var pos = this.resizeProperties.elX - this.resizeProperties.mouseX + e.pageX;
+ pos = Math.max(pos, this.resizeProperties.min);
+ pos = Math.min(pos, this.resizeProperties.max);
+
+ this.resizeProperties.el.css('left', pos);
+
+ this.resizeProperties.currentX = pos;
+ return false;
+ }
+ return undefined;
+ },
+
+ stopColResize:function () {
+ if (this.resizeProperties.active) {
+ this.resizeProperties.active = false;
+ this.resizeProperties.el.removeClass('ludo-resize-handle-active');
+ var change = this.resizeProperties.currentX - this.resizeProperties.elX;
+ this.fireEvent('resize', [this.resizeProperties.index, change]);
+ return false;
+ }
+ return undefined;
+ },
+
+ getMinPos:function () {
+ return this.minPos;
+ },
+ getMaxPos:function () {
+ return this.maxPos;
+ },
+
+ setMinPos:function (pos) {
+ this.minPos = pos;
+ },
+
+ setMaxPos:function (pos) {
+ this.maxPos = pos;
+ },
+
+ mouseOverResizeHandle:function (e) {
+ jQuery(e.target).addClass('ludo-grid-resize-handle-over');
+ },
+ mouseOutResizeHandle:function (e) {
+ jQuery(e.target).removeClass('ludo-grid-resize-handle-over');
+ },
+
+ isActive:function(){
+ return this.resizeProperties.active;
+ }
+});
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0034938_users.js b/pool/shard005/JavaScript/0034938_users.js
new file mode 100644
index 0000000000000000000000000000000000000000..e0adcd1bcbb071e14c20c38844b58faa4893a9ee
--- /dev/null
+++ b/pool/shard005/JavaScript/0034938_users.js
@@ -0,0 +1,16 @@
+// @flow
+
+import { API_USERS } from '@gitcub/constants/api'
+import { Router } from 'express'
+
+import asyncWrapper from '../../../asyncWrapper'
+import models from '../../../models'
+
+export default new Router().get(API_USERS, asyncWrapper(onGet))
+
+async function onGet(req: express$Request, res: express$Response) {
+ const { username } = req.params
+ const user = await models.User.find({ where: { login: username } })
+
+ return user ? res.json(user) : res.status(404).end()
+}
diff --git a/pool/shard005/JavaScript/0034939_geneticAlgorithmSolver.js b/pool/shard005/JavaScript/0034939_geneticAlgorithmSolver.js
new file mode 100644
index 0000000000000000000000000000000000000000..868bb5f9b33d1d42bf5908360f7e0ddc2e0c96e2
--- /dev/null
+++ b/pool/shard005/JavaScript/0034939_geneticAlgorithmSolver.js
@@ -0,0 +1,129 @@
+var _ = require('underscore');
+var TSPSolution = require('./TSPSolution');
+var hillClimbingSolver = require('./hillClimbingSolver');
+var GENERATIONS_NUMBER = 10000;
+var POPULTAION_SIZE = 10;
+var CROSSOVER_PORTION = 0.6;
+var MUTATION_PROBABILITY = 0.05;
+
+function buildInitialPopulation (matrix, initialSolutions) {
+ return _.map(initialSolutions, function(solution) {
+ return new TSPSolution(matrix, solution);
+ });
+}
+
+function getBestGenotypeFromPopulation (population) {
+ return _.min(population, function (genotype) {
+ return genotype.getLength();
+ });
+}
+
+function selectionForCrossover (population) {
+ var numberForCrossover = getNumberForCrossover(population.length);
+ return selection(population, numberForCrossover);
+}
+
+function selection (population, size, newPopulation) {
+ if (population.length < size) {
+ return population;
+ } else {
+ newPopulation = newPopulation || [];
+
+ _.times(size, function() {
+ var populationToChooseFrom = _.difference(population, newPopulation);
+ var selectedGenotype = getGenotypeByFitness(populationToChooseFrom);
+ newPopulation.push(selectedGenotype);
+ });
+
+ return newPopulation;
+ }
+
+}
+
+function getNumberForCrossover (populationSize) {
+ var numberForCrossover = Math.floor(populationSize * CROSSOVER_PORTION);
+ return makeEven(numberForCrossover);
+}
+
+function makeEven (number) {
+ return number % 2 === 0 ? number : number + 1;
+}
+
+function getGenotypeByFitness (population) {
+ var fitnessValues = _.map(population, function(genotype) {
+ return 1/genotype.getLength();
+ });
+ var sumOfFitnessValues = _.reduce(fitnessValues, function(memo, num){
+ return memo + num;
+ }, 0);
+ var normalizedFitnessValues = _.map(fitnessValues, function(fitnessValue) {
+ return fitnessValue/sumOfFitnessValues;
+ });
+ var randomNumber = Math.random();
+ var fitnessValue;
+ var i;
+ var n = normalizedFitnessValues.length;
+ for (i = 0; i < n; i += 1) {
+ fitnessValue = normalizedFitnessValues[i];
+ if (randomNumber < fitnessValue) {
+ return population[i];
+ } else {
+ randomNumber -= fitnessValue;
+ }
+ }
+}
+
+function populationCrossover (population) {
+ var pairs = getPairsFromPopulation(population);
+ var chidlren = [];
+
+ _.each(pairs, function(pair) {
+ var x = pair[0];
+ var y = pair[1];
+ chidlren.push(x.crossOver(y));
+ chidlren.push(y.crossOver(x));
+ });
+
+ return chidlren;
+}
+
+function getPairsFromPopulation (population) {
+ var pairs = [];
+ var n = population.length;
+ var i;
+ for (i = 0; i < n; i += 2){
+ pairs.push([population[i], population[i + 1]]);
+ }
+ return pairs;
+}
+
+function populationMutation (population) {
+ return _.map(population, function(genotype) {
+ if (Math.random() < MUTATION_PROBABILITY) {
+ // return genotype.randomSwap().randomSwap().randomSwap();
+ return hillClimbingSolver.solve(genotype._matrix, genotype.getPath());
+ } else {
+ return genotype;
+ }
+ });
+}
+
+function selectForLife (population) {
+ var best = getBestGenotypeFromPopulation(population);
+ var newPopulation = [best];
+ return selection(population, POPULTAION_SIZE, newPopulation);
+}
+
+module.exports.solve = function solve (matrix, initialSolutions) {
+ var population = buildInitialPopulation(matrix, _.first(initialSolutions, POPULTAION_SIZE));
+
+ _.times(GENERATIONS_NUMBER, function() {
+ var populationForCrossover = selectionForCrossover(population);
+ var chidlren = populationCrossover(populationForCrossover);
+ var mutatedPopulation = populationMutation(population.concat(chidlren));
+ population = selectForLife(mutatedPopulation);
+ });
+
+ var bestResult = getBestGenotypeFromPopulation(population);
+ return hillClimbingSolver.solve(bestResult._matrix, bestResult.getPath());
+};
diff --git a/pool/shard005/JavaScript/0034940_job_count.js b/pool/shard005/JavaScript/0034940_job_count.js
new file mode 100644
index 0000000000000000000000000000000000000000..f76f4eeeaede195d78499e1d1ff5c739761cf842
--- /dev/null
+++ b/pool/shard005/JavaScript/0034940_job_count.js
@@ -0,0 +1,19 @@
+'use strict';
+
+describe('Filter: jobCount', function () {
+
+ // load the filter's module
+ beforeEach(module('tbsApp'));
+
+ // initialize a new instance of the filter before each test
+ var jobCount;
+ beforeEach(inject(function ($filter) {
+ jobCount = $filter('jobCount');
+ }));
+
+ it('should return the input prefixed with "jobCount filter:"', function () {
+ var text = 'angularjs';
+ expect(jobCount(text)).toBe('jobCount filter: ' + text);
+ });
+
+});
diff --git a/pool/shard005/JavaScript/0034941_detail.js b/pool/shard005/JavaScript/0034941_detail.js
new file mode 100644
index 0000000000000000000000000000000000000000..e959858f0266946b21e1de988e0ed6a085a2b500
--- /dev/null
+++ b/pool/shard005/JavaScript/0034941_detail.js
@@ -0,0 +1,46 @@
+hardwhere.controller('DetailController', function($scope, $routeParams, apiFactory) {
+
+ // http://assmanapi.azurewebsites.net/api/assettype
+ // http://api.dribbble.com/shots/21603
+
+ $scope.asset = apiFactory.getAsset($routeParams.id);
+
+ $scope.asset.then(function(data) {
+
+ $scope.somethingElse = data;
+
+ // $scope.sections = [];
+
+ // for(property in data) {
+ // if(data[property].SectionOrder !== undefined) {
+
+ // var section = {order: data[property].SectionOrder, name: data[property].SectionName};
+
+ // if($scope.sections.indexOf(section) === -1 ) {
+
+ // $scope.sections.push(section);
+ // }
+ // }
+ // }
+ //console.log(sections);
+
+ });
+
+ $scope.editAsset = function() {
+ $scope.assets.push({
+ name: $scope.editAsset.name,
+ desc: $scope.editAsset.desc,
+ serial: $scope.editAsset.serial
+ });
+ }
+
+ $scope.deleteAsset = function(id) {
+ console.log(id);
+ $scope.assets.splice({
+ Id: id
+ });
+ }
+
+
+
+});
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0034942_background.js b/pool/shard005/JavaScript/0034942_background.js
new file mode 100644
index 0000000000000000000000000000000000000000..265358c43c0506974804a0ccbdba7f690e04dd35
--- /dev/null
+++ b/pool/shard005/JavaScript/0034942_background.js
@@ -0,0 +1,12 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+chrome.runtime.onMessageExternal.addListener(
+ function(message, sender, sendResponse) {
+ var optionsPages = chrome.extension.getViews().filter(function(view) {
+ return view.document.location.pathname == '/options.html';
+ });
+ var response = { hasOptionsPage: optionsPages.length > 0 };
+ sendResponse(response);
+});
diff --git a/pool/shard005/JavaScript/0034943_user.js b/pool/shard005/JavaScript/0034943_user.js
new file mode 100644
index 0000000000000000000000000000000000000000..7618f96320cbd4be312ead0655eb7a60903e26e2
--- /dev/null
+++ b/pool/shard005/JavaScript/0034943_user.js
@@ -0,0 +1,42 @@
+import mongoose from 'mongoose';
+import bcrypt from 'bcrypt-nodejs';
+
+const modelName = 'User';
+let Schema = mongoose.Schema;
+let userSchema = new Schema({
+ username: { type: String, unique: true, required: true },
+ password: { type: String, required: true }
+});
+
+//TODO: Fix this crap...somehow
+userSchema.methods.verifyPassword = function(password, cb) {
+ let user = this;
+
+ bcrypt.compare(password, user.password, (err, isMatch) => {
+ if (err) { return cb(err); }
+ return cb(null, isMatch);
+ });
+};
+
+//TODO: Clean those returns up!!!
+userSchema.pre('save', function(cb) {
+ let user = this;
+
+ if (!user || !user.isModified('password')) { return cb(); }
+
+ bcrypt.genSalt(5, (saltErr, salt) => {
+ if (saltErr) { return cb(saltErr); }
+
+ bcrypt.hash(user.password, salt, null, (hashErr, hash) => {
+ if (hashErr) { return cb(hashErr); }
+ user.password = hash;
+ return cb();
+ });
+
+ return cb();
+ });
+
+ return cb();
+});
+
+export default mongoose.model(modelName, userSchema, modelName);
diff --git a/pool/shard005/JavaScript/0034945_html_imports.js b/pool/shard005/JavaScript/0034945_html_imports.js
new file mode 100644
index 0000000000000000000000000000000000000000..dd0385e696b151a2d2afc7fe6da324327902b873
--- /dev/null
+++ b/pool/shard005/JavaScript/0034945_html_imports.js
@@ -0,0 +1,110 @@
+/* exported HtmlImports */
+'use strict';
+
+function _resolvePath(path) {
+ var globalPath = window.location.pathname.split('/');
+ globalPath.pop();
+ var extraPath = globalPath.join('/');
+ return path.replace(extraPath, '');
+}
+
+
+function _populateElement(elements, callback) {
+ var element = elements.pop();
+ var template = element.querySelector('template');
+
+ // Load CSS before in order to avoid any flickering effect
+ var styles = [].map.call(element.querySelectorAll('link'), function(element) {
+ return _resolvePath(element.href);
+ });
+
+ LazyLoader.load(styles, function noop() {});
+
+ // Load the HTML
+ var isElement = document.querySelector('[is=' + element.getAttribute('name') + ']');
+ isElement.innerHTML = template.innerHTML;
+ isElement.removeAttribute('is');
+
+ // Load scripts
+ var scripts = [].map.call(element.querySelectorAll('script'), function(element) {
+ return _resolvePath(element.src);
+ });
+
+ LazyLoader.load(scripts, function() {
+ callback();
+ });
+
+ LazyLoader.load(scripts, function() {
+ if (elements.length === 0) {
+ if (typeof callback === 'function') {
+ callback();
+ }
+ } else {
+ _populateElement(elements, callback);
+ }
+ });
+}
+
+
+function _populateElements(singleImport, callback) {
+ HtmlImports.getImportContent(singleImport.href, function gotContent(content) {
+ // Mapping of all custom element templates
+ var elementRoot = document.createElement('div');
+ elementRoot.innerHTML = content;
+ var elements = [].map.call(elementRoot.querySelectorAll('element'), function(element) {
+ return element;
+ });
+
+ _populateElement(elements, callback);
+ });
+}
+
+/**
+ * This file is included when we encounter lazy loaded nodes
+ * in DEBUG mode.
+ */
+var HtmlImports = {
+ /*
+ * Method for populating panels with lazy loading. This includes all JS and styles
+ * within the element loaded.
+ * @param callback Callback to be executed when everything is loaded
+ * @param isIdentifier (optional) If we indicate the specific panel to load,
+ * we will just load that one. If no param is present, we will load all panels
+ * with 'is';
+ */
+ populate: function(callback, isIdentifier) {
+ if (isIdentifier) {
+ var singleImport = document.querySelector('link[rel=import][is=' + isIdentifier + ']');
+ if (!singleImport) {
+ console.error('HtmlImports.populate: No import with IS ' + isIdentifier);
+ } else {
+ singleImport.removeAttribute('is');
+ _populateElements(singleImport, callback);
+ }
+ return;
+ }
+
+ var imports = document.querySelectorAll('link[rel="import"]');
+ if (!imports.length) {
+ return;
+ }
+
+ var pending = imports.length;
+
+ Array.prototype.forEach.call(imports, function perImport(eachImport) {
+ _populateElements(eachImport, callback);
+ }, this);
+ },
+
+ getImportContent: function(path, callback) {
+ // bail out if the imported resource isn't in the same origin
+ var parsedURL = new URL(path, location.href);
+ if (parsedURL.origin !== location.origin) { return; }
+ var xhr = new XMLHttpRequest();
+ xhr.onload = function(o) {
+ callback(xhr.responseText);
+ };
+ xhr.open('GET', path, true);
+ xhr.send();
+ }
+};
diff --git a/pool/shard005/JavaScript/0034948_diginfo.js b/pool/shard005/JavaScript/0034948_diginfo.js
new file mode 100644
index 0000000000000000000000000000000000000000..5a9ddff459ebaaa6e527370f05ab277b59d545de
--- /dev/null
+++ b/pool/shard005/JavaScript/0034948_diginfo.js
@@ -0,0 +1,197 @@
+/*$(function(){
+ $('#carousel').infiniteCarousel({
+ displayTime: 3000,
+ transitionSpeed: 3000,
+ autoPilot: true,
+ });
+});*/
+
+Ext.apply(Ext.form.field.VTypes, {
+ captcha: function(v) {
+ var captchaorig = Ext.ComponentQuery.query('textfield[name=captchatext]')[0].getValue();
+ var captchatype = Ext.ComponentQuery.query('textfield[name=captchainput]')[0].getValue();
+ if(captchaorig != captchatype) {
+ return false;
+ } else {
+ return true;
+ }
+ },
+ captchaText: 'Wrong captcha. Type the characters above again.'
+});
+
+function openContactUs() {
+ var wc = Ext.create('Ext.window.Window', {
+ title: '
We want to hear from you!',
+ height: 500,
+ width: 870,
+ layout: 'fit',
+ items: [{
+ xtype: 'container',
+ layout: 'hbox',
+ items: [{
+ xtype: 'form',
+ autoScroll: true,
+ flex: 1,
+ height: '100%',
+ defaults: {
+ padding: 7,
+ width: '90%'
+ },
+ items: [{
+ xtype: 'displayfield',
+ width: '97%',
+ value: 'Tell us what you need from us and we\'ll get in touch with you as soon as we can. Request, comment, suggestion, inquiry; feel free to message us by filling out the form below. Or email directly to
niloposo@diginfobettersystem.com or
nilposo@gmail.com.'
+ },{
+ xtype: 'displayfield',
+ value: '
Contact Information'
+ },{
+ xtype: 'textfield',
+ fieldLabel: 'Email',
+ name: 'email',
+ allowBlank: false,
+ vtype: 'email',
+ labelAlign: 'top'
+ },{
+ xtype: 'textfield',
+ fieldLabel: 'Company',
+ name: 'comp',
+ allowBlank: false,
+ labelAlign: 'top'
+ },{
+ xtype: 'textfield',
+ fieldLabel: 'Address',
+ name: 'address',
+ labelAlign: 'top'
+ },{
+ xtype: 'numberfield',
+ fieldLabel: 'Phone/Fax',
+ name: 'phone',
+ labelAlign: 'top'
+ },{
+ xtype: 'numberfield',
+ fieldLabel: 'Mobile',
+ name: 'mobile',
+ labelAlign: 'top'
+ },{
+ xtype: 'textareafield',
+ fieldLabel: 'Inquiry',
+ name: 'inquiry',
+ labelAlign: 'top',
+ allowBlank: false
+ },{
+ xtype: 'displayfield',
+ name: 'captcha',
+ allowBlank: true,
+ value: ''
+ },{
+ xtype: 'textfield',
+ name: 'captchatext',
+ hidden: true,
+ value: new Date()
+ },{
+ xtype: 'textfield',
+ name: 'captchainput',
+ labelAlign: 'top',
+ fieldLabel: 'Type the captcha text above',
+ vtype: 'captcha'
+ }],
+ buttons: [{
+ text: 'Send',
+ action: 'submit',
+ handler: function(b) {
+ var dform = b.up('form').getForm();
+
+ if (dform.isValid()) {
+ b.up('form').getEl().mask('Sending...');
+ var vals = dform.getValues();
+ Ext.Ajax.request({
+ url: 'contactus.cfm',
+ params: {
+ email: vals['email'],
+ comp: vals['comp'],
+ address: vals['address'],
+ phone: vals['phone'],
+ mobile: vals['mobile'],
+ inquiry: vals['inquiry']
+ },
+ success: function(response) {
+ b.up('form').getEl().unmask();
+ b.up('window').close();
+ Ext.Msg.alert('Status', 'Your inquiry has been sent.')
+ }
+ });
+ }
+ }
+ }],
+ },{
+ xtype: 'container',
+ flex: 1,
+ padding: 4,
+ height: '100%',
+ items: [{
+ xtype: 'displayfield',
+ value: '
'
+ },{
+ xtype: 'displayfield',
+ value: '

'
+ }]
+ }]
+ }]
+ }).show();
+
+
+ Ext.Ajax.request({
+ url: './captcha.cfm',
+ success: function(response) {
+ var response = JSON.parse(response.responseText);
+ var clink = response["captchalink"].trim() || response["captchalink"];
+ var cstring = response["captchastring"];
+ var cdisplay = Ext.ComponentQuery.query('displayfield[name=captcha]')[0];
+ cdisplay.setValue(clink);
+ var cstringdisp = Ext.ComponentQuery.query('textfield[name=captchatext]')[0];
+ cstringdisp.setValue(cstring);
+ }
+ });
+
+};
+
+function showaboutus(containerid) {
+ var ishidden = $('#'+containerid).is(":hidden");
+ if (ishidden) {
+ $('#'+containerid).show(1000);
+ } else {
+ $('#'+containerid).hide(1000);
+ }
+}
+
+function getMoreInfo(dfilename, refparagraph, origelementref) {
+ var ellipses = $('#'+ origelementref);
+ ellipses.animate({opacity: '0.2'}, "slow");
+ ellipses.animate({opacity: '0.4'}, "slow");
+ ellipses.animate({opacity: '0.8'}, "slow");
+ ellipses.animate({opacity: '1'}, "slow");
+ ellipses.animate({opacity: '0.8'}, "slow");
+ ellipses.animate({opacity: '0.4'}, "slow");
+ ellipses.animate({opacity: '0.2'}, "slow");
+ ellipses.animate({opacity: '1'}, "slow");
+ Ext.Ajax.request({
+ url: './data/' + dfilename,
+ success: function(response) {
+ var a = document.getElementById(refparagraph);
+ a.innerHTML = response.responseText;
+ $('#'+ origelementref).unbind("click");
+ $('#'+ origelementref).click(function() {
+ hideInfo(origelementref, refparagraph);
+ });
+ }
+ });
+}
+
+function hideInfo(origelementref, refparagraph) {
+ var ishidden = $('#'+refparagraph).is(":hidden");
+ if (ishidden) {
+ $('#'+ refparagraph).show(1000);
+ } else {
+ $('#'+ refparagraph).hide(1000);
+ }
+}
diff --git a/pool/shard005/JavaScript/0034950_Log_In.js b/pool/shard005/JavaScript/0034950_Log_In.js
new file mode 100644
index 0000000000000000000000000000000000000000..241e40f78ac163eede1c319ab381c933d8ee4456
--- /dev/null
+++ b/pool/shard005/JavaScript/0034950_Log_In.js
@@ -0,0 +1,102 @@
+import React, {Component, PropTypes} from 'react';
+import ReactDOM from 'react-dom';
+import {Link} from 'react-router';
+import {reduxForm} from 'redux-form';
+import * as actions from '../../actions';
+
+//Custom components
+//Tis is one giant block that contains the 2 input fields
+//for email and Password on LOG IN
+class Log_In extends Component {
+
+ //Clearing out error in the reducer
+ componentWillMount(){
+ this.props.clearError();
+ }
+ //Sending sign up info to server for validation
+ handleFormSubmit({ email, password }){
+ //Needs to send email and password to server
+ this.props.signinUser({email, password});
+ }
+
+ //Displaying error messages when signing in/ signing up
+ renderAlert(){
+ if(this.props.errorMessage){
+ return(
+
+ Oops, {this.props.errorMessage}
+
+ );
+ }
+ }
+
+ render(){
+ //Assigning the properties from this.props to fields
+ //handleSubmit is a redux form library function
+ const { fields: {email, password}, handleSubmit} = this.props;
+ return (
+
+
+

+
+
+
+ );
+ }
+}
+
+
+
+//THIS FUNCTION CHECKS IF THERE'S INPUT IN THE FIELDS
+function validate(values){
+ const errors = {};
+
+ if (!values.email){
+ errors.email = 'This field is required';
+ }
+ if (!values.password){
+ errors.password = 'This field is required';
+ }
+ return errors;
+}
+
+function mapStateToProps(state){
+ return {
+ errorMessage: state.auth.error
+ };
+}
+
+
+//reduxForm argument list: form config, mapStateToProps, mapDispatchToProps
+export default reduxForm({
+ form: 'signin',
+ fields: [
+ 'email',
+ 'password'
+ ],
+ validate
+}, mapStateToProps, actions )(Log_In);
diff --git a/pool/shard005/JavaScript/0034951_addFileResource.main.js b/pool/shard005/JavaScript/0034951_addFileResource.main.js
new file mode 100644
index 0000000000000000000000000000000000000000..a516ee2701be37a4b6356418ba89050024a79bc3
--- /dev/null
+++ b/pool/shard005/JavaScript/0034951_addFileResource.main.js
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2005 - 2014 TIBCO Software Inc. All rights reserved.
+ * http://www.jaspersoft.com.
+ *
+ * Unless you have purchased a commercial license agreement from Jaspersoft,
+ * the following license terms apply:
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see
.
+ */
+
+
+/**
+ * @version: $Id: addFileResource.main.js 47331 2014-07-18 09:13:06Z kklein $
+ */
+
+define(function(require) {
+ "use strict";
+
+ var domReady = require("!domReady"),
+ addFileResource = require("resource.add.files"),
+ _ = require("underscore"),
+ jrsConfigs = require("jrs.configs"),
+ resource = require("resource.base");
+
+ require("utils.common");
+
+ domReady(function(){
+ var options = jrsConfigs.addFileResource.localContext.initOptions;
+
+ _.extend(window.localContext, jrsConfigs.addFileResource.localContext);
+ _.extend(resource.messages, jrsConfigs.addFileResource.resource.messages);
+
+ addFileResource.initialize(options);
+ isIPad() && resource.initSwipeScroll();
+ });
+});
diff --git a/pool/shard005/JavaScript/0034952_test-wrap-js-stream-read-stop.js b/pool/shard005/JavaScript/0034952_test-wrap-js-stream-read-stop.js
new file mode 100644
index 0000000000000000000000000000000000000000..6d86dc2c21a5197127f721e02c6175dbd09a4a7a
--- /dev/null
+++ b/pool/shard005/JavaScript/0034952_test-wrap-js-stream-read-stop.js
@@ -0,0 +1,42 @@
+// Flags: --expose-internals
+'use strict';
+
+require('../common');
+const assert = require('assert');
+const WrapStream = require('internal/js_stream_socket');
+const Stream = require('stream');
+
+class FakeStream extends Stream {
+ constructor() {
+ super();
+ this._paused = false;
+ }
+
+ pause() {
+ this._paused = true;
+ }
+
+ resume() {
+ this._paused = false;
+ }
+
+ isPaused() {
+ return this._paused;
+ }
+}
+
+const fakeStreamObj = new FakeStream();
+const wrappedStream = new WrapStream(fakeStreamObj);
+
+// Resume by wrapped stream upon construction
+assert.strictEqual(fakeStreamObj.isPaused(), false);
+
+fakeStreamObj.pause();
+
+assert.strictEqual(fakeStreamObj.isPaused(), true);
+
+fakeStreamObj.resume();
+
+assert.strictEqual(wrappedStream.readStop(), 0);
+
+assert.strictEqual(fakeStreamObj.isPaused(), true);
diff --git a/pool/shard005/JavaScript/0034958_TextTracksFileMetaDataItemValueView.js b/pool/shard005/JavaScript/0034958_TextTracksFileMetaDataItemValueView.js
new file mode 100644
index 0000000000000000000000000000000000000000..a4d4389fbd34a038321a3d7e7f7fa9308c4ae4fc
--- /dev/null
+++ b/pool/shard005/JavaScript/0034958_TextTracksFileMetaDataItemValueView.js
@@ -0,0 +1,16 @@
+import {FileMetaDataItemValueView} from './FileMetaDataItemValueView';
+
+import {state} from '$state';
+
+export const TextTracksFileMetaDataItemValueView = FileMetaDataItemValueView.extend({
+ initialize: function() {
+ this.textTrackFiles = this.model.nestedFiles(state.textTrackFiles);
+ this.listenTo(this.textTrackFiles, 'add remove change:configuration', this.update);
+ },
+
+ getText: function() {
+ return this.textTrackFiles.map(function(textTrackFile) {
+ return textTrackFile.displayLabel();
+ }).join(', ');
+ }
+});
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0034959_mid-auth.js b/pool/shard005/JavaScript/0034959_mid-auth.js
new file mode 100644
index 0000000000000000000000000000000000000000..2be29323dccbd1c6f497e266361ca5dc969bac41
--- /dev/null
+++ b/pool/shard005/JavaScript/0034959_mid-auth.js
@@ -0,0 +1,55 @@
+/*
+ Copyright (C) 2015 3NSoft Inc.
+
+ This program is free software: you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation, either version 3 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see
. */
+var api = require('../../../lib-common/service-api/mailer-id/login');
+var SC = api.authSession.SC;
+/**
+ * This creates an authorize-sender route handler.
+ */
+function makeHandler(midAuthorizingFunc) {
+ if ('function' !== typeof midAuthorizingFunc) {
+ throw new TypeError("Given argument 'midAuthorizingFunc' must be function, but is not.");
+ }
+ return function (req, res, next) {
+ if (req.session.isAuthorized) {
+ res.status(api.ERR_SC.duplicate).send("This protocol request has already been served.");
+ return;
+ }
+ var rb = req.body;
+ var sessionId = req.session.id;
+ if (!rb.assertion || !rb.userCert || !rb.provCert) {
+ res.status(api.ERR_SC.malformed).send("No credentials given.");
+ req.session.close();
+ return;
+ }
+ midAuthorizingFunc(req.hostname, sessionId, rb.assertion, rb.userCert, rb.provCert)
+ .then(function (userId) {
+ if (!userId || (userId !== req.session.params.userId)) {
+ req.session.close();
+ res.status(SC.authFailed).send("Server is not accepting provided credentials.");
+ }
+ else {
+ req.session.isAuthorized = true;
+ res.status(SC.ok).end();
+ }
+ })
+ .fail(function (err) {
+ next(err);
+ })
+ .done();
+ };
+}
+exports.makeHandler = makeHandler;
+Object.freeze(exports);
diff --git a/pool/shard005/JavaScript/0034960_race.js b/pool/shard005/JavaScript/0034960_race.js
new file mode 100644
index 0000000000000000000000000000000000000000..017d9da533c2c2cdcc5581e24740df13d41ea445
--- /dev/null
+++ b/pool/shard005/JavaScript/0034960_race.js
@@ -0,0 +1,109 @@
+// forked from github.com/jakearchibald/es6-promise
+
+import emitter from '../emitter'
+import {
+ isArray
+} from "../utils";
+
+import {
+ noop,
+ resolve,
+ reject,
+ subscribe,
+ PENDING
+} from '../-internal';
+
+/**
+ `Promise.race` returns a new promise which is settled in the same way as the
+ first passed promise to settle.
+
+ Example:
+
+ ```javascript
+ var promise1 = new Promise(function(resolve, reject){
+ setTimeout(function(){
+ resolve('promise 1');
+ }, 200);
+ });
+
+ var promise2 = new Promise(function(resolve, reject){
+ setTimeout(function(){
+ resolve('promise 2');
+ }, 100);
+ });
+
+ Promise.race([promise1, promise2]).then(function(result){
+ // result === 'promise 2' because it was resolved before promise1
+ // was resolved.
+ });
+ ```
+
+ `Promise.race` is deterministic in that only the state of the first
+ settled promise matters. For example, even if other promises given to the
+ `promises` array argument are resolved, but the first settled promise has
+ become rejected before the other promises became fulfilled, the returned
+ promise will become rejected:
+
+ ```javascript
+ var promise1 = new Promise(function(resolve, reject){
+ setTimeout(function(){
+ resolve('promise 1');
+ }, 200);
+ });
+
+ var promise2 = new Promise(function(resolve, reject){
+ setTimeout(function(){
+ reject(new Error('promise 2'));
+ }, 100);
+ });
+
+ Promise.race([promise1, promise2]).then(function(result){
+ // Code here never runs
+ }, function(reason){
+ // reason.message === 'promise 2' because promise 2 became rejected before
+ // promise 1 became fulfilled
+ });
+ ```
+
+ An example real-world use case is implementing timeouts:
+
+ ```javascript
+ Promise.race([ajax('foo.json'), timeout(5000)])
+ ```
+
+ @method race
+ @static
+ @param {Array} promises array of promises to observe
+ Useful for tooling.
+ @return {Promise} a promise which settles in the same way as the first passed
+ promise to settle.
+*/
+export default function race(entries) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ var promise = new Constructor(noop, {
+ parents: entries, role: '[race]'
+ });
+
+ if (!isArray(entries)) {
+ reject(promise, new TypeError('You must pass an array to race.'));
+ return promise;
+ }
+
+ var length = entries.length;
+
+ function onFulfillment(value) {
+ resolve(promise, value);
+ }
+
+ function onRejection(reason) {
+ reject(promise, reason);
+ }
+
+ for (var i = 0; promise._state === PENDING && i < length; i++) {
+ subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
+ }
+
+ return promise;
+}
diff --git a/pool/shard005/JavaScript/0034962_codemirror.js b/pool/shard005/JavaScript/0034962_codemirror.js
new file mode 100644
index 0000000000000000000000000000000000000000..f959786f52deaba0f8b4af46db2e077db9da276e
--- /dev/null
+++ b/pool/shard005/JavaScript/0034962_codemirror.js
@@ -0,0 +1,69 @@
+import gulp from 'gulp';
+import gulpif from 'gulp-if';
+import gutil from 'gulp-util';
+import concat from 'gulp-concat';
+import sourcemaps from 'gulp-sourcemaps';
+import uglify from 'gulp-uglify';
+import minifyCSS from 'gulp-minify-css';
+import rename from 'gulp-rename';
+
+import browserify from 'browserify';
+import babelify from 'babelify';
+import source from 'vinyl-source-stream';
+import buffer from 'vinyl-buffer';
+
+
+const CSS = [
+ 'node_modules/codemirror/lib/codemirror.css'
+ , 'node_modules/codemirror/addon/hint/show-hint.css'
+ , 'node_modules/codemirror/addon/dialog/dialog.css'
+ , 'node_modules/codemirror/addon/fold/foldgutter.css'
+];
+
+
+export function codemirror (debug=false) {
+ var bundler = browserify({
+ debug: debug,
+ entries: ['./src/js/codemirror.js'],
+ standalone: 'CodeMirror',
+ extensions: ['js']
+ });
+ bundler.transform({
+ stage: 0,
+ only: /src\/js\/codemirror\.js/
+ }, babelify);
+ return bundler
+ .bundle()
+ .pipe(source('codemirror.js'))
+ .pipe(buffer())
+ .pipe(sourcemaps.init({loadMaps: true}))
+ .pipe(gulpif(!debug, uglify()))
+ .on('error', err => gutil.log(err))
+ .pipe(sourcemaps.write('./'))
+ .pipe(gulp.dest('src/vendor'))
+ ;
+}
+
+export function codemirrorCSS () {
+ return gulp.src(CSS)
+ .pipe(concat('codemirror.min.css'))
+ .pipe(minifyCSS())
+ .pipe(gulp.dest('./src/vendor/codemirror'))
+ ;
+};
+
+export function codemirrorThemes () {
+ return gulp.src('node_modules/codemirror/theme/*.css')
+ .pipe(minifyCSS())
+ .pipe(rename({extname: '.min.css'}))
+ .pipe(gulp.dest('./src/vendor/codemirror/theme'))
+ ;
+};
+
+export function codemirrorKeymaps () {
+ return gulp.src('node_modules/codemirror/keymap/*.js')
+ .pipe(uglify())
+ .pipe(rename({extname: '.min.js'}))
+ .pipe(gulp.dest('./src/vendor/codemirror/keymap'))
+ ;
+};
diff --git a/pool/shard005/JavaScript/0034963_component.js b/pool/shard005/JavaScript/0034963_component.js
new file mode 100644
index 0000000000000000000000000000000000000000..2238ab0119b14d5c6b4812ccfe7ef90eb95e2af4
--- /dev/null
+++ b/pool/shard005/JavaScript/0034963_component.js
@@ -0,0 +1,212 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('print_preview', function() {
+ 'use strict';
+
+ /**
+ * Class that represents a UI component.
+ * @constructor
+ * @extends {cr.EventTarget}
+ */
+ function Component() {
+ cr.EventTarget.call(this);
+
+ /**
+ * Component's HTML element.
+ * @type {Element}
+ * @private
+ */
+ this.element_ = null;
+
+ this.isInDocument_ = false;
+
+ /**
+ * Component's event tracker.
+ * @type {EventTracker}
+ * @private
+ */
+ this.tracker_ = new EventTracker();
+
+ /**
+ * Child components of the component.
+ * @type {!Array.}
+ * @private
+ */
+ this.children_ = [];
+ };
+
+ Component.prototype = {
+ __proto__: cr.EventTarget.prototype,
+
+ /** Gets the component's element. */
+ getElement: function() {
+ return this.element_;
+ },
+
+ /** @return {EventTracker} Component's event tracker. */
+ get tracker() {
+ return this.tracker_;
+ },
+
+ /**
+ * @return {boolean} Whether the element of the component is already in the
+ * HTML document.
+ */
+ get isInDocument() {
+ return this.isInDocument_;
+ },
+
+ /**
+ * Creates the root element of the component. Sub-classes should override
+ * this method.
+ */
+ createDom: function() {
+ this.element_ = cr.doc.createElement('div');
+ },
+
+ /**
+ * Called when the component's element is known to be in the document.
+ * Anything using document.getElementById etc. should be done at this stage.
+ * Sub-classes should extend this method and attach listeners.
+ */
+ enterDocument: function() {
+ this.isInDocument_ = true;
+ this.children_.forEach(function(child) {
+ if (!child.isInDocument && child.getElement()) {
+ child.enterDocument();
+ }
+ });
+ },
+
+ /** Removes all event listeners. */
+ exitDocument: function() {
+ this.children_.forEach(function(child) {
+ if (child.isInDocument) {
+ child.exitDocument();
+ }
+ });
+ this.tracker_.removeAll();
+ this.isInDocument_ = false;
+ },
+
+ /**
+ * Renders this UI component and appends the element to the given parent
+ * element.
+ * @param {!Element} parentElement Element to render the component's
+ * element into.
+ */
+ render: function(parentElement) {
+ assert(!this.isInDocument, 'Component is already in the document');
+ if (!this.element_) {
+ this.createDom();
+ }
+ parentElement.appendChild(this.element_);
+ this.enterDocument();
+ },
+
+ /**
+ * Decorates an existing DOM element. Sub-classes should override the
+ * override the decorateInternal method.
+ * @param {Element} element Element to decorate.
+ */
+ decorate: function(element) {
+ assert(!this.isInDocument, 'Component is already in the document');
+ this.setElementInternal(element);
+ this.decorateInternal();
+ this.enterDocument();
+ },
+
+ /**
+ * @return {!Array.} Child components of this
+ * component.
+ */
+ get children() {
+ return this.children_;
+ },
+
+ /**
+ * @param {!print_preview.Component} child Component to add as a child of
+ * this component.
+ */
+ addChild: function(child) {
+ this.children_.push(child);
+ },
+
+ /**
+ * @param {!print_preview.Component} child Component to remove from this
+ * component's children.
+ */
+ removeChild: function(child) {
+ var childIdx = this.children_.indexOf(child);
+ if (childIdx != -1) {
+ this.children_.splice(childIdx, 1);
+ }
+ if (child.isInDocument) {
+ child.exitDocument();
+ if (child.getElement()) {
+ child.getElement().parentNode.removeChild(child.getElement());
+ }
+ }
+ },
+
+ /** Removes all of the component's children. */
+ removeChildren: function() {
+ while (this.children_.length > 0) {
+ this.removeChild(this.children_[0]);
+ }
+ },
+
+ /**
+ * @param {string} query Selector query to select an element starting from
+ * the component's root element using a depth first search for the first
+ * element that matches the query.
+ * @return {HTMLElement} Element selected by the given query.
+ * TODO(alekseys): Check all call sites and rename this function to
+ * something like getRequiredChildElement.
+ */
+ getChildElement: function(query) {
+ return this.element_.querySelector(query);
+ },
+
+ /**
+ * Sets the component's element.
+ * @param {Element} element HTML element to set as the component's element.
+ * @protected
+ */
+ setElementInternal: function(element) {
+ this.element_ = element;
+ },
+
+ /**
+ * Decorates the given element for use as the element of the component.
+ * @protected
+ */
+ decorateInternal: function() { /*abstract*/ },
+
+ /**
+ * Clones a template HTML DOM tree.
+ * @param {string} templateId Template element ID.
+ * @param {boolean=} opt_keepHidden Whether to leave the cloned template
+ * hidden after cloning.
+ * @return {Element} Cloned element with its 'id' attribute stripped.
+ * @protected
+ */
+ cloneTemplateInternal: function(templateId, opt_keepHidden) {
+ var templateEl = $(templateId);
+ assert(templateEl != null,
+ 'Could not find element with ID: ' + templateId);
+ var el = assertInstanceof(templateEl.cloneNode(true), HTMLElement);
+ el.id = '';
+ if (!opt_keepHidden) {
+ setIsVisible(el, true);
+ }
+ return el;
+ }
+ };
+
+ return {
+ Component: Component
+ };
+});
diff --git a/pool/shard005/JavaScript/0034966_AlertDialog.js b/pool/shard005/JavaScript/0034966_AlertDialog.js
new file mode 100644
index 0000000000000000000000000000000000000000..9b16e92e1bf1990d563515c3502da84ab0df6425
--- /dev/null
+++ b/pool/shard005/JavaScript/0034966_AlertDialog.js
@@ -0,0 +1,126 @@
+import React from 'react';
+
+import Model from '../components/model';
+import Button from '../components/button';
+
+import YmtApi from 'YmtApi';
+
+const searchParam = YmtApi.utils.getUrlObj();
+
+
+let FormDialog = React.createClass({
+ getInitialState(){
+ return {
+ msgTxt:''
+ }
+ },
+ render (){
+ const {
+ show,
+ onHideDialog,
+ alertMsg,
+ showButtonList=[0],
+ openUrl,
+ onOpenFormDialog,
+ onHideFormDialog,
+ onBuyNow,
+ onShareHandler,
+ showDialogHd,
+ onShowRuleDialog,
+ resetCountDown,
+ params={} } = this.props;
+
+ const buttonsList = [
+
我知道了
,
+
{
+ openUrl({
+ url:'/list.html',
+ title:'砍价团列表'
+ });
+ }}>算了,去看看其他的
,
+
{
+ onHideDialog();
+ onOpenFormDialog();
+ resetCountDown()
+ }}>换个手机号试试
,
+
使用这个手机号重新登录
,
+
{
+ window.location.href='http://download.app.ymatou.com/index.aspx?from=inapp25';
+ }}>哼! 下载APP,自己去开团
,
+
{
+ onHideDialog();
+ onHideFormDialog();
+ }}>使用该手机绑定的微信号重新登录
,
+
{
+ onShareHandler(params.groupCode)
+ }}>呼朋唤友来参团
,
+
我已在此团中
,
+
{
+ openUrl({
+ url:'/detail.html?tuanId='+searchParam.tuanId,
+ title:'砍价团列表'
+ })
+ }}>我知道了
,
+
查看规则
+ ]
+
+ let buttonHmtl;
+ if(showButtonList[0] === -1){
+ buttonHmtl = (
+
+
+
+
+ )
+ }else{
+ buttonHmtl = showButtonList.map((i)=>{
+ return buttonsList[i];
+ });
+ }
+
+ let dialogHd;
+
+ if(showDialogHd){
+ dialogHd = (
+
+ {
+ onHideDialog('alertDialogShow')
+ }}>
+
+ )
+ }
+
+ return (
+
+
+
+ {dialogHd}
+
+
+ { buttonHmtl }
+
+
+
+
+ )
+ }
+});
+
+export default FormDialog
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0034967_posts.js b/pool/shard005/JavaScript/0034967_posts.js
new file mode 100644
index 0000000000000000000000000000000000000000..cabee91c2bfb70c4f5e8769094342c9d8fdcd97d
--- /dev/null
+++ b/pool/shard005/JavaScript/0034967_posts.js
@@ -0,0 +1,107 @@
+import { browserHistory } from 'react-router';
+
+export default {
+ /**** User Actions ****/
+ changeCategory(context, event, category) {
+ return (dispatch) => {
+ event.preventDefault();
+ dispatch({ type: 'CHANGE_POSTS_CATEGORY', category })
+ }
+ },
+
+ /**** Admin Actions ****/
+ addPost({ Meteor, swal, toastr }, event, coverUrl) {
+ return () => {
+ event.preventDefault();
+ const category = event.target.category.value;
+ const title = event.target.title.value;
+ const content = $('#editor').summernote('code');
+ // if (!coverUrl) {
+ // toastr["error"]("请先添加图片", "Error!");
+ // }
+ Meteor.call('posts.add', category, coverUrl, title, content, (err) => {
+ if (err) {
+ console.log(err);
+ if (err.reason === "Title is required") {
+ toastr["error"]("发布失败,请先添加标题", "Error!");
+ } else if (err.reason === "Cover url is required") {
+ toastr["error"]("发布失败,请先添加封面图片", "Error!");
+ } else {
+ toastr["error"]("发布失败", "Error!");
+ }
+ } else {
+ swal({
+ title: '发布成功',
+ type: 'success',
+ onClose() {
+ browserHistory.push('/admin/posts/list');
+ }
+ });
+ }
+ });
+ }
+ },
+ addCover(context, url) {
+ return { type: 'ADD_POST_COVER', url };
+ },
+ deletePost({ Meteor }, post, id) {
+ return ()=> {
+ event.preventDefault();
+ Meteor.call('post.delete', id, (err) => {
+ if (err) {
+ toastr["error"]("删除失败", "Error!");
+ }
+ });
+ }
+ },
+ changeImgPosition({ Meteor, toastr }, event) {
+ return () => {
+ Meteor.call('posts.imgPosition', event.target.value, (err) => {
+ if (err) {
+ toastr["error"]("删除失败", "Error!");
+ } else {
+ toastr["success"]("保存成功", "Success!");
+ }
+ });
+ };
+ },
+ changeTabsPosition({ Meteor, toastr }, event) {
+ return (dispatch) => {
+ Meteor.call('posts.categories.tabsPosition', event.target.value, (err) => {
+ if (err) {
+ toastr["error"]("保存失败", "Error!");
+ } else {
+ toastr["success"]("保存成功", "Success!");
+ }
+ });
+ };
+ },
+ changeTabsColor({ Meteor, toastr }, event) {
+ return (dispatch) => {
+ Meteor.call('posts.categories.color', event.target.value, (err) => {
+ if (err) {
+ toastr["error"]("修改失败", "Error!");
+ } else {
+ toastr["success"]("保存成功", "Success!");
+ }
+ });
+ };
+ },
+ addCategory({ Meteor }, event) {
+ event.preventDefault();
+ const category = event.target.category.value;
+ Meteor.call('posts.categories.add', category, (err) => {
+ if (err) {
+ alert(err.message);
+ }
+ });
+ },
+ deleteCategory({ Meteor }, event, category) {
+ event.preventDefault();
+ Meteor.call('posts.categories.delete', category, (err) => {
+ if (err) {
+ alert(err.message);
+ }
+ });
+ }
+};
diff --git a/pool/shard005/JavaScript/0034968_G2NLifeCycle.js b/pool/shard005/JavaScript/0034968_G2NLifeCycle.js
new file mode 100644
index 0000000000000000000000000000000000000000..8fd6674399a687fa59d5e2383c68949babd171ae
--- /dev/null
+++ b/pool/shard005/JavaScript/0034968_G2NLifeCycle.js
@@ -0,0 +1,243 @@
+define(['G2NSystem', 'G2NConnect'], function(G2NSystem, G2NConnect) {
+
+ var onCreate = null,
+ onResume = null,
+ onPause = null,
+ onDestroy = null,
+ onCreateMsg = null,
+ onResumeMsg = null,
+ onPauseMsg = null,
+ onDestroyMsg = null,
+ isDestoryed = false,
+ alertWait = false,
+ originalAlert = null,
+ isInit = false,
+ publicMember = {};
+
+ function sendDestroyMsg() {
+ var destroyMsg = {};
+ destroyMsg.wID = G2NSystem.appId;
+ destroyMsg.func = 'destroyMsg';
+
+ G2NConnect.send(destroyMsg);
+ }
+
+ function isFunction(func) {
+ if ( func === null || func === undefined ) {
+ return false;
+ }
+
+ if ( typeof(func) === 'function' ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ function onCreateDefaultFunc() {
+ G2NSystem.debugLog('onCreate');
+ if ( onCreate ) {
+ onCreate();
+ }
+
+ // Resume after Create!
+ G2NConnect.requestSAAgent(function() {
+ onResumeDefaultFunc(true);
+ });
+ }
+
+ function onResumeDefaultFunc(created) {
+ if ( alertWait ) {
+ alertWait = false;
+ return;
+ }
+ G2NSystem.debugLog('onResume');
+ G2NConnect.connect(function() {
+ if ( created ) {
+ G2NConnect.send(onCreateMsg);
+ }
+
+ G2NConnect.send(onResumeMsg);
+
+ if ( onResume ) {
+ onResume();
+ }
+ });
+ }
+
+ function onPauseDefaultFunc() {
+// if ( isDestoryed ) {
+// return;
+// } //deprecated
+
+ if ( alertWait ) {
+ return;
+ }
+ G2NSystem.debugLog('onPause');
+ if ( onPause ) {
+ onPause();
+ }
+
+ G2NConnect.send(onPauseMsg);
+ G2NConnect.pause();
+ }
+
+ function onDestroyDefaultFunc() {
+ G2NSystem.debugLog('onDestroy');
+ if ( onDestroy ) {
+ onDestroy();
+ }
+ }
+
+ function exit() {
+ onDestroyDefaultFunc();
+
+ if ( G2NConnect.isConnected() === false ) {
+ isDestoryed = true;
+ tizen.application.getCurrentApplication().exit();
+ } else {
+ G2NConnect.send(onDestroyMsg);
+
+ }
+ }
+
+ function onCreateReturn() {
+
+ }
+
+ function onResumeReturn() {
+
+ }
+
+ function onPauseReturn() {
+
+ }
+
+ function onDestroyReturn() {
+ G2NConnect.disconnect(function() {
+ isDestoryed = true;
+ tizen.application.getCurrentApplication().exit();
+ });
+ }
+
+ function setOnCreateCallbak(onCreateCallback) {
+ if ( isFunction(onCreateCallback) ) {
+ onCreate = onCreateCallback;
+ }
+ }
+
+ function setOnResumeCallbak(onResumeCallback) {
+ if ( isFunction(onResumeCallback) ) {
+ onResume = onResumeCallback;
+ }
+ }
+
+ function setOnPauseCallback(onPauseCallback) {
+ if ( isFunction(onPauseCallback) ) {
+ onPause = onPauseCallback;
+ }
+ }
+
+ function setOnDestroyCallback(onDestroyCallback) {
+ if ( isFunction(onDestroyCallback) ) {
+ onDestroy = onDestroyCallback;
+ }
+ }
+
+ function notPauseAlert(data) {
+ alertWait = true;
+ originalAlert(data);
+ }
+
+ function makeMsgs()
+ {
+ onCreateMsg = {
+ msgType: 'STATUS',
+ wID: G2NSystem.appId,
+ status: 'create',
+ countOfThread: 4,
+ callbackKey: G2NSystem.registerCallback(onCreateReturn)
+ };
+
+ onResumeMsg = {
+ msgType: 'STATUS',
+ wID: G2NSystem.appId,
+ status: 'resume',
+ countOfThread: 'null',
+ callbackKey: G2NSystem.registerCallback(onResumeReturn)
+ };
+
+ onPauseMsg = {
+ msgType: 'STATUS',
+ wID: G2NSystem.appId,
+ status: 'pause',
+ countOfThread: 'null',
+ callbackKey: G2NSystem.registerCallback(onPauseReturn)
+ };
+
+ onDestroyMsg = {
+ msgType: 'STATUS',
+ wID: G2NSystem.appId,
+ status: 'destroy',
+ countOfThread: 'null',
+ callbackKey: G2NSystem.registerCallback(onDestroyReturn)
+ };
+
+ onCreateMsg = JSON.stringify(onCreateMsg);
+ onResumeMsg = JSON.stringify(onResumeMsg);
+ onPauseMsg = JSON.stringify(onPauseMsg);
+ onDestroyMsg = JSON.stringify(onDestroyMsg);
+ }
+
+ function autoReconnect(prev, cur) {
+// if ( cur === 'SCREEN_OFF' ) {
+// onPauseDefaultFunc();
+// } else
+ if ( prev === 'SCREEN_OFF' && cur === 'SCREEN_NORMAL' ) {
+ if ( G2NConnect.isConnected() !== true ) {
+ onResumeDefaultFunc();
+ }
+ else {
+ if ( onResume ) {
+ onResume();
+ }
+ }
+ }
+ }
+
+ function initG2NLifeCycle() {
+
+ makeMsgs();
+
+ if ( G2NSystem.isWatchWidget ) {
+ tizen.power.setScreenStateChangeListener(autoReconnect);
+ }
+
+ // callback function setter
+// publicMember.setOnCreateCallback = setOnCreateCallbak;
+ publicMember.setOnResumeCallback = setOnResumeCallbak;
+ publicMember.setOnPauseCallback = setOnPauseCallback;
+// publicMember.setOnDestroyCallback = setOnDestroyCallback;
+
+ // system callback setting
+ publicMember.onCreateDefaultFunc = onCreateDefaultFunc;
+ publicMember.onResumeDefaultFunc = onResumeDefaultFunc;
+ publicMember.onPauseDefaultFunc = onPauseDefaultFunc;
+ publicMember.onDestroyDefaultFunc = onDestroyDefaultFunc;
+
+ publicMember.exit = exit;
+
+ // change default alert function (for pause/resume event)
+ originalAlert = window.alert;
+ window.alert = notPauseAlert;
+
+ G2NSystem.debugLog('G2NLifeCycle Init!');
+ isInit = true;
+ }
+
+ if ( isInit === false ) {
+ initG2NLifeCycle();
+ }
+
+ return publicMember;
+});
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0034971_awardHierarchyShared.js b/pool/shard005/JavaScript/0034971_awardHierarchyShared.js
new file mode 100644
index 0000000000000000000000000000000000000000..b91271e0c104ed72773420ca5480242af03e307c
--- /dev/null
+++ b/pool/shard005/JavaScript/0034971_awardHierarchyShared.js
@@ -0,0 +1,208 @@
+/*
+ * Kuali Coeus, a comprehensive research administration system for higher education.
+ *
+ * Copyright 2005-2015 Kuali, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see
.
+ */
+function RequestTracker(liNode, callback) {
+ this.liNode = liNode;
+ this.callback = callback;
+ this.startDate = new Date;
+ this.children = null;
+}
+
+var DEBUG = false;
+function debugLog(str) {
+ console.log(str);
+}
+
+jQuery(document).ready(function(){
+ jQuery('#awardHierarchyScrollable').scroll(function() {saveScrollPosition(this);});
+ jQuery.ajaxSettings.cache = false;
+ jQuery("#awardhierarchy").treeview({
+ toggle: function() {
+ //this method must be implemented by the page, not here in shared funcs
+ treeViewToggle(this);
+ },
+ animated: "fast",
+ collapsed: true,
+ control: "#treecontrol"
+ });
+ jQuery('#treecontrol').hide();
+ jQuery('#shownCollapseLink').click(function() {
+ jQuery('#treecontrol a:eq(0)').click();
+ });
+
+ jQuery('#shownExpandLink').click(function() {
+ if (jQuery('#awardhierarchy').find('li.expandable').length > 0) {
+ forceLoading();
+ jQuery('li.expandable').each(function() {
+ var liItem = this;
+ queueToggle(liItem, expandAll);
+ });
+ }
+ });
+}); // $(document).ready
+
+function expandAll(requestTracker) {
+ if (requestTracker.liNode != null) {
+ jQuery(requestTracker.liNode).find('div.expandable-hitarea:first').click();
+ }
+ jQuery(requestTracker.children).each(function() {
+ queueToggle(this, expandAll);
+ });
+ if (activeRequest != null) {
+ debugLog('Active Request - ' + getAwardNumber(activeRequest.liNode));
+ }
+ logPending();
+ if (activeRequest == null && pendingRequests.length == 0) {
+ clearForceLoading();
+ }
+
+}
+
+var pendingRequests = [];
+var activeRequest;
+
+var forceLoadingMessage = null;
+function showLoading() {
+ jQuery('#loading span.statusMessage').html('Loading ' + (pendingRequests.length) + ' items');
+ jQuery('#loading').show();
+}
+function logPending() {
+ var str = 'pending requests = ';
+ jQuery(pendingRequests).each(function() {
+ str += getAwardNumber(this.liNode) + ',';
+ });
+ debugLog(str);
+}
+function finishLoading(requestTracker) {
+ debugLog('finished loading something');
+ logPending();
+ if (requestTracker == activeRequest) {
+ activeRequest = null;
+ }
+ if (requestTracker != null && requestTracker.callback != null) {
+ requestTracker.callback(requestTracker);
+ }
+ if (pendingRequests.length > 0 && activeRequest == null) {
+ activeRequest = pendingRequests.shift()
+ loadChildren(activeRequest);
+ } else if (activeRequest == null) {
+ if(!forceLoadingMessage) {
+ jQuery('#loading').hide();
+ }
+ fixDatePickers();
+ }
+}
+function forceLoading() {
+ debugLog('forcing loading message to be displayed until cleared');
+ forceLoadingMessage = true;
+ showLoading();
+}
+function clearForceLoading() {
+ debugLog('clearing forced loading message');
+ forceLoadingMessage = false;
+ finishLoading(null);
+}
+function queueToggle(liNode, callback) {
+ var requestTracker = new RequestTracker(liNode, callback);
+ showLoading();
+ if (pendingRequests.length <= 0 && activeRequest == null) {
+ activeRequest = requestTracker;
+ loadChildren(requestTracker);
+ } else {
+ pendingRequests.push(requestTracker);
+ }
+}
+
+function fixDatePickers(listItem) {
+ //when loading children, we must remove all of the previous images and scripts. Otherwise, there will be multiple
+ //datepickers added to each cell depending on how deep we dig into the hierarchy and how many times we toggle.
+ jQuery('.datepickerImage').remove();
+ jQuery('.datepickerScript').remove();
+ jQuery('.datepicker').each(
+ function() {
+ var id = jQuery(this).attr("id");
+ var img1 =jQuery("

");
+ img1.insertAfter(jQuery(this));
+ Calendar.setup({ inputField : id, ifFormat : '%m/%d/%Y', button : id + '_datepicker'});
+ });
+}
+
+ /*
+ * load children area of research when parents RA is expanding.
+ */
+ function loadChildren(requestTracker) {
+ var liNode = null;
+ if (requestTracker != null) {
+ liNode = requestTracker.liNode;
+ }
+ var ulNode = jQuery('#awardhierarchy');
+ var awardNumber = '';
+ var addRA = 'N';
+ if (liNode != null) {
+ var ulNode = jQuery(liNode).children('ul:eq(0)');
+ var awardNumber = getAwardNumber(liNode);
+ var addRA = 'E';
+ }
+
+ debugLog('Loading children for ' + awardNumber);
+ if ((liNode != null && !jQuery(liNode).is('.loaded'))
+ || jQuery(ulNode).find('li.awardhierarchy').length == 0) {
+ jQuery.ajax({
+ url: AJAX_LOCATION,
+ type: 'GET',
+ dataType: 'html',
+ data:'awardNumber='+awardNumber+'&addRA=' + addRA + '&' + ROOT_AWARD_LOCATION +'=' + jQuery(jq_escape(ROOT_AWARD_LOCATION)).attr("value") + '¤tAwardNumber='+ jQuery("#currentAwardNumber").attr("value") + '¤tSeqNumber='+ jQuery("#currentSeqNumber").attr("value"),
+ cache: false,
+ async: true,
+ timeout: 90000,
+ error: function(error){
+ console.log(error);
+ alert('Error loading Award Hierarchy information. Check to see if Award was canceled.');
+ if (liNode != null) {
+ jQuery(liNode).find('div.collapsable-hitarea:first').click();
+ }
+ finishLoading(requestTracker);
+ },
+ success: function(xml){
+ try {
+ var newChildren = [];
+ var json = jQuery(xml).find('#json').html();
+ debugLog(json);
+ var hierarchyArray = eval(json);
+ jQuery(hierarchyArray).each(function(){
+ var newChild = addAwardToHierarchy(this, ulNode);
+ newChildren.push(newChild);
+ });
+ if (liNode != null) {
+ jQuery(liNode).addClass('loaded');
+ }
+ requestTracker.children = newChildren;
+ } catch (e) {
+ alert('Error loading Award Hierarchy information' + e);
+ if (liNode != null) {
+ jQuery(liNode).find('div.collapsable-hitarea:first').click();
+ }
+ }
+ finishLoading(requestTracker);
+ }
+ });
+ } else {
+ requestTracker.children = jQuery(liNode).find('li.awardhierarchy').toArray();
+ finishLoading(requestTracker);
+ }
+ } // end loadChildren
diff --git a/pool/shard005/JavaScript/0034977_searchfilm_script.js b/pool/shard005/JavaScript/0034977_searchfilm_script.js
new file mode 100644
index 0000000000000000000000000000000000000000..de4e5a2993e7924183e911126709c5df3ac4643b
--- /dev/null
+++ b/pool/shard005/JavaScript/0034977_searchfilm_script.js
@@ -0,0 +1,28 @@
+// eliminazione multipla
+var checkbox = document.getElementsByName('deleteFilm');
+for (var i = 0; i < checkbox.length; i++) {
+ checkbox[i].addEventListener('change', function() {
+ var form = document.forms[id = 'multideletefilm'];
+ if (this.checked) {
+ // inserisco input
+ addHidden(form, this.name, this.value, this.value);
+ } else {
+ // elimino input
+ var input = document.getElementById(this.value);
+ removeElement(input);
+ }
+ });
+}
+
+// blocco form se non ci sono selezioni
+var form = document.forms[id = 'multideletefilm'];
+form.addEventListener('submit', function(evt) {
+ var inputs = this.getElementsByTagName('input');
+ if (inputs.length > 1) { // c'è da considerare l'hidden
+ return true;
+ } else {
+ // blocco il submit
+ formBlock(evt);
+ alert('Selezionare almeno un film');
+ }
+});
diff --git a/pool/shard005/JavaScript/0034981_application.js b/pool/shard005/JavaScript/0034981_application.js
new file mode 100644
index 0000000000000000000000000000000000000000..2d724a6c93d0b475e6f802018482b118b2a082b3
--- /dev/null
+++ b/pool/shard005/JavaScript/0034981_application.js
@@ -0,0 +1,173 @@
+// This is a manifest file that'll be compiled into application.js, which will include all the files
+// listed below.
+//
+// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
+// vendor/assets/javascripts directory can be referenced here using a relative path.
+//
+// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
+// compiled file. JavaScript code in this file should be added after the last require_* statement.
+//
+// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
+// about supported directives.
+//
+//= require jquery
+//= require tether
+//= require jquery_ujs
+//= require bootstrap
+//= require_tree .
+
+
+$( document ).ready(function() {
+ clearShippers()
+
+// Action Cable
+ console.log("application running")
+
+
+ // update admin order with ajax
+ // $(".update-btn-form").hide()
+ // $('.remove-and-insert').on("change", ".delivery-option", function(e){
+ // e.preventDefault();
+ // var select = $(this)
+ // var $form = $(this).parent()
+ // var data = $(this).parent().serialize()
+ // $.ajax({
+ // type: $form.attr('method'),
+ // url: $form.attr('action'),
+ // data: data,
+ // // dataType: 'json'
+ // })
+ // .done(function(){
+ // console.log("saved")
+ // })
+ // })
+
+ //Shipper option
+ $('.remove-and-insert').on("change", ".delivery-option", function(e){
+ if ($(this).children()[0].value == "Shipping"){
+ $(this).siblings().show()
+ }else if ($(this).children()[0].value != "Shipping"){
+ $(this).siblings('.shipper').hide()
+ }
+ })
+
+ function clearShippers() {
+
+ for (var x =0 ; x < $(".delivery-option").children("#order_order_status").length; x++){
+ if ($($(".delivery-option").children("#order_order_status")[x]).find(":selected").text() != "Shipping"){
+ $($(".delivery-option").children("#order_order_status")[x]).parent().siblings("span.delivery-option.shipper").children().hide()
+
+ }
+ }
+ }
+
+ // update admin order with ajax
+ // $('.remove-and-insert').on("change", "#order_assign_shipper_to_order", function(e){
+ // e.preventDefault();
+ // var select = $(this)
+ // var $form = $(this).parent().parent()
+ // var data = $(this).parent().parent().serialize()
+ // $.ajax({
+ // type: $form.attr('method'),
+ // url: $form.attr('action'),
+ // data: data,
+ // // dataType: 'json'
+ // })
+ // .done(function(){
+ // console.log("saved")
+ // })
+ // })
+
+
+ $('.status-select').on('change', function(event){
+
+ var $form = $(this).closest('form');
+ var $dataIn = $form.siblings('.remove-and-insert').children();
+
+
+ $.ajax({
+ type: $form.attr('method'),
+ url: $form.attr('action'),
+ data: $form.serialize(),
+ dataType: 'html'
+ })
+ .done(function(response){
+ $dataIn.replaceWith(response)
+ })
+ })
+
+
+ $(".alt").on('click',function(e){
+ e.preventDefault();
+
+ if ($(this).siblings('#orders_pick_up_address')[0].value == "Select deliver address") {
+ alert('You need to select a location');
+ }
+ //what if a box is occupied OMG!
+ else{
+ $(this).parent().submit()
+ }
+ })
+
+ $('section.camie').hide()
+
+ $('button.cam-activate').on('click',function(){
+ $('section.camie').show()
+ var txt = "innerText" in HTMLElement.prototype ? "innerText" : "textContent";
+ var arg = {
+ resultFunction: function(result) {
+ document.getElementById('something').value = result.code;
+ }
+ };
+ new WebCodeCamJS("canvas").init(arg).play();
+ })
+
+
+
+ $(".col").on("click", ".edit-box", ".edit-master", function(event){
+ event.preventDefault();
+
+ var $td = $(this);
+ $.ajax({
+ type: 'GET',
+ url: $td.find('a').attr('href'),
+ datatype: 'html'
+
+ })
+
+ .done(function(response){
+ $td.parent().append(response);
+ $td.siblings(".remove").remove();
+ $td.remove();
+
+
+
+ })
+ })
+
+ $(".col").on("click", ".save-changes", ".edit-master", function(event){
+ event.preventDefault();
+
+ var $form = $(this).parent();
+ var $data = $(this).closest(".add-data")
+
+ $.ajax({
+ type: $form.attr('method'),
+ url: $form.attr('action'),
+ data: $form.serialize()
+ })
+ .done(function(response){
+ $data.replaceWith(response);
+
+
+ })
+ })
+});
+
+
+
+
+
+
+
+
diff --git a/pool/shard005/JavaScript/0034982_rollback.js b/pool/shard005/JavaScript/0034982_rollback.js
new file mode 100644
index 0000000000000000000000000000000000000000..b1129bfcb2246c593242d6395d1e38ca9e7d0907
--- /dev/null
+++ b/pool/shard005/JavaScript/0034982_rollback.js
@@ -0,0 +1,123 @@
+/*
+ *
+ * @licstart The following is the entire license notice for the
+ * JavaScript code in this page.
+ *
+ * Copyright (c) 2012-2013 RockStor, Inc.
+ * This file is part of RockStor.
+ *
+ * RockStor is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License,
+ * or (at your option) any later version.
+ *
+ * RockStor is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ * @licend The above is the entire license notice
+ * for the JavaScript code in this page.
+ *
+ */
+
+RollbackView = RockstorLayoutView.extend({
+ events: {
+ 'click #js-cancel': 'cancel',
+ 'click #js-confirm-rollback-submit': 'confirmRollback'
+ },
+
+ initialize: function() {
+ this.constructor.__super__.initialize.apply(this, arguments);
+ // Templates
+ this.template = window.JST.share_rollback;
+ this.snapshot_list_template = window.JST.share_rollback_snapshot_list;
+ this.pagination_template = window.JST.common_pagination;
+ // Dependencies
+ this.share = new Share({shareName: this.options.shareName});
+ this.collection = new SnapshotCollection();
+ this.collection.pageSize = 10;
+ this.collection.setUrl(this.options.shareName);
+ this.dependencies.push(this.share);
+ this.dependencies.push(this.collection);
+ this.collection.on('reset', this.renderSnapshotList, this);
+ },
+
+ render: function() {
+ this.fetch(this.renderRollback, this);
+ return this;
+ },
+
+ renderRollback: function() {
+ var _this = this;
+ $(this.el).html(this.template({
+ collection: this.collection,
+ share: this.share
+ }));
+ this.renderSnapshotList();
+ this.$('#rollback-form').validate({
+ onfocusout: false,
+ onkeyup: false,
+ rules: {
+ snapshot: "required",
+ },
+ submitHandler: function() {
+ var button = _this.$('#rollback-share');
+ var snapName = _this.$('input:radio[name=snapshot]:checked').val();
+ // set snap name in confirm dialog
+ _this.$('#confirm-snap-name').html(snapName);
+ // show confirm dialog
+ _this.$('#confirm-rollback').modal();
+ return false;
+ }
+ });
+
+ },
+
+ renderSnapshotList: function() {
+ this.$('#ph-snapshot-list').html(this.snapshot_list_template({
+ snapshots: this.collection
+ }));
+ this.$(".pagination-ph").html(this.pagination_template({
+ collection: this.collection
+ }));
+ },
+
+ confirmRollback: function() {
+ var _this = this;
+ var button = this.$('#js-confirm-rollback-submit');
+ if (buttonDisabled(button)) return false;
+ var snapName = this.$('input:radio[name=snapshot]:checked').val();
+ $.ajax({
+ url: '/api/shares/' + _this.share.get('name') + '/rollback',
+ type: "POST",
+ dataType: "json",
+ contentType: 'application/json',
+ data: JSON.stringify({name: snapName}),
+ success: function() {
+ enableButton(button);
+ _this.$('#confirm-rollback').modal('hide');
+ $('.modal-backdrop').remove();
+ app_router.navigate('shares/' + _this.share.get('name'), {trigger: true})
+
+ },
+ error: function(xhr, status, error) {
+ enableButton(button);
+ },
+ });
+
+ },
+
+ cancel: function(event) {
+ if (event) event.preventDefault();
+ app_router.navigate('shares/' + this.share.get('name'), {trigger: true})
+ }
+
+});
+
+// Add pagination
+Cocktail.mixin(RollbackView, PaginationMixin);
+
diff --git a/pool/shard005/JavaScript/0034983_example.js b/pool/shard005/JavaScript/0034983_example.js
new file mode 100644
index 0000000000000000000000000000000000000000..dc6b5bd19a7d72d403f22a748384044b014e0c8e
--- /dev/null
+++ b/pool/shard005/JavaScript/0034983_example.js
@@ -0,0 +1,60 @@
+(function ($) {
+
+/**
+ * The recommended way for producing HTML markup through JavaScript is to write
+ * theming functions. These are similiar to the theming functions that you might
+ * know from 'phptemplate' (the default PHP templating engine used by most
+ * Drupal themes including Omega). JavaScript theme functions accept arguments
+ * and can be overriden by sub-themes.
+ *
+ * In most cases, there is no good reason to NOT wrap your markup producing
+ * JavaScript in a theme function.
+ */
+Drupal.theme.prototype.bayitchamExampleButton = function (path, title) {
+ // Create an anchor element with jQuery.
+ return $('' + title + '');
+};
+
+/**
+ * Behaviors are Drupal's way of applying JavaScript to a page. The advantage
+ * of behaviors over simIn short, the advantage of Behaviors over a simple
+ * document.ready() lies in how it interacts with content loaded through Ajax.
+ * Opposed to the 'document.ready()' event which is only fired once when the
+ * page is initially loaded, behaviors get re-executed whenever something is
+ * added to the page through Ajax.
+ *
+ * You can attach as many behaviors as you wish. In fact, instead of overloading
+ * a single behavior with multiple, completely unrelated tasks you should create
+ * a separate behavior for every separate task.
+ *
+ * In most cases, there is no good reason to NOT wrap your JavaScript code in a
+ * behavior.
+ *
+ * @param context
+ * The context for which the behavior is being executed. This is either the
+ * full page or a piece of HTML that was just added through Ajax.
+ * @param settings
+ * An array of settings (added through drupal_add_js()). Instead of accessing
+ * Drupal.settings directly you should use this because of potential
+ * modifications made by the Ajax callback that also produced 'context'.
+ */
+Drupal.behaviors.bayitchamExampleBehavior = {
+ attach: function (context, settings) {
+ // By using the 'context' variable we make sure that our code only runs on
+ // the relevant HTML. Furthermore, by using jQuery.once() we make sure that
+ // we don't run the same piece of code for an HTML snippet that we already
+ // processed previously. By using .once('foo') all processed elements will
+ // get tagged with a 'foo-processed' class, causing all future invocations
+ // of this behavior to ignore them.
+ $('.some-selector', context).once('foo', function () {
+ // Now, we are invoking the previously declared theme function using two
+ // settings as arguments.
+ var $anchor = Drupal.theme('bayitchamExampleButton', settings.myExampleLinkPath, settings.myExampleLinkTitle);
+
+ // The anchor is then appended to the current element.
+ $anchor.appendTo(this);
+ });
+ }
+};
+
+})(jQuery);
diff --git a/pool/shard005/JavaScript/0034986_cancel.js b/pool/shard005/JavaScript/0034986_cancel.js
new file mode 100644
index 0000000000000000000000000000000000000000..1a154d2af498d10f10854d73b6fb5268163fe193
--- /dev/null
+++ b/pool/shard005/JavaScript/0034986_cancel.js
@@ -0,0 +1,114 @@
+require("should");
+var helper = require("../../helper");
+
+var purchaseOrderDataUtil = require("../../data-util/purchasing/purchase-order-data-util");
+var validatePR = require("dl-models").validator.purchasing.purchaseOrder;
+var PurchaseOrderManager = require("../../../src/managers/purchasing/purchase-order-manager");
+var purchaseOrderManager = null;
+var purchaseOrders;
+
+var PurchaseRequestManager = require("../../../src/managers/purchasing/purchase-request-manager");
+var purchaseRequestManager = null;
+var purchaseRequests;
+
+var purchaseOrderExternalDataUtil = require("../../data-util/purchasing/purchase-order-external-data-util");
+var validatePO = require("dl-models").validator.purchasing.purchaseOrderExternal;
+var PurchaseOrderExternalManager = require("../../../src/managers/purchasing/purchase-order-external-manager");
+var purchaseOrderExternalManager = null;
+var purchaseOrderExternal;
+
+var poStatusEnum = require("dl-models").purchasing.enum.PurchaseOrderStatus;
+var prStatusEnum = require("dl-models").purchasing.enum.PurchaseRequestStatus;
+
+before('#00. connect db', function (done) {
+ helper.getDb()
+ .then(db => {
+ purchaseOrderManager = new PurchaseOrderManager(db, {
+ username: 'dev'
+ });
+ purchaseOrderExternalManager = new PurchaseOrderExternalManager(db, {
+ username: 'dev'
+ });
+ purchaseRequestManager = new PurchaseRequestManager(db, {
+ username: 'dev'
+ });
+ done();
+ })
+ .catch(e => {
+ done(e);
+ });
+});
+
+it('#01. should success when create new posted purchase-order-external with purchase-orders', function (done) {
+ purchaseOrderExternalDataUtil.getPosted()
+ .then(poe => {
+ purchaseOrderExternal = poe;
+ done();
+ })
+ .catch(e => {
+ done(e);
+ });
+});
+
+it('#02. should isPosted = true', function (done) {
+ purchaseOrderExternalManager.getSingleByQuery({ _id: purchaseOrderExternal._id })
+ .then((data) => {
+ data.isPosted.should.be.Boolean();
+ data.isPosted.should.equal(true);
+ done();
+ })
+ .catch(e => {
+ done(e);
+ })
+});
+
+it('#03. should success when canceling purchase-order-external', function (done) {
+ purchaseOrderExternalManager.cancel(purchaseOrderExternal._id)
+ .then((poExId) => {
+ purchaseOrderExternalManager.getSingleById(poExId)
+ .then((poe) => {
+ purchaseOrderExternal = poe;
+ JSON.stringify(purchaseOrderExternal.status).should.equal(JSON.stringify(poStatusEnum.VOID));
+ done();
+ })
+ })
+ .catch(e => {
+ done(e);
+ });
+
+});
+
+it('#04. all purchase-order status should be = VOID in purchase-order-external', function (done) {
+ Promise.all(purchaseOrderExternal.items.map(purchaseOrder => {
+ return purchaseOrderManager.getSingleById(purchaseOrder._id);
+ }))
+ .then((results) => {
+ purchaseOrders = results;
+ for (var purchaseOrder of purchaseOrders) {
+ JSON.stringify(purchaseOrder.status).should.equal(JSON.stringify(poStatusEnum.VOID));
+ }
+ done();
+ })
+ .catch(e => {
+ done(e);
+ });
+});
+
+// it('#05. all purchase-request status should be = VOID in purchase-order-external', function (done) {
+// Promise.all(purchaseOrderExternal.items.map(purchaseOrder => {
+// return purchaseRequestManager.getSingleById(purchaseOrder.purchaseRequest._id);
+// }))
+// .then((results) => {
+// purchaseRequests = results;
+// for (var purchaseRequest of purchaseRequests) {
+// JSON.stringify(purchaseRequest.status).should.equal(JSON.stringify(prStatusEnum.VOID));
+// }
+// done();
+// })
+// .catch(e => {
+// done(e);
+// });
+// });
+
+
+
diff --git a/pool/shard005/JavaScript/0034989_team.js b/pool/shard005/JavaScript/0034989_team.js
new file mode 100644
index 0000000000000000000000000000000000000000..9f20e41dac7180d4f977e127820c8afc8577e299
--- /dev/null
+++ b/pool/shard005/JavaScript/0034989_team.js
@@ -0,0 +1,33 @@
+"use strict";
+
+import axios from 'axios';
+
+export default {
+ findAll(params) {
+ if (params === undefined) {
+ params = {
+ itemsPerPage: 1000,
+ page: 1,
+ };
+ }
+ let sort = '';
+ if (params.sortBy) {
+ sort = `&order[${params.sortBy}]=${params.sortDesc ? 'desc' : 'asc'}`;
+ }
+ if (params.filter) {
+ for (const [key, value] of Object.entries(params.filter)) {
+ if (value !== null) {
+ sort += `&${key}=${value}`;
+ }
+ }
+ }
+
+ return axios.get(`/api/teams?page=${params.page}&itemsPerPage=${params.itemsPerPage}` + sort);
+ },
+ change(payload) {
+ return axios.post("/api/teams/change", payload);
+ },
+ create(payload) {
+ return axios.post("/api/teams/create", payload);
+ },
+};
diff --git a/pool/shard005/JavaScript/0034990_NoteManager.js b/pool/shard005/JavaScript/0034990_NoteManager.js
new file mode 100644
index 0000000000000000000000000000000000000000..8ebfadf4cf553cdb4e1c3f74525a43bd8de75084
--- /dev/null
+++ b/pool/shard005/JavaScript/0034990_NoteManager.js
@@ -0,0 +1,50 @@
+load("CancelableTask.js");
+
+/* NoteManager multiplexes a MIDI note event based on timing so that it can
+ * trigger different actions:
+ *
+ * - doubleTapCallback is called when the note is tapped twice within the
+ * timeout.
+ * - holdCallback is called when the note is held longer than the timeout.
+ * - singleTapCallback is called whenever the note is tapped, even if it is part
+ * of a sequence that should be considered a double tap or hold. This is
+ * because there is no way to check if a single tap is part of one of these
+ * sequences without delaying the single tap. Make sure your doubleTapCallback
+ * and holdCallback are aware of this.
+ */
+var NoteManager = function(timeout, singleTapCallback, doubleTapCallback, holdCallback) {
+ this.singleTapCallback = singleTapCallback;
+ this.doubleTapCallback = doubleTapCallback;
+ this.holdCallback = holdCallback;
+ this.noteDown = false;
+
+ var thisManager = this;
+ this.timer = new CancelableTask(function() {
+ if (thisManager.noteDown) {
+ thisManager.holdCallback();
+ }
+ }, timeout);
+}
+
+NoteManager.prototype.onNoteEvent = function(eventType) {
+ switch(eventType) {
+ case MIDI_NOTE_ON:
+ this.noteDown = true;
+ if (this.timer.isActive()) {
+ this.doubleTapCallback();
+ // Prevents the next tap from being detected as a hold too early if it
+ // is started before the timer expires. Bare Bitwig API
+ // tasks (host.scheduleTask(...)) cannot be canceled.
+ this.timer.cancel();
+ } else {
+ this.singleTapCallback();
+ this.timer.start();
+ }
+ break;
+ case MIDI_NOTE_OFF:
+ this.noteDown = false;
+ break;
+ default:
+ break;
+ }
+}
diff --git a/pool/shard005/JavaScript/0034991_errorService.test.js b/pool/shard005/JavaScript/0034991_errorService.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f62f5809ce695157f6f27a6c3fb31e2bc95259d9
--- /dev/null
+++ b/pool/shard005/JavaScript/0034991_errorService.test.js
@@ -0,0 +1,26 @@
+const expect = require('chai').expect;
+const sinon = require('sinon');
+
+let errorService = require('../../../lib/errorService');
+
+describe('errorService', function errorServiceTest() {
+
+ describe('toJson', function toJsonTest() {
+ it('no change to other erorrs', function it() {
+ let err = new Error("my error message");
+ err.name = "SomeError";
+ let newErr = errorService.sanitize(err);
+ expect(newErr.message).to.eq("my error message");
+ });
+
+ it('fix SequelizeDatabaseError', function it() {
+ let err = new Error("some sql");
+ err.name = "SequelizeDatabaseError";
+ let newErr = errorService.sanitize(err);
+ expect(newErr.message).to.eq("Database Error");
+ });
+
+ });
+
+});
+
diff --git a/pool/shard005/JavaScript/0034998_wrapper.js b/pool/shard005/JavaScript/0034998_wrapper.js
new file mode 100644
index 0000000000000000000000000000000000000000..464003bb8e9f51c5dfe308974fd40f7c66f1c9ea
--- /dev/null
+++ b/pool/shard005/JavaScript/0034998_wrapper.js
@@ -0,0 +1,41 @@
+/*!
+ * jSmart JavaScript template engine (v@VERSION)
+ * https://github.com/umakantp/jsmart
+ *
+ * Copyright 2011-2021, Umakant Patil
+ * Max Miroshnikov
+ * https://opensource.org/licenses/MIT
+ *
+ * Date: @DATE
+ */
+(function (factory) {
+ 'use strict'
+
+ if (typeof module === 'object' && module && typeof module.exports === 'object') {
+ // Node.js like environment. Export jSmart
+ module.exports = factory()
+ } else {
+ if (typeof window === 'object' && window.document) {
+ // Assign to browser window if window is present.
+ window.jSmart = factory()
+ }
+
+ if (typeof define === 'function' && define.amd) {
+ // Require js is present? Lets define module.
+ define('jSmart', [], factory)
+ }
+ }
+
+// Pass this if window is not defined yet
+})(function () {
+ 'use strict'
+
+ // @CODE
+
+ String.prototype.fetch = function (data) { // eslint-disable-line no-extend-native
+ var template = new jSmart(this)
+ return template.fetch(data)
+ }
+
+ return jSmart
+})
diff --git a/pool/shard005/JavaScript/0034999_admin.js b/pool/shard005/JavaScript/0034999_admin.js
new file mode 100644
index 0000000000000000000000000000000000000000..defa9a903f8cb848f73b0d74ea40a45455b18c16
--- /dev/null
+++ b/pool/shard005/JavaScript/0034999_admin.js
@@ -0,0 +1,11 @@
+var Unit = {
+ edit: function (obj,id,title) {
+ $('#myModal').modal() // 以默认值初始化
+ $('#myModal').modal({ keyboard: false }) // initialized with no keyboard
+ $('input[name="Title"]').val(title)
+ var html = ' '
+ $('input[name="Title"]').parent().append(html)
+
+ $('#myModal').modal('show') // 初始化后立即调用 show 方法
+ }
+}
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0035003_Ciudad.js b/pool/shard005/JavaScript/0035003_Ciudad.js
new file mode 100644
index 0000000000000000000000000000000000000000..7df6ec895fb75fdfdd5a5fd10ff3815b69a5d806
--- /dev/null
+++ b/pool/shard005/JavaScript/0035003_Ciudad.js
@@ -0,0 +1,104 @@
+'use strict';
+
+var Ciudad = require('../modelos').Ciudad;
+var moment = require('moment');
+
+module.exports = {
+ /**
+ * Se supone que esto debe agregar un usuario
+ */
+ "crearCiudad": (peticion, respuesta) => {
+ var datos = peticion.body.ciudad;
+
+ Ciudad.create(Object.assign({}, datos, { createdAt: moment() })).then((resultado) => {
+ respuesta.status(201).json({
+ mensaje: "Creado Correctamente",
+ datos: resultado,
+ estado: 201
+ });
+ }).catch((err) => {
+ if(process.env.NODE_ENV !== 'production') {
+ console.log(err);
+ }
+
+ resultado.status(500).json({
+ error: "Tenemos problemas al guardar",
+ estado: 500
+ })
+ });
+ },
+ /**
+ * Aqui debería consultar la base de datos para
+ * ver cuantos usuarios existen.
+ */
+ "consultarCiudades": (peticion, respuesta) => {
+ Ciudad.findAll().then((ciudades) => {
+ respuesta.status(200).json({ datos: ciudades, estado: 200 });
+ })
+ },
+
+ /**
+ * Aqui deberia consultar un solo usuario deacuerdo a su id
+ *
+ * @url http://docs.sequelizejs.com/en/latest/docs/querying/#where
+ */
+ "consultarCiudad": (peticion, respuesta) => {
+ var id = peticion.params.ciudadId;
+
+ Ciudad.find({
+ where: { id: id }
+ }).then((ciudad) => {
+ if(ciudad) {
+ respuesta.status(200).json({ datos: ciudad, estado: 200 });
+ } else {
+ respuesta.status(404).json({ error: "No encontrado", estado: 404 })
+ }
+ })
+ },
+
+ "actualizarCiudad": (peticion, respuesta) => {
+ var id = peticion.params.ciudadId;
+ var datos = peticion.body.ciudad;
+
+ Ciudad.update(Object.assign({}, datos, { updatedAt: moment() }), {
+ where: { id: id }
+ }).then((resultado)=> {
+ respuesta.status(201).json({ mensaje: "Actualizado correctamente", estado: 201 });
+ }).catch((err) => {
+ if(process.env.NODE_ENV !== 'production') {
+ console.log(err);
+ }
+
+ resultado.status(500).json({
+ error: "Tenemos problemas al actualizar",
+ estado: 500
+ })
+ })
+ },
+
+ /**
+ * Borrar el usuario
+ */
+ "borrarCiudad": (peticion, respuesta) => {
+ var id = peticion.params.ciudadId;
+
+ Ciudad.destroy({
+ where: { id: id }
+ }).then(() => {
+ respuesta.status(201).json({
+ mensaje: "Borrado correctamente",
+ estado: 201
+ })
+ }).catch((err) => {
+ if(process.env.NODE_ENV !== 'production') {
+ console.log(err);
+ }
+
+ resultado.status(500).json({
+ error: "Tenemos problemas al borrar",
+ estado: 500
+ })
+ })
+
+ }
+}
diff --git a/pool/shard005/JavaScript/0035009_ReactBaseClasses.js b/pool/shard005/JavaScript/0035009_ReactBaseClasses.js
new file mode 100644
index 0000000000000000000000000000000000000000..e45e192a8fd0376e12c735aa31645e4b4f1d3bc1
--- /dev/null
+++ b/pool/shard005/JavaScript/0035009_ReactBaseClasses.js
@@ -0,0 +1,142 @@
+/**
+ * Copyright 2013-present, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ */
+
+'use strict';
+
+var _prodInvariant = require('./reactProdInvariant'),
+ _assign = require('object-assign');
+
+var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
+
+var canDefineProperty = require('./canDefineProperty');
+var emptyObject = require('fbjs/lib/emptyObject');
+var invariant = require('fbjs/lib/invariant');
+var lowPriorityWarning = require('./lowPriorityWarning');
+
+/**
+ * Base class helpers for the updating state of a component.
+ */
+function ReactComponent(props, context, updater) {
+ this.props = props;
+ this.context = context;
+ this.refs = emptyObject;
+ // We initialize the default updater but the real one gets injected by the
+ // renderer.
+ this.updater = updater || ReactNoopUpdateQueue;
+}
+
+ReactComponent.prototype.isReactComponent = {};
+
+/**
+ * Sets a subset of the state. Always use this to mutate
+ * state. You should treat `this.state` as immutable.
+ *
+ * There is no guarantee that `this.state` will be immediately updated, so
+ * accessing `this.state` after calling this method may return the old value.
+ *
+ * There is no guarantee that calls to `setState` will run synchronously,
+ * as they may eventually be batched together. You can provide an optional
+ * callback that will be executed when the call to setState is actually
+ * completed.
+ *
+ * When a function is provided to setState, it will be called at some point in
+ * the future (not synchronously). It will be called with the up to date
+ * component arguments (state, props, context). These values can be different
+ * from this.* because your function may be called after receiveProps but before
+ * shouldComponentUpdate, and this new state, props, and context will not yet be
+ * assigned to this.
+ *
+ * @param {object|function} partialState Next partial state or function to
+ * produce next partial state to be merged with current state.
+ * @param {?function} callback Called after state is updated.
+ * @final
+ * @protected
+ */
+ReactComponent.prototype.setState = function (partialState, callback) {
+ !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0;
+ this.updater.enqueueSetState(this, partialState);
+ if (callback) {
+ this.updater.enqueueCallback(this, callback, 'setState');
+ }
+};
+
+/**
+ * Forces an update. This should only be invoked when it is known with
+ * certainty that we are **not** in a DOM transaction.
+ *
+ * You may want to call this when you know that some deeper aspect of the
+ * component's state has changed but `setState` was not called.
+ *
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
+ * `componentWillUpdate` and `componentDidUpdate`.
+ *
+ * @param {?function} callback Called after update is complete.
+ * @final
+ * @protected
+ */
+ReactComponent.prototype.forceUpdate = function (callback) {
+ this.updater.enqueueForceUpdate(this);
+ if (callback) {
+ this.updater.enqueueCallback(this, callback, 'forceUpdate');
+ }
+};
+
+/**
+ * Deprecated APIs. These APIs used to exist on classic React classes but since
+ * we would like to deprecate them, we're not going to move them over to this
+ * modern base class. Instead, we define a getter that warns if it's accessed.
+ */
+if (process.env.NODE_ENV !== 'production') {
+ var deprecatedAPIs = {
+ isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
+ replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
+ };
+ var defineDeprecationWarning = function (methodName, info) {
+ if (canDefineProperty) {
+ Object.defineProperty(ReactComponent.prototype, methodName, {
+ get: function () {
+ lowPriorityWarning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
+ return undefined;
+ }
+ });
+ }
+ };
+ for (var fnName in deprecatedAPIs) {
+ if (deprecatedAPIs.hasOwnProperty(fnName)) {
+ defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
+ }
+ }
+}
+
+/**
+ * Base class helpers for the updating state of a component.
+ */
+function ReactPureComponent(props, context, updater) {
+ // Duplicated from ReactComponent.
+ this.props = props;
+ this.context = context;
+ this.refs = emptyObject;
+ // We initialize the default updater but the real one gets injected by the
+ // renderer.
+ this.updater = updater || ReactNoopUpdateQueue;
+}
+
+function ComponentDummy() {}
+ComponentDummy.prototype = ReactComponent.prototype;
+ReactPureComponent.prototype = new ComponentDummy();
+ReactPureComponent.prototype.constructor = ReactPureComponent;
+// Avoid an extra prototype jump for these methods.
+_assign(ReactPureComponent.prototype, ReactComponent.prototype);
+ReactPureComponent.prototype.isPureReactComponent = true;
+
+module.exports = {
+ Component: ReactComponent,
+ PureComponent: ReactPureComponent
+};
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0035010_index.js b/pool/shard005/JavaScript/0035010_index.js
new file mode 100644
index 0000000000000000000000000000000000000000..73bcd49833d6f00196872ba874a195fbfe908c69
--- /dev/null
+++ b/pool/shard005/JavaScript/0035010_index.js
@@ -0,0 +1,57 @@
+/**
+ * Allows a professional to add earnings they recieve that
+ * weren't received through a Loconomics booking, including
+ * external platform earnings.
+ *
+ * @module activities/earnings-add
+ *
+ */
+
+import '../../kocomponents/earnings/editor';
+import * as activities from '../index';
+import Activity from '../../components/Activity';
+import UserType from '../../enums/UserType';
+import ko from 'knockout';
+import template from './template.html';
+
+const ROUTE_NAME = 'earnings-add';
+
+export default class EarningsAddActivity extends Activity {
+
+ static get template() { return template; }
+
+ constructor($activity, app) {
+
+ super($activity, app);
+
+ this.accessLevel = UserType.serviceProfessional;
+ this.navBar = Activity.createSubsectionNavBar('Earnings', {
+ backLink: '/earnings'
+ });
+ this.title = 'Add earnings';
+ /**
+ * Creates a placeholder for the external listing ID
+ * to be populated using the show(state) method below.
+ */
+ this.userExternalListingID = ko.observable(null);
+
+ /**
+ * After data being saved, notice and go back
+ */
+ this.onSaved = () => {
+ app.successSave();
+ };
+ }
+
+ show(state) {
+ super.show(state);
+ var params = state.route && state.route.segments;
+ /**
+ * userExternalListingID as the first segment in the activity URL,
+ * allowing to preset that value in the new earnings entry.
+ */
+ this.userExternalListingID(params[0] |0);
+ }
+}
+
+activities.register(ROUTE_NAME, EarningsAddActivity);
diff --git a/pool/shard005/JavaScript/0035015_crm-report-targets.js b/pool/shard005/JavaScript/0035015_crm-report-targets.js
new file mode 100644
index 0000000000000000000000000000000000000000..a301a74e47e802c8f6fa45faa9ad6fd89c216d07
--- /dev/null
+++ b/pool/shard005/JavaScript/0035015_crm-report-targets.js
@@ -0,0 +1,28 @@
+'use strict';
+
+/* Controllers */
+
+app.controller('CustomerCountCtrl', ['$scope', function($scope) {
+ $scope.chart1 = [ [1,8.5],[2,5.5],[3,8],[4,4],[5,4.5],[6,6],[7,6.8],[8,8],[9,5.2],[10,8],[11,8.8],[12,5] ];
+
+ $scope.chart2 = [ [0,8],[1,4.5],[2,15.5],[3,3],[4,4],[5,8],[6,1],[7,8.5],[8,4],[9,9] ];
+
+ $scope.chart3 = [ [0,5],[1,7.5],[2,4],[3,6.5],[4,7],[5,3.5],[6,4],[7,9],[8,3],[9,8] ];
+
+ $scope.chart4_1 = [ [10, 80], [20, 120], [30, 50], [40, 90] ];
+
+ $scope.chart4_2 = [ [10, 60], [20, 80], [30, 50], [40, 45] ];
+
+ $scope.chart4_3 = [ [10, 50], [40, 80], [60, 70], [60, 90] ];
+
+
+ $scope.chart5 = [
+ { label: "Online Ads", data: 40 },
+ { label: "Direct Contacts", data: 10 },
+ { label: "Sales Communication Team", data: 20 },
+ { label: "Newspaper", data: 12 },
+ { label: "Other", data: 18 }
+ ];
+
+
+ }]);
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0035018_cli.js b/pool/shard005/JavaScript/0035018_cli.js
new file mode 100644
index 0000000000000000000000000000000000000000..f048db5dcbc303f126ea491924fa6a19960e2667
--- /dev/null
+++ b/pool/shard005/JavaScript/0035018_cli.js
@@ -0,0 +1,55 @@
+#!/usr/bin/env node
+require('babel-polyfill')
+const cli = require('cli').enable('status', 'help', 'version', 'glob', 'timeout')
+const Environmental = require('./environmental')
+
+cli.parse({
+ 'file' : [false, 'Environment file to capture e.g. envs/production.sh', 'file'],
+ 'format': [false, "Out format e.g. 'json' or 'space'", 'string', 'json'],
+})
+
+cli.main(function (args, options) {
+ const config = {}
+
+ // Camelcase cli arguments into config object to instantiate environmental
+ for (const key in options) {
+ const camelCased = key.replace(/-(.)/g, g => g[1].toUpperCase())
+ config[camelCased] = options[key]
+ }
+ if (!config.file) {
+ return cli.fatal('File argument is required.')
+ }
+
+ // Instantiate
+ const environmental = new Environmental(config)
+
+ // Capture
+ environmental.capture(config.file, (err, flat) => {
+ if (err) {
+ console.error(`Error. ${err}`)
+ process.exit(1)
+ }
+
+ // Collect bash encoded output
+ const output = []
+ for (const key in flat) {
+ let val = (`${flat[key]}`)
+ if (val.indexOf(' ') > -1 || val.indexOf('\t') > -1 || !val) {
+ // Quote when necessary
+ val = `"${val}"`
+ }
+ output.push(`${key}=${val}`)
+ }
+
+ // Decide on format
+ if (config.format === 'json') {
+ console.log(JSON.stringify(flat))
+ } else if (config.format === 'space') {
+ console.log(output.join(' '))
+ } else if (config.format === 'newline') {
+ console.log(output.join('\n'))
+ } else {
+ return cli.fatal(`Unknown output format ${config.format}`)
+ }
+ })
+})
diff --git a/pool/shard005/JavaScript/0035021_gulpfile.js b/pool/shard005/JavaScript/0035021_gulpfile.js
new file mode 100644
index 0000000000000000000000000000000000000000..6ea3a1e747cca1a020b682838bb04c7b5eed2401
--- /dev/null
+++ b/pool/shard005/JavaScript/0035021_gulpfile.js
@@ -0,0 +1,74 @@
+var gulp = require('gulp'),
+ nodemon = require('gulp-nodemon'),
+ mocha = require('gulp-mocha'),
+ env = require('gulp-env');
+var concat = require('gulp-concat');
+var cssnano = require('gulp-cssnano');
+var uglify = require('gulp-uglify');
+var inject = require('gulp-inject');
+var pipeLine = require('./tasks/pipeline');
+
+gulp.task('nodemon', function () {
+ nodemon({
+ script: "bin/www",
+ env: {
+ NODE_ENV: 'development',
+ PORT: '3000'
+ }
+ });
+});
+
+gulp.task('watch', function () {
+ gulp.watch(
+ ['bin/www', './**/*.js'],
+ ['mocha']
+ );
+});
+
+gulp.task('mocha', function () {
+ env({
+ vars: {
+ NODE_ENV: 'testing',
+ PORT: 3001
+ }
+ });
+ return gulp.src('test/**/AuthController.test.js')
+ .pipe(mocha({
+ bail: false
+ }).on('error', function () { })
+ //do nothing
+ );
+});
+
+gulp.task('inject', function () {
+ var sources = gulp.src(pipeLine.injectFile, { read: false });
+ // Read templates
+ gulp.src('./views/layout*.html')
+ // Link the JavaScript and css
+ .pipe(inject(sources, { ignorePath: 'public' }))
+ // Write modified files to views
+ .pipe(gulp.dest('./views'));
+});
+
+gulp.task("production", function () {
+ //min css
+ gulp.src(require('./tasks/pipeline').cssFilesToInject)
+ .pipe(concat('production.min.css'))
+ .pipe(cssnano())
+ .pipe(gulp.dest('./public/dist'));
+ //min js
+ gulp.src(require('./tasks/pipeline').jsFilesToInject)
+ .pipe(concat('production.min.js'))
+ .pipe(uglify())
+ .pipe(gulp.dest('./public/dist'));
+ //inject
+ var sources = gulp.src(["./public/dist/production.min.js", "./public/dist/production.min.css"], { read: false });
+ // Read templates
+ gulp.src('./views/layout*.html')
+ // Link the JavaScript and css
+ .pipe(inject(sources, { ignorePath: 'public' }))
+ // Write modified files to views
+ .pipe(gulp.dest('./views'));
+});
+
+gulp.task('default', ['inject', 'nodemon']);
diff --git a/pool/shard005/JavaScript/0035023_gulpfile.js b/pool/shard005/JavaScript/0035023_gulpfile.js
new file mode 100644
index 0000000000000000000000000000000000000000..2a7665ca34a284a49fa771d399e043cf281d76a6
--- /dev/null
+++ b/pool/shard005/JavaScript/0035023_gulpfile.js
@@ -0,0 +1,51 @@
+'use strict';
+
+var gulp = require('gulp'),
+ karma = require('gulp-karma'),
+ uglify = require('gulp-uglify'),
+ rename = require('gulp-rename'),
+ zopfli = require('gulp-zopfli');
+
+var testingSrc = [
+ 'node_modules/jquery/dist/jquery.js',
+ 'node_modules/localforage/dist/localforage.js',
+ 'node_modules/angular/angular.js',
+ 'node_modules/angular-mocks/angular-mocks.js',
+ 'node_modules/angular-localforage/dist/angular-localForage.js',
+ "src/*.js",
+ "test/setup.coffee",
+ "test/*-spec.coffee"
+]
+
+gulp.task('test', function() {
+ return gulp
+ .src(testingSrc)
+ .pipe(karma({
+ configFile: 'karma.conf.js',
+ action: 'run'
+ }))
+ .on('error', function(err) {
+ throw err; // Make sure failed tests cause gulp to exit non-zero
+ });
+});
+
+gulp.task('test:watch', function() {
+ return gulp
+ .src(testingSrc)
+ .pipe(karma({
+ configFile: 'karma.conf.js',
+ action: 'watch'
+ }))
+});
+
+
+gulp.task('dist', function(){
+ return gulp
+ .src('src/angular-bandit-client.js')
+ .pipe(gulp.dest('dist/'))
+ .pipe(uglify({preserveComments:false}))
+ .pipe(rename({suffix: '.min'}))
+ .pipe(gulp.dest('dist/'))
+ .pipe(zopfli({append: true}))
+ .pipe(gulp.dest('dist/'));
+});
diff --git a/pool/shard005/JavaScript/0035030_main.js b/pool/shard005/JavaScript/0035030_main.js
new file mode 100644
index 0000000000000000000000000000000000000000..25d6dbd1a2723ba5c1485889aafabf16f59cb445
--- /dev/null
+++ b/pool/shard005/JavaScript/0035030_main.js
@@ -0,0 +1,144 @@
+/*---------------------------------------------------------------------------------------------
+ * Copyright (c) Microsoft Corporation. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ *--------------------------------------------------------------------------------------------*/
+
+// Perf measurements
+global.vscodeStart = Date.now();
+
+var app = require('electron').app;
+var fs = require('fs');
+var path = require('path');
+var paths = require('./paths');
+var pkg = require('../package.json');
+
+function stripComments(content) {
+ var regexp = /("(?:[^\\\"]*(?:\\.)?)*")|('(?:[^\\\']*(?:\\.)?)*')|(\/\*(?:\r?\n|.)*?\*\/)|(\/{2,}.*?(?:(?:\r?\n)|$))/g;
+ var result = content.replace(regexp, function (match, m1, m2, m3, m4) {
+ // Only one of m1, m2, m3, m4 matches
+ if (m3) {
+ // A block comment. Replace with nothing
+ return '';
+ }
+ else if (m4) {
+ // A line comment. If it ends in \r?\n then keep it.
+ var length_1 = m4.length;
+ if (length_1 > 2 && m4[length_1 - 1] === '\n') {
+ return m4[length_1 - 2] === '\r' ? '\r\n' : '\n';
+ }
+ else {
+ return '';
+ }
+ }
+ else {
+ // We match a string
+ return match;
+ }
+ });
+ return result;
+};
+
+function getNLSConfiguration() {
+ var locale = undefined;
+ var localeOpts = '--locale';
+ for (var i = 0; i < process.argv.length; i++) {
+ var arg = process.argv[i];
+ if (arg.slice(0, localeOpts.length) == localeOpts) {
+ var segments = arg.split('=');
+ locale = segments[1];
+ break;
+ }
+ }
+
+ if (!locale) {
+ var userData = app.getPath('userData');
+ var localeConfig = path.join(userData, 'User', 'locale.json');
+ if (fs.existsSync(localeConfig)) {
+ try {
+ var content = stripComments(fs.readFileSync(localeConfig, 'utf8'));
+ var value = JSON.parse(content).locale;
+ if (value && typeof value === 'string') {
+ locale = value;
+ }
+ } catch (e) {
+ }
+ }
+ }
+
+ var appLocale = app.getLocale();
+ locale = locale || appLocale;
+ // Language tags are case insensitve however an amd loader is case sensitive
+ // To make this work on case preserving & insensitive FS we do the following:
+ // the language bundles have lower case language tags and we always lower case
+ // the locale we receive from the user or OS.
+ locale = locale ? locale.toLowerCase() : locale;
+ if (locale === 'pseudo') {
+ return { locale: locale, availableLanguages: {}, pseudo: true }
+ }
+ var initialLocale = locale;
+ if (process.env['VSCODE_DEV']) {
+ return { locale: locale, availableLanguages: {} };
+ }
+
+ // We have a built version so we have extracted nls file. Try to find
+ // the right file to use.
+
+ // Check if we have an English locale. If so fall to default since that is our
+ // English translation (we don't ship *.nls.en.json files)
+ if (locale && (locale == 'en' || locale.startsWith('en-'))) {
+ return { locale: locale, availableLanguages: {} };
+ }
+
+ function resolveLocale(locale) {
+ while (locale) {
+ var candidate = path.join(__dirname, 'vs', 'code', 'electron-main', 'main.nls.') + locale + '.js';
+ if (fs.existsSync(candidate)) {
+ return { locale: initialLocale, availableLanguages: { '*': locale } };
+ } else {
+ var index = locale.lastIndexOf('-');
+ if (index > 0) {
+ locale = locale.substring(0, index);
+ } else {
+ locale = null;
+ }
+ }
+ }
+ return null;
+ }
+
+ var resolvedLocale = resolveLocale(locale);
+ if (!resolvedLocale && appLocale && appLocale !== locale) {
+ resolvedLocale = resolveLocale(appLocale);
+ }
+ return resolvedLocale ? resolvedLocale : { locale: initialLocale, availableLanguages: {} };
+}
+
+// Update cwd based on environment and platform
+try {
+ if (process.platform === 'win32') {
+ process.env['VSCODE_CWD'] = process.cwd(); // remember as environment variable
+ process.chdir(path.dirname(app.getPath('exe'))); // always set application folder as cwd
+ } else if (process.env['VSCODE_CWD']) {
+ process.chdir(process.env['VSCODE_CWD']);
+ }
+} catch (err) {
+ console.error(err);
+}
+
+// Set userData path before app 'ready' event
+var userData = paths.getUserDataPath(process.platform, pkg.name, process.argv);
+app.setPath('userData', userData);
+
+// Mac: when someone drops a file to the not-yet running VSCode, the open-file event fires even before
+// the app-ready event. We listen very early for open-file and remember this upon startup as path to open.
+global.macOpenFiles = [];
+app.on('open-file', function (event, path) {
+ global.macOpenFiles.push(path);
+});
+
+// Load our code once ready
+app.once('ready', function () {
+ var nlsConfig = getNLSConfiguration();
+ process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfig);
+ require('./bootstrap-amd').bootstrap('vs/code/electron-main/main');
+});
diff --git a/pool/shard005/JavaScript/0035031_editable-list.controller.js b/pool/shard005/JavaScript/0035031_editable-list.controller.js
new file mode 100644
index 0000000000000000000000000000000000000000..0722425576fd7f610c5728cdecb89001392c3c9c
--- /dev/null
+++ b/pool/shard005/JavaScript/0035031_editable-list.controller.js
@@ -0,0 +1,43 @@
+(function () {
+
+ angular
+ .module('firstClass')
+ .controller('EditableListController', EditableListController);
+
+ EditableListController.$inject = [''];
+
+ /* @ngInject */
+ function EditableListController() {
+ /* jshint validthis: true */
+ var vm = this;
+
+ vm.activate = activate;
+ vm.title = 'EditableListController';
+ vm.items = vm.items;
+ vm.addItem = addItem;
+ vm.deleteItem = deleteItem;
+ vm.editItem = editItem;
+
+ function addItem (event) {
+ console.log('added item');
+ }
+
+ function deleteItem (event, item) {
+ console.log('deleted item' + item);
+ }
+
+ function editItem (event, item) {
+ console.log('edited item' + item);
+ }
+
+ activate();
+
+ ////////////////
+
+ function activate() {
+ }
+
+
+ }
+
+}());
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0035034_restaurants-nchl.client.controller.js b/pool/shard005/JavaScript/0035034_restaurants-nchl.client.controller.js
new file mode 100644
index 0000000000000000000000000000000000000000..ceebd71c7c210983abdac32db2c263c6842dacaa
--- /dev/null
+++ b/pool/shard005/JavaScript/0035034_restaurants-nchl.client.controller.js
@@ -0,0 +1,212 @@
+'use strict';
+/*global $:false */
+
+angular.module('restaurants').controller('Restaurants-nchl-Controller', ['$scope', '$stateParams', '$location', 'Authentication', 'Restaurants', 'Preorders',
+ function($scope, $stateParams, $location, Authentication, Restaurants, Preorders) {
+ $scope.authentication = Authentication;
+
+ $scope.find = function() {
+
+ $scope.restaurants = Restaurants.query(function(){});
+ };
+
+ $scope.findOne = function() {
+ $scope.restaurant = Restaurants.getmenu({
+ restaurantId: $stateParams.restaurantId
+ });
+ };
+
+ $scope.create = function() {
+
+ var restaurants = new Restaurants({
+ name: this.name,
+ description: this.description
+ });
+
+ restaurants.$save(function(response) {
+ $location.path('restaurants/' + response._id);
+
+ $scope.name = '';
+ $scope.description = '';
+
+ }, function(errorResponse) {
+ $scope.error = errorResponse.data.message;
+ });
+ };
+
+ $scope.findMyRestaurants = function(){
+ $scope.restaurants = Restaurants.mine();
+ };
+
+
+ // '' nunchl adaptations.. ''
+ // ---------------------------
+ $scope.selectedCategory = -1;
+ $scope.selectedMeal = -1;
+
+ $scope.firstTime = true;
+
+ $scope.preorder = {total: 0, meals:[]};
+
+ $scope.selectCategory = function ($index) {
+ $scope.selectedCategory = $index;
+ $scope.firstTime = false;
+
+ //scroll
+ $scope.scrollBackCategories();
+ };
+
+ $scope.selectMeal = function ($index, MealID) {
+ //if the user change the Meal we need to reset the mealItems
+ if ($scope.selectedMeal !== $index) {
+ $scope.mealItems = [];
+ }
+ $scope.selectedMeal = $index;
+ };
+
+ $scope.resetCategory = function () {
+
+ $scope.firstTime = true;
+ $scope.selectedCategory = -1;
+
+ //reset all
+ $scope.mealItems = [];
+ $scope.selectedMeal = -1;
+
+ };
+
+
+ $scope.AddPreOrder = function () {
+
+ this.$hide();
+
+ // var category = $scope.menu.Categories[$scope.selectedCategory].Id;
+ // var _categoryName = $scope.menu.Categories[$scope.selectedCategory].Name;
+ // var item_ID = $scope.menu.Categories[$scope.selectedCategory].Meals[$scope.selectedMeal].Id;
+ // var item_Name = $scope.menu.Categories[$scope.selectedCategory].Meals[$scope.selectedMeal].Name;
+ // var price = $scope.menu.Categories[$scope.selectedCategory].Meals[$scope.selectedMeal].Price; //WTF, plz change it. Wrong.
+ //
+ // var mealItems = [];
+ //
+ // $.each($scope.mealItems, function (key, val) {
+ //
+ // if ($.isNumeric(val)) { //Normal Case
+ // var mealsubItemID = $scope.menu.Categories[$scope.selectedCategory].Meals[$scope.selectedMeal].MealItems[val].Id;
+ // var mealsubItemName = $scope.menu.Categories[$scope.selectedCategory].Meals[$scope.selectedMeal].MealItems[val].Name;
+ // var mealsubItemPrice = $scope.menu.Categories[$scope.selectedCategory].Meals[$scope.selectedMeal].MealItems[val].Price;
+ // //calculte Price
+ // price += mealsubItemPrice;
+ //
+ // //js_* prefix is only for the client side, no need of theses values on the server.
+ // mealItems.push({ MealItemId: mealsubItemID, js_SubItem: mealsubItemName, js_SubItemPrice: mealsubItemPrice });
+ // } else { //Choice Case
+ // var mealsubItemID = $scope.menu.Categories[$scope.selectedCategory].Meals[$scope.selectedMeal].MealItems[val._index].Id;
+ // var mealsubItemName = $scope.menu.Categories[$scope.selectedCategory].Meals[$scope.selectedMeal].MealItems[val._index].Name;
+ //
+ // //alert(val._selectedChoice.Price); //Choice Item Price
+ // price += val._selectedChoice.Price;
+ //
+ // mealItems.push({
+ // MealItemId: mealsubItemID,
+ // choiceID: val._selectedChoice.Id,
+ // js_SubItem: mealsubItemName,
+ // js_choiceName: val._selectedChoice.Name,
+ // js_choicePrice: val._selectedChoice.Price
+ // });
+ // }
+ // });
+
+
+ //js_* prefix is only for the client side, no need of theses values on the server.
+ $scope.preorder.meals.push({
+ category: $scope.restaurant.menu[$scope.selectedCategory]._id,
+ meal: $scope.restaurant.menu[$scope.selectedCategory].meals[$scope.selectedMeal]._id,
+ price: $scope.restaurant.menu[$scope.selectedCategory].meals[$scope.selectedMeal].price,
+ unityPrice: $scope.restaurant.menu[$scope.selectedCategory].meals[$scope.selectedMeal].price,
+ quantity: 1,
+ js_MealName: $scope.restaurant.menu[$scope.selectedCategory].meals[$scope.selectedMeal].name,
+ js_DisplayTotal: $scope.restaurant.menu[$scope.selectedCategory].meals[$scope.selectedMeal].price,
+ js_CategoryName: $scope.restaurant.menu[$scope.selectedCategory].name
+ });
+ // $scope.preorder.total += 69.00;
+
+ setTimeout(function () {
+ $scope.firstTime = true;
+ $scope.selectedCategory = -1;
+
+ ////reset all
+ $scope.selectedMeal = -1;
+ $scope.$apply();
+ $scope.scrollTOP();
+ console.log('DONE :D');
+ }, 500);
+ };
+
+
+ $scope.scrollTOP = function () {
+ $('html, body').animate({
+ scrollTop: 0
+ }, 500);
+ };
+
+ $scope.scrollBackCategories = function () {
+ $('html, body').animate({
+ scrollTop: $('#backCategoryButton').offset().top
+ }, 500);
+
+ $('#backCategoryButton').blur();
+ };
+
+ $scope.ValidatePreOrder = function () {
+
+ // userId:{
+ // type: Schema.ObjectId,
+ // ref: 'User'
+ // },
+ //
+ // userName:{type: String, required: 'Please fill UserName', trim:true},
+ // pickUpTime:{type: Date, required: 'Please fill pickUpTime'},
+ // total:{type: Number, default: 0, required: 'total is required'},
+ // status: {type: Number, default: 0},
+ //
+ // items:[{
+ // categoryId:{type: Schema.ObjectId, ref: 'Category'},
+ // categoryName:{type: String},
+ // mealId:{type: Schema.ObjectId, ref: 'Meal'},
+ // mealName:{type: String, required: 'mealName is required'},
+ // mealPrice:{type: Number, default: 0, required: 'mealPrice is required'},
+ // mealItems:[String]
+ // }],
+
+ var _items = [];
+
+ angular.forEach(this.preorder.meals, function(m, key) {
+ _items.push({
+ categoryId : m.category,
+ categoryName : m.js_CategoryName,
+ mealId: m.meal,
+ mealName: m.js_MealName,
+ mealPrice: m.unityPrice
+ });
+ });
+
+ var preorder = new Preorders ({
+ restaurantId: $stateParams.restaurantId,
+ name: 'playing with nunchl',
+ pickUpTime : new Date(),
+ userId: this.authentication.user._id,
+ userName : this.authentication.user.username,
+ total : this.preorder.total,
+ items : _items
+ });
+
+ // Redirect after save
+ preorder.$save(function(response) {
+ $location.path('preorders/' + response._id);
+ }, function(errorResponse) {
+ alert(errorResponse.data.message);
+ });
+ };
+
+ }
+]);
diff --git a/pool/shard005/JavaScript/0035036_BookmarksGrid.js b/pool/shard005/JavaScript/0035036_BookmarksGrid.js
new file mode 100644
index 0000000000000000000000000000000000000000..384d5d9f6b9eb676e57a481bd1efa5768c993f72
--- /dev/null
+++ b/pool/shard005/JavaScript/0035036_BookmarksGrid.js
@@ -0,0 +1,104 @@
+GO.files.BookmarksGrid = function(config) {
+
+ var config = config || {};
+
+ config.title = t("Favorites", "files");
+ config.collapsible=true;
+ config.stateId='fs-bookmarks';
+ config.layout = 'fit';
+ config.split = true;
+ config.paging = false;
+ config.cls = 'go-grid3-hide-headers';
+ config.height = 200;
+ config.store = new GO.data.JsonStore({
+ url:GO.url("files/bookmark/store"),
+ id: 'folder_id',
+ fields:["folder_id","name"],
+ remoteSort:true
+ });
+ config.columns = [{
+ header:t("Name"),
+ renderer:function(v, meta, r){
+ return 'folder '+v;
+ },
+ dataIndex: 'name',
+// renderer:function(v, metaData,record){
+// return ''+v+'
';
+// },
+ sortable:true
+ }];
+ config.view = new Ext.grid.GridView({
+ autoFill:true,
+ forceFit:true
+ });
+ config.sm = new Ext.grid.RowSelectionModel();
+ config.loadMask = true;
+
+ config.bbar = new GO.SmallPagingToolbar({
+// items:[this.searchField = new GO.form.SearchField({
+// store: config.store,
+// width:120,
+// emptyText: t("Search")
+// })],
+ store:config.store,
+ pageSize:GO.settings.config.nav_page_size
+ })
+
+ GO.files.BookmarksGrid.superclass.constructor.call(this,config);
+
+ this.addEvents({
+ 'bookmarkClicked' : true,
+ 'delete' : true
+ });
+
+ this.on('rowcontextmenu',function(grid,rowIndex,event){
+ this._clickedBookmarkRecord = grid.getStore().getAt(rowIndex);
+ if (GO.util.empty(this._contextMenu))
+ this._createContextMenu();
+ this._contextMenu.showAt(event.getXY());
+ },this);
+
+ this.on('rowclick',function(grid,rowIndex,event){
+ this.fireEvent('bookmarkClicked', this, grid.getStore().getAt(rowIndex));
+ },this);
+
+};
+
+Ext.extend(GO.files.BookmarksGrid,GO.grid.GridPanel,{
+
+ _clickedBookmarkRecord : false,
+
+ _createContextMenu : function() {
+ this._contextMenu = new Ext.menu.Menu({
+ shadow : 'frame',
+ minWidth : 180,
+ items : [{
+ iconCls: 'ic-delete',
+ text: t("Delete"),
+ handler: function(){
+ this._promptDelete(this._clickedBookmarkRecord);
+ },
+ scope: this
+ }]
+ });
+ },
+
+ _promptDelete : function(bookmarkRecord) {
+ GO.deleteItems({
+ url:GO.url('files/bookmark/delete'),
+ params:{
+ folder_id: bookmarkRecord.data['folder_id']
+ },
+ count:1,
+ callback:function(responseParams){
+ if(responseParams.success) {
+ this.store.load();
+ this.fireEvent('delete', this, bookmarkRecord );
+ }
+ this._clickedBookmarkRecord = false;
+ },
+ scope:this
+ });
+ }
+
+});
diff --git a/pool/shard005/JavaScript/0035040_pagesearchresults.js b/pool/shard005/JavaScript/0035040_pagesearchresults.js
new file mode 100644
index 0000000000000000000000000000000000000000..57ef2a6d9213a36cc4f03c7103a1c8171adda174
--- /dev/null
+++ b/pool/shard005/JavaScript/0035040_pagesearchresults.js
@@ -0,0 +1,44 @@
+define([
+ 'jQuery',
+ 'Underscore',
+ 'Backbone',
+ 'views/searchresults'
+], function($, _, BackBone, SearchResultsView) {
+
+ // the results view is just tied to a collection and re-renders itself
+ var PageSearchResultsView = SearchResultsView.extend({
+
+ events: {
+ 'click a' : 'onClickAnchor'
+ },
+
+ initialize: function() {
+ _.bindAll(this, 'render', 'startSpinner', 'onClickAnchor');
+ this.collection.bind('reset', this.render);
+ this.$searchResults = $('#search-results');
+ },
+
+ onClickAnchor: function(evt) {
+ if (e.button > 0)
+ return;
+ if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)
+ return;
+
+ var $anchor = this.$(evt.currentTarget);
+ var href = $anchor.attr('href');
+
+ if (href.charAt(0) === '#') {
+ // Internal link
+ var searchResultsTopVal = this.$searchResults.scrollTop();
+ var topVal = $('#' + href).offset().top; // ID selection is the fastest
+ this.$searchResults.scrollTop(searchResultsTopVal + topVal - 60);
+ evt.stopPropagation();
+ evt.preventDefault();
+ }
+ },
+
+ });
+
+ return PageSearchResultsView;
+});
+
diff --git a/pool/shard005/JavaScript/0035042_middleware.js b/pool/shard005/JavaScript/0035042_middleware.js
new file mode 100644
index 0000000000000000000000000000000000000000..eb5600492225337cda6162ccf1a2cca081c31819
--- /dev/null
+++ b/pool/shard005/JavaScript/0035042_middleware.js
@@ -0,0 +1,81 @@
+// @flow
+
+import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../app';
+import { MiddlewareRegistry } from '../redux';
+
+import { USER_INTERACTION_RECEIVED } from './actionTypes';
+
+/**
+ * Reference to any callback that has been created to be invoked on user
+ * interaction.
+ *
+ * @type {Function|null}
+ */
+let userInteractionListener = null;
+
+/**
+ * Implements the entry point of the middleware of the feature base/user-interaction.
+ *
+ * @param {Store} store - The redux store.
+ * @returns {Function}
+ */
+MiddlewareRegistry.register(store => next => action => {
+ switch (action.type) {
+ case APP_WILL_MOUNT:
+ _startListeningForUserInteraction(store);
+ break;
+
+ case APP_WILL_UNMOUNT:
+ _stopListeningForUserInteraction();
+ break;
+ }
+
+ return next(action);
+});
+
+/**
+ * Callback invoked when the user interacts with the page.
+ *
+ * @param {Function} dispatch - The redux dispatch function.
+ * @param {Object} event - The DOM event for a user interacting with the page.
+ * @private
+ * @returns {void}
+ */
+function _onUserInteractionReceived(dispatch, event) {
+ if (event.isTrusted) {
+ dispatch({
+ type: USER_INTERACTION_RECEIVED
+ });
+
+ _stopListeningForUserInteraction();
+ }
+}
+
+/**
+ * Registers listeners to notify redux of any user interaction with the page.
+ *
+ * @param {Object} store - The redux store.
+ * @private
+ * @returns {void}
+ */
+function _startListeningForUserInteraction({ dispatch }) {
+ _stopListeningForUserInteraction();
+
+ userInteractionListener = _onUserInteractionReceived.bind(null, dispatch);
+
+ window.addEventListener('mousedown', userInteractionListener);
+ window.addEventListener('keydown', userInteractionListener);
+}
+
+/**
+ * De-registers listeners for user interaction with the page.
+ *
+ * @private
+ * @returns {void}
+ */
+function _stopListeningForUserInteraction() {
+ window.removeEventListener('mousedown', userInteractionListener);
+ window.removeEventListener('keydown', userInteractionListener);
+
+ userInteractionListener = null;
+}
diff --git a/pool/shard005/JavaScript/0035044_confirm.js b/pool/shard005/JavaScript/0035044_confirm.js
new file mode 100644
index 0000000000000000000000000000000000000000..3603150b96f1e1039bee6ee053e744431f160a46
--- /dev/null
+++ b/pool/shard005/JavaScript/0035044_confirm.js
@@ -0,0 +1,92 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+define([
+ 'intern',
+ 'intern!object',
+ 'intern/chai!assert',
+ 'require',
+ 'tests/lib/helpers',
+ 'tests/functional/lib/helpers'
+], function (intern, registerSuite, assert, require, TestHelpers, FunctionalHelpers) {
+ 'use strict';
+
+ var config = intern.config;
+ var CONFIRM_URL = config.fxaContentRoot + 'confirm';
+ var SIGNUP_URL = config.fxaContentRoot + 'signup';
+ var TOO_YOUNG_YEAR = new Date().getFullYear() - 13;
+
+ registerSuite({
+ name: 'confirm',
+
+ beforeEach: function () {
+ // clear localStorage to avoid polluting other tests.
+ return FunctionalHelpers.clearBrowserState(this);
+ },
+
+ 'visit confirmation screen without initiating sign up, user is redirected to /signup': function () {
+ return this.get('remote')
+ .get(require.toUrl(CONFIRM_URL))
+ .setFindTimeout(intern.config.pageLoadTimeout)
+
+ // user is immediately redirected to /signup if they have no
+ // sessionToken.
+ // Success is showing the screen
+ .findByCssSelector('#fxa-signup-header');
+ },
+
+ 'sign up, wait for confirmation screen, click resend': function () {
+ var email = TestHelpers.createEmail();
+ var password = '12345678';
+
+ return this.get('remote')
+ .get(require.toUrl(SIGNUP_URL))
+ .findByCssSelector('form input.email')
+ .click()
+ .type(email)
+ .end()
+
+ .findByCssSelector('form input.password')
+ .click()
+ .type(password)
+ .end()
+
+ .findByCssSelector('#fxa-age-year')
+ .end()
+
+ .findByCssSelector('#fxa-' + (TOO_YOUNG_YEAR - 1))
+ .click()
+ .end()
+
+ .findByCssSelector('button[type="submit"]')
+ .click()
+ .end()
+
+ // Being pushed to the confirmation screen is success.
+ .findByCssSelector('.verification-email-message')
+ .getVisibleText()
+ .then(function (resultText) {
+ // check the email address was written
+ assert.ok(resultText.indexOf(email) > -1);
+ })
+ .end()
+
+ .findByCssSelector('#resend')
+ .click()
+ .end()
+
+ // the test below depends on the speed of the email resent XHR
+ // we have to wait until the resent request completes and the success notification is visible
+ .then(FunctionalHelpers.visibleByQSA('.success'))
+
+ .then(function (result) {
+ assert.ok(result);
+ }, function (error) {
+ // success was never displayed
+ assert.fail(error);
+ })
+ .end();
+ }
+ });
+});
diff --git a/pool/shard005/JavaScript/0035049_utilities.js b/pool/shard005/JavaScript/0035049_utilities.js
new file mode 100644
index 0000000000000000000000000000000000000000..564a3aedc15a309f5c5380770fee674af210db2a
--- /dev/null
+++ b/pool/shard005/JavaScript/0035049_utilities.js
@@ -0,0 +1,172 @@
+(function ($, undefined) {
+ $.namespace('Earthserver.Client.Utilities');
+
+ var callWSdefaults = {
+ showLoader: false
+ };
+
+ Earthserver.Client.Utilities.callWS = function (url, type, options) {
+ options = $.extend({}, callWSdefaults, options || {});
+
+ var requestData = type.toLowerCase() === 'get' ? options.requestData : JSON.stringify(options.requestData);
+ var contentType = options.hasOwnProperty("contentType") ? options.contentType : "application/json; charset=utf-8";
+ var dataType = options.hasOwnProperty("dataType") ? options.dataType : "json";
+
+ $.ajax({
+ url: url,
+ type: type,
+ contentType: contentType,
+ dataType: dataType,
+ data: requestData,
+ success: function (data) {
+ //if (options.showLoader) $.hideLoader();
+
+ if (options.hasOwnProperty("onSuccess")) {
+ var payload = data;
+ options.onSuccess(payload);
+ }
+ },
+ error: function (data) {
+ //if (options.showLoader) $.hideLoader();
+
+ if (options.hasOwnProperty('onError')) {
+ options.onError(data);
+ }
+ }
+ });
+ //if (options.showLoader) $.showLoader();
+ };
+
+ Earthserver.Client.Utilities.createColumnDefinition = function (name, caption, isHidden, isKey) {
+ var columnDef = {};
+
+ columnDef.Name = name;
+ columnDef.Caption = caption;
+ columnDef.ShortCaption = caption;
+ columnDef.ColumnCSSClass = "";
+ columnDef.IsHidden = isHidden;
+ columnDef.IsSortable = false;
+ columnDef.IsHeaderCheckable = false;
+ columnDef.ShowTooltips = true;
+ columnDef.Width = 0;
+ columnDef.IsKey = isKey;
+
+ return columnDef;
+ };
+
+ Earthserver.Client.Utilities.toGridPP = function () {
+ var result = {};
+
+ var columnDefs = [];
+
+ {
+ var columnDef = Earthserver.Client.Utilities.createColumnDefinition("ID", "ID", true, true);
+ columnDefs.push(columnDef);
+ }
+ {
+ var columnDef = Earthserver.Client.Utilities.createColumnDefinition("Endpoint", "Endpoint", false, false);
+ columnDefs.push(columnDef);
+ }
+ {
+ var columnDef = Earthserver.Client.Utilities.createColumnDefinition("EndpointAlias", "Endpoint Alias", false, false);
+ columnDefs.push(columnDef);
+ }
+ {
+ var columnDef = Earthserver.Client.Utilities.createColumnDefinition("SchedulePeriod", "Schedule Period", false, false);
+ columnDefs.push(columnDef);
+ }
+ {
+ var columnDef = Earthserver.Client.Utilities.createColumnDefinition("StartTime", "Start Time", false, false);
+ columnDefs.push(columnDef);
+ }
+ {
+ var columnDef = Earthserver.Client.Utilities.createColumnDefinition("EndTime", "End Time", false, false);
+ columnDefs.push(columnDef);
+ }
+ {
+ var columnDef = Earthserver.Client.Utilities.createColumnDefinition("Status", "Status", false, false);
+ columnDefs.push(columnDef);
+ }
+ {
+ var columnDef = Earthserver.Client.Utilities.createColumnDefinition("TotalElements", "Total Elements", false, false);
+ columnDefs.push(columnDef);
+ }
+ {
+ var columnDef = Earthserver.Client.Utilities.createColumnDefinition("NewElements", "New Elements", false, false);
+ columnDefs.push(columnDef);
+ }
+ {
+ var columnDef = Earthserver.Client.Utilities.createColumnDefinition("UpdatedElements", "Updated Elements", false, false);
+ columnDefs.push(columnDef);
+ }
+
+ result.columnDefinitions = columnDefs;
+ result.gridName = 'Harvests';
+ result.visibleRows = 20;
+ return result;
+ };
+
+ Earthserver.Client.Utilities.getRetrievalFunction = function (dataCallback) {
+ ///
+ /// Gets a function that will be used to retrieve data.
+ /// The actual data retrieval function to call.
+ /// An _optional_ object containing additional options (e.g. @requestEnhancer,
+ /// @customCallback@) that can be used to further customize the retrieval function.
+ /// The function that can be supplied as a data retrieval callback to a LiveGrid.
+ ///
+
+ //Build the data retrieval callback.
+ var gridRetrievalCallback = function (gridPostData, gridCallback) {
+ //Format the grid request appropriately and set the request field allowing for custom overrides by the requestEnhancer.
+ var gridRequest = Earthserver.Client.Utilities.toServerRequest(gridPostData);
+ var requestData = { request: gridRequest };
+ //Prepare the onSuccess callback and retrieve data.
+ var dataRefreshCallback = function (data) {
+ var gridData = Earthserver.Client.Utilities.toClientResponse(data);
+ gridCallback(gridData);
+ };
+ dataCallback(requestData, dataRefreshCallback);
+ };
+ return gridRetrievalCallback;
+ };
+
+ Earthserver.Client.Utilities.getDataFunction = function (url) {
+ var dataFunction = function (requestData, onSuccess, onError) {
+ Earthserver.Client.Utilities.callWS(url, 'GET', {
+ dataType: "json",
+ requestData: requestData,
+ onSuccess: onSuccess,
+ onError: onError,
+ });
+ };
+ return dataFunction;
+ };
+
+ Earthserver.Client.Utilities.toServerRequest = function (clientRequest) {
+ /// Converts a client dataTables request, to an object that the waits to receive
+ var result = JSON.parse(JSON.stringify(clientRequest)); // clone object
+ if (result.hasOwnProperty('start')) { result.Offset = result.start; delete result.start; }
+ if (result.hasOwnProperty('length')) { result.Size = result.length; delete result.length; }
+ if (result.hasOwnProperty('columns')) { delete result.columns; }
+ if (result.hasOwnProperty('search')) { delete result.search; }
+ return result;
+ };
+
+ Earthserver.Client.Utilities.toClientResponse = function (serverResponse) {
+ /// Converts a server response to an object that dataTables wait to receive
+ var result = JSON.parse(JSON.stringify(serverResponse)); // clone object
+ $.each(result.Rows, function(index, row) {
+ row.Data.StartTime = row.Data.StartTime != "" ? new Date(row.Data.StartTime) : "";
+ row.Data.EndTime = row.Data.EndTime != "" ? new Date(row.Data.EndTime) : "";
+ });
+ //Extract extra information from context object.
+ var context = result["Context"];
+ if (context) {
+ if (context.hasOwnProperty('Total')) { result.recordsTotal = context.Total; delete context.Total; }
+ if (context.hasOwnProperty('Filtered')) { result.recordsFiltered = context.Filtered; delete context.Filtered; }
+ }
+ if (result.hasOwnProperty('Rows')) { result.rows = result.Rows; delete result.Rows; }
+ return result;
+ };
+
+})(jQuery);
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0035052_user.js b/pool/shard005/JavaScript/0035052_user.js
new file mode 100644
index 0000000000000000000000000000000000000000..c1c932d0467faafefb825032828d90ae8106494e
--- /dev/null
+++ b/pool/shard005/JavaScript/0035052_user.js
@@ -0,0 +1,128 @@
+/**
+ * This project created by :
+ * Name : syafiq
+ * Date / Time : 04 December 2016, 8:08 AM.
+ * Email : syafiq.rezpector@gmail.com
+ * Github : syafiqq
+ */
+(function ($)
+{
+ /*
+ Fullscreen background
+ */
+ $(function ()
+ {
+ $("a#sign-out").on('click', function (event)
+ {
+ event.preventDefault();
+ $.ajax({
+ type: 'post',
+ url: $(this).attr('href'),
+ dataType: 'json',
+ contentType: 'application/x-www-form-urlencoded; charset=UTF-8; X-Requested-With: XMLHttpRequest'
+ })
+ .done(function (data)
+ {
+ if (data.hasOwnProperty('data'))
+ {
+ if (data['data'].hasOwnProperty('notify'))
+ {
+ var notify = data['data']['notify'];
+ for (var i = -1; ++i < notify.length;)
+ {
+ $.notify({message: notify[i][0]}, {type: notify[i][1]});
+ }
+ }
+ }
+ if (data.hasOwnProperty('code'))
+ {
+ if (data['code'] == 200)
+ {
+ setTimeout(function ()
+ {
+ location.href = window.location.protocol + '//' + window.location.host
+ }, 2000);
+ }
+ }
+
+ })
+ .fail(function ()
+ {
+ $.notify({
+ message: 'Error', url: window.location.protocol + '//' + window.location.host
+ }, {
+ // settings
+ type: 'danger'
+ });
+ })
+
+
+ });
+
+ $("select#counselor_list").select2();
+
+ $("form#share_story").on('submit', function (event)
+ {
+ event.preventDefault();
+ var form = $(this);
+ var data_sent = form.serializeObject();
+ $.ajax({
+ type: form.attr('method'),
+ url: form.attr('action'),
+ data: data_sent,
+ dataType: 'json',
+ contentType: 'application/x-www-form-urlencoded; charset=UTF-8; X-Requested-With: XMLHttpRequest'
+ })
+ .done(function (data)
+ {
+ if (data.hasOwnProperty('data'))
+ {
+ if (data['data'].hasOwnProperty('notify'))
+ {
+ var notify = data['data']['notify'];
+ for (var i = -1; ++i < notify.length;)
+ {
+ $.notify({message: notify[i][0]}, {type: notify[i][1]});
+ }
+ }
+ }
+ if (data.hasOwnProperty('code'))
+ {
+ if (data['code'] == 200)
+ {
+ setTimeout(function ()
+ {
+ if (data.hasOwnProperty('redirect'))
+ {
+ location.href = data['redirect'];
+ }
+ else
+ {
+ location.href = window.location.protocol + '//' + window.location.host + '/dashboard'
+ }
+ }, 2000);
+ }
+ }
+
+ })
+ .fail(function ()
+ {
+ $.notify({
+ message: 'Error'
+ }, {
+ // settings
+ type: 'danger'
+ });
+ })
+ });
+
+ $('button#story_cancel').on('click', function ()
+ {
+ window.location.href = window.location.protocol + '//' + window.location.host + '/dashboard';
+ })
+ });
+
+ /*
+ * Run right away
+ * */
+})(jQuery);
\ No newline at end of file
diff --git a/pool/shard005/JavaScript/0035053_with-setup.js b/pool/shard005/JavaScript/0035053_with-setup.js
new file mode 100644
index 0000000000000000000000000000000000000000..5aa4423641fd20ad720cf47f8e274881125476d2
--- /dev/null
+++ b/pool/shard005/JavaScript/0035053_with-setup.js
@@ -0,0 +1,76 @@
+/**
+ * The external dependencies.
+ */
+import { lifecycle, defaultProps, compose } from 'recompose';
+
+/**
+ * The internal dependencies.
+ */
+import { VALIDATION_BASE } from 'fields/constants';
+
+/**
+ * The default lifecycle hooks that will be attached to each field.
+ * Since we use composition instead of inheritance the developer should provide a full
+ * implementation for the hook that is being overwritten.
+ *
+ * @type {Object}
+ */
+const defaultHooks = {
+ componentDidMount() {
+ const {
+ field,
+ ui,
+ setupField,
+ setupValidation
+ } = this.props;
+
+ setupField(field.id, field.type, ui);
+
+ if (field.required) {
+ setupValidation(field.id, VALIDATION_BASE);
+ }
+ },
+
+ componentWillUnmount() {
+ const {
+ field,
+ teardownField
+ } = this.props;
+
+ teardownField(field.id);
+ },
+};
+
+/**
+ * The default values for UI of the field.
+ *
+ * @type {Object}
+ */
+const defaultUI = {
+ is_visible: true,
+ valid: true,
+ error: null,
+};
+
+/**
+ * The factory function that will produce the decorator.
+ *
+ * @param {Object} hooks
+ * @param {Object} ui
+ * @return {Function}
+ */
+export default function(hooks = {}, ui = {}) {
+ const withLifecycle = lifecycle({
+ ...defaultHooks,
+ ...hooks,
+ });
+
+ const withDefaultProps = defaultProps({
+ ui: {
+ ...defaultUI,
+ ...ui,
+ },
+ });
+
+ return compose(withDefaultProps, withLifecycle);
+}