text stringlengths 7 3.69M |
|---|
Meteor.startup(function() {
Meteor.users.remove({});
Accounts.createUser({
username: "scotchio",
email: "scotch@example.com",
password: "dummypassword"
});
Channels.remove({});
Channels.insert({
name: "general"
});
Channels.insert({
name: "random"
});
}); |
$(document).ready(function() {
//get List Menu Top
function getMenu(param) {
$.get( "dynamic_content/getMenu/"+param+"")
.done(function( data ) {
$('.menu ul').html(data);
});
}
});
|
//jshint esversion:6
const express=require('express');
const app=express();
const PORT=3000;
const words=require('./words.js');
const gameWeb=require('./gamepage.js');
const currentUser=[];
app.use(express.static("./public"));
app.get('/',(req,res)=>{
res.send(gameWeb.gamePage(words));
});
app.post('/game',express.urlencoded({extended:false}),(req,res)=>{
let guessWord=req.body.guessField;
let guessResult=words.judge(guessWord);
words.addPreviousGuess(guessResult.previousGuess);
words.addTexts(guessResult);
res.redirect('/');
});
//restart game
app.post('/',(req,res)=>{
words.previousGuessList.length=0;
words.texts.length=0;
delete words.secretWord;
res.send(gameWeb.gamePage(words));
});
app.listen(PORT,()=>console.log(`Listening on http://localhost:${PORT}`));
|
import React, { Component } from 'react';
import { Grid, Row, Col } from 'react-bootstrap';
import classes from "./UnderHeaderImage.less";
class UnderHeaderImage extends Component {
render() {
const backgroundImage = `url(http://s.lpmcdn.com/lpfile/c/a/8/ca8b1ad297a6f9c148052ea1c10053e8.jpeg)`;
return (
<div className={classes.underHeaderImage}>
<div className={classes.underHeaderImageWrapper} style={{backgroundImage}} />
<Grid className={classes.underHeaderImageContent}>
<Row>
<h2>
ЭКЗОТИЧЕСКИЕ ФРУКТЫ ИЗ ТАИЛАНДА, ВЬЕТНАМА И БРАЗИЛИИ
</h2>
<h2>
С ДОСТАВКОЙ НА ДОМ И В ОФИС
</h2>
<h1>
ДОСТАВКА ЭКЗОТИЧЕСКИХ ФРУКТОВ
</h1>
<p>
Закажите прямо сейчас спелые экзотические фрукты из самого Таиланда,
с бесплатной доставкой до двери,
в любое удобное для Вас время.
Всегда в наличии 24 вида фруктов.
</p>
<a> Заказать Фрукты</a>
</Row>
</Grid>
</div>
);
}
}
export default UnderHeaderImage;
|
import React from 'react';
const List = (props) => {
const { repos } = props;
if (!repos || repos.length === 0) return <p>No data, sorry</p>;
return (
<ul>
<h2 className='list-head'>Vesper.fi Historical Data</h2>
{repos.map((repo) => {
return (
<li key={repo.chainId} className='list'>
<b>Stable Coin:</b> <span className='repo-text'>{repo.name} </span> <br/>
<b>Address:</b> <span className='repo-description'>{repo.address}</span> <br/>
<b>Actual Price:</b> <span className='repo-description'>{repo.asset["price"]}</span> <br/>
<b>Token Value:</b> <span className='repo-description'>{repo.tokenValue}</span> <br/>
<b>Total Supply:</b> <span className='repo-description'>{repo.totalSupply}</span> <br/>
<b>Total Value:</b> <span className='repo-description'>{repo.totalValue}</span> <br/>
<b>Interest Fee:</b> <span className='repo-description'>{repo.interestFee}</span> <br/>
<b>Actual Rates:</b> 1 day: <span className='repo-description'>{repo.actualRates["1"]} </span> |
2 day: <span className='repo-description'>{repo.actualRates["2"]} </span> |
7 day: <span className='repo-description'>{repo.actualRates["7"]} </span> |
30 day: <span className='repo-description'>{repo.actualRates["30"]} </span><br/>
<b>Earning Rates:</b> 1 day: <span className='repo-description'>{repo.earningRates["1"]} </span> |
2 day: <span className='repo-description'>{repo.earningRates["2"]} </span> |
7 day: <span className='repo-description'>{repo.earningRates["7"]} </span> |
30 day: <span className='repo-description'>{repo.earningRates["30"]} </span><br/>
<b>VSP Delta Rates:</b> 1 day: <span className='repo-description'>{repo.vspDeltaRates["1"]} </span> |
2 day: <span className='repo-description'>{repo.vspDeltaRates["2"]} </span> |
7 day: <span className='repo-description'>{repo.vspDeltaRates["7"]} </span> |
30 day: <span className='repo-description'>{repo.vspDeltaRates["30"]} </span><br/>
<b>Interest Fee:</b> <span className='repo-description'>{repo.interestFee}</span> <br/>
</li>
);
})}
</ul>
);
};
export default List; |
import React from "react";
import { connect } from "mqtt";
export default class mqtt extends React.Component {
constructor(props) {
super(props);
this.state = {
mqtt: connect(this.props.url, this.props.options ? this.props.options : null)
};
}
componentDidMount() {
let mqtt = this.state.mqtt;
let props = this.props;
let subscription = props.subscription;
mqtt.on('connect', function () {
if (subscription) {
mqtt.subscribe(subscription, function (err) {
if (!err) {
console.log("subscribed to: " + subscription);
//TODO: Update mqtt status to redux store (errors too)
}
})
}
})
this.state.mqtt.on('message', function (topic, message) {
// message is Buffer
if (props.function) {
props.function(message.toString(), topic, props.api);
}
})
}
componentDidUpdate(prevProps, prevState) {
console.log(prevProps.subscription, this.props.subscription);
if (this.props.subscription !== prevProps.subscription) {
this.state.mqtt.unsubscribe(prevProps.subscription, function (err) {
if (!err) {
console.log("unsubscribed to: " + prevProps.subscription);
//TODO: Update mqtt status to redux store (errors too)
}
})
let subscription = this.props.subscription;
this.state.mqtt.subscribe(this.props.subscription, function (err) {
if (!err) {
console.log("subscribed to: " + subscription);
//TODO: Update mqtt status to redux store (errors too)
}
})
}
}
componentWillUnmount() {
this.state.mqtt.end();
}
render() {
return null;
}
}
|
// pages/login/login.js
const util = require('../../utils/util.js')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
angle: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
wx.onAccelerometerChange(res => {
var angle = -(res.x * 30).toFixed(1);
if (angle > 14) {
angle = 14;
} else if (angle < -14) {
angle = -14;
}
if (this.data.angle !== angle) {
this.setData({
angle: angle
});
}
});
// 登录
this.login()
},
login() {
wx.getSetting({
success: setting => {
if (setting.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: user => {
const userInfo = user.userInfo || {};
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
util.request('/api/user/login', 'post', {
code: res.code,
nickName: userInfo.nickName,
avatarUrl: userInfo.avatarUrl
}, {
authorization: false
}).then((data) => {
if (data) {
app.globalData.userInfo = data.userInfo;
wx.setStorageSync('token', data.token || '');
wx.switchTab({
url: '/pages/index/index',
});
}
});
}
});
}
})
}
}
});
}
}) |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createSearchPaginationResolver;
var _graphqlCompose = require("graphql-compose");
var _utils = require("../utils");
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
function createSearchPaginationResolver(searchResolver, opts = {}) {
const resolver = searchResolver.clone({
name: `searchPagination`
});
resolver.addArgs({
page: 'Int',
perPage: {
type: 'Int',
defaultValue: 20
}
}).removeArg(['limit', 'skip']).reorderArgs(['q', 'query', 'sort', 'aggs', 'page', 'perPage']);
const searchTC = searchResolver.getTypeComposer();
if (!searchTC) {
throw new Error('Cannot get TypeComposer from resolver. Maybe resolver return Scalar?!');
}
const typeName = searchTC.getTypeName();
resolver.setType(searchTC.clone(`${typeName}Pagination`).addFields({
pageInfo: getPageInfoTC(opts),
items: [searchTC.get('hits')]
}).removeField('hits').reorderFields(['items', 'count', 'pageInfo', 'aggregations']));
resolver.resolve =
/*#__PURE__*/
function () {
var _ref = _asyncToGenerator(function* (rp) {
const _rp$args = rp.args,
args = _rp$args === void 0 ? {} : _rp$args,
_rp$projection = rp.projection,
projection = _rp$projection === void 0 ? {} : _rp$projection;
const page = args.page || 1;
if (page <= 0) {
throw new Error('Argument `page` should be positive number.');
}
const perPage = args.perPage || 20;
if (perPage <= 0) {
throw new Error('Argument `perPage` should be positive number.');
}
delete args.page;
delete args.perPage;
args.limit = perPage;
args.skip = (page - 1) * perPage;
if (projection.items) {
projection.hits = projection.items;
delete projection.items;
}
const res = yield searchResolver.resolve(rp);
const items = res.hits || [];
const itemCount = res.count || 0;
const result = _objectSpread({}, res, {
pageInfo: {
hasNextPage: itemCount > page * perPage,
hasPreviousPage: page > 1,
currentPage: page,
perPage,
pageCount: Math.ceil(itemCount / perPage),
itemCount
},
items
});
return result;
});
return function (_x) {
return _ref.apply(this, arguments);
};
}();
return resolver;
}
function getPageInfoTC(opts = {}) {
const name = (0, _utils.getTypeName)('PaginationInfo', opts);
return (0, _utils.getOrSetType)(name, () => _graphqlCompose.TypeComposer.create(`
# Information about pagination.
type ${name} {
# Current page number
currentPage: Int!
# Number of items per page
perPage: Int!
# Total number of pages
pageCount: Int
# Total number of items
itemCount: Int
# When paginating forwards, are there more items?
hasNextPage: Boolean
# When paginating backwards, are there more items?
hasPreviousPage: Boolean
}
`));
} |
"use strict";
/// <reference path="../../scene/ComponentConfig.d.ts" />
Object.defineProperty(exports, "__esModule", { value: true });
const BehaviorConfig_1 = require("./BehaviorConfig");
SupCore.system.registerPlugin("componentConfigs", "Behavior", BehaviorConfig_1.default);
|
var path = require('path')
var xmlbuilder = require('xmlbuilder')
var trans = require('./lib/Translate')
var style = require('./lib/style')
var parameter = require('./lib/Parameters')
var uti=require('./lib/uti')
var srs_mector = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 \
+x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"
var Map = function(srs, layer,markerUri) {
var obj = {
Map: {
//'@srs': srs || srs_mector,
Parameters: {},
Style: [],
Layer: []
}
}
var bj = trans.bgTranslate(layer,markerUri)
for (var p in bj) {
obj.Map[p] = bj[p]
}
return obj
}
function Style(layer, markerUri, callback) {
style.getStyle(layer, markerUri, function(err, data) {
if(err){
callback(err);
}
if(data.length===0){
callback(null, {});
}
if (layer.id == "water") {
var style1 = {
'@name': "water",
'Rule': data
}
} else {
var style1 = {
'@name': layer.id,
'Rule': data
}
}
callback(null, style1)
})
}
function Layer(glayers) {
var mlayers = []
glayers.forEach(function(e) {
if (e.type !== 'background') {
var layer = {
'@srs': srs_mector,
'@name': e['source-layer'],
'StyleName': e.id
}
mlayers.push(layer)
}
})
return mlayers
}
function gl2xml(globj, callback) {
const zoom = globj.zoom;
var fontUri, markerUri
var source_obj=globj.sources;
if (globj.glyphs) {
var font_url = globj.glyphs
var start = font_url.indexOf('\/fonts')
var str = font_url.slice(start, font_url.length)
var arr = str.split('/')
fontUri = path.resolve(path.join(arr[1], arr[2]))
} else {
fontUri = null
}
if (globj.sprite) {
var marker_url = globj.sprite
var start2 = marker_url.indexOf('\/sprites')
var str2 = marker_url.slice(start, marker_url.length)
var arr2 = str2.split('/')
markerUri = path.resolve(path.join(arr2[1], arr2[2],arr2[3]))
} else {
markerUri = null
}
var shield_array=(globj.metadata&&globj.metadata.shield)?globj.metadata.shield:[];
var autolabel_array=(globj.metadata&&globj.metadata.autolabel)?globj.metadata.autolabel:[];
var mMap = {}
var glayers = globj.layers
var para = parameter.getParameters(globj)
mMap = Map(srs_mector, glayers,markerUri)
// if (fontUri) {
// mMap.Map['@font-directory'] =fontUri.replace(/\\/g,'\/')
// }
// mMap.Map.Layer = Layer(glayers)
mMap.Map.Style = [
{'@name': "road", Rule: []},
{'@name': "water", Rule: []},
{'@name': "ocean", Rule: []},
{'@name': "aeroway", Rule: []},
]
// mMap.Map.Parameters = para.Parameters
glayers.forEach(function(e) {
if (e.type !== 'background'&&source_obj[e.source].type!=='video') {
if(uti.contains(shield_array,e.id)){
e.shield=true;
}
if(uti.contains(autolabel_array,e.id)){
e.autolabel=true;
}
Style(e, markerUri, function(err, data) {
if(err){console.log(err);callback(err);}
if (uti.isEmptyObject(data)) return;
var relevantRule = data.Rule.find((rule) => {
return (!rule.MaxScaleDenominator || rule.MaxScaleDenominator >= ranges[zoom]) &&
(!rule.MinScaleDenominator || rule.MinScaleDenominator <= ranges[zoom])
});
if (!relevantRule) return;
// if (!relevantRule.Filter && e.filter) return;
delete relevantRule.MaxScaleDenominator;
delete relevantRule.MinScaleDenominator;
if (e["source-layer"] == "water" || e["source-layer"] == "waterway") {
// ocean
const ruleCopy = Object.assign({}, relevantRule);
delete ruleCopy.Filter;
mMap.Map.Style[2].Rule.push(ruleCopy);
// freshwater
mMap.Map.Style[1].Rule.push(relevantRule);
} else if (e["source-layer"] == "road") {
mMap.Map.Style[0].Rule.push(relevantRule);
} else if (e["source-layer"] == "aeroway") {
mMap.Map.Style[3].Rule.push(relevantRule);
}
})
}
})
delete mMap.Map.Parameters;
delete mMap.Map.Layer;
var xml = xmlbuilder.create(mMap).dec('1.0', 'UTF-8').end().replace(/&/g,'&');
callback(null, xml)
}
var ranges = {
0: 2000000000,
1: 1000000000,
2: 500000000,
3: 200000000,
4: 100000000,
5: 50000000,
6: 25000000,
7: 12500000,
8: 6500000,
9: 3000000,
10: 1500000,
11: 750000,
12: 400000,
13: 200000,
14: 100000,
15: 50000,
16: 25000,
17: 12500,
18: 5000,
19: 2500,
20: 1500,
21: 750,
22: 500,
23: 250,
24: 100
};
module.exports = gl2xml
|
function saturdayFun(act="roller-skate") {
return `This Saturday, I want to ${act}!`
}
function mondayWork(act="go to the office") {
return `This Monday, I will ${act}.`
}
function wrapAdjective(s="*") {
return function(x="special") {
return `You are ${s}${x}${s}!`
}
}
let encouragingPromptFunction = wrapAdjective("!!!");
const Calculator = {
add: function(a,b) {
return a + b
},
subtract: function(a,b) {
return a - b
},
multiply: function(a,b) {
return a * b
},
divide: function(a,b) {
return a/b
}
}
function actionApplyer(x, a) {
let n = x;
for (const f of a) {
n = f(n);
};
return n
} |
var colors = require('colors');
var https = require('https')
var sys = require('sys');
function pad(str, len, withWhat) {
str = '' + str;
len = len || 2;
withWhat = withWhat || '0'
while (str.length < len) str = withWhat + str;
return str;
}
function getDate() {
var now = new Date();
return now.getFullYear() + '-' +
pad(now.getMonth() + 1) + '-' +
pad(now.getDate()) + ' ' +
pad(now.getHours()) + ':' +
pad(now.getMinutes()) + ':' +
pad(now.getSeconds()) + '.' +
pad(now.getMilliseconds(), 3);
}
function getLine() {
try {
throw new Error();
} catch(e) {
var line = e.stack.split('\n')[3].split(':')[1];
return line;
}
}
function getClass(module) {
if (module) {
if (module.id) {
if (module.id == '.') {
return 'main';
} else {
return module.id;
}
} else {
return module;
}
} else {
return '<unknown>';
}
}
// Config
var logglyHost = ''
, logglyPath = ''
, priority = 2
;
exports.setPriority = function(p) {
priority = p;
};
exports.useLoggly = function(host, path) {
logglyHost = host;
logglyPath = path;
};
exports.create = function(module) {
var methods = {
'trace': { 'color': 'cyan', 'priority': 1 }
, 'debug': { 'color': 'yellow', 'priority': 2 }
, 'info': { 'color': 'green', 'priority': 3 }
, 'warn': { 'color': 'magenta', 'priority': 4 }
, 'error': { 'color': 'red', 'priority': 5 }
}, MAX_METHOD_NAME_LENGTH = 5;
var logger = {};
var defineMethod = function (level) {
logger[level] = function() {
if (methods[level].priority < priority) return;
var theme = methods[level].color;
var args = Array.prototype.slice.call(arguments);
var klass = getClass(module);
var line = getLine();
var lvl = pad(level.toUpperCase(), MAX_METHOD_NAME_LENGTH, ' ');
var date = getDate();
if (logglyHost && logglyPath) {
// Plain message for storage.
var msg = '';
msg += date + ' ' + lvl + ' ' + klass + ':' + line;
for (var i = 0; i < args.length; i++) {
msg += ' ' + sys.inspect(args[i], false, 10);
}
var req = https.request({
host: logglyHost
, port: 443
, path: logglyPath
, method: 'POST'
});
req.write(msg);
req.end();
}
args.unshift((klass + ':' + line)[theme]);
args.unshift(lvl[theme]);
args.unshift(date.grey);
console.log.apply(this, args);
}
}
for (var level in methods) {
defineMethod(level);
}
return logger;
}
|
$(appReady);
// let BASE_URL;
//
// (function getBaseURL() {
// if (window.location.hostname == "localhost") {
// BASE_URL = `http://localhost:3000/api/v1/books/`
// } else {
// BASE_URL = `https://mtb-greads.herokuapp.com/api/v1/books/createBooks`;
// }
// })();
function appReady(){
submitBookForm();
};
function submitBookForm(){
$('#createBooks').on('click', function() {
$('form').submit(function(event) {
alert('we clicked it');
event.preventDefault();
let book_title = $('.title').val();
let book_genre = $('.genre').val();
let book_description = $('.description').val();
let book_cover_url = $('.cover_image_url').val();
let eventObject = {
'book_title': book_title,
'book_genre': book_genre,
'book_description': book_description,
'book_cover_url': book_cover_url
};
console.log(eventObject);
$.post('https://mtb-greads.herokuapp.com/api/v1/books/createBooks', eventObject).then(res => {
console.log(res);
})
})
})
}
|
const { merge, sortByKey } = require('./util')
module.exports = {
requireFile (filename) {
try {
return require(filename)
} catch (error) {
return {}
}
},
requireJSON (filename) {
return JSON.parse(JSON.stringify(this.requireFile(filename)))
},
loadPackage (name, generator) {
if (!name || name === 'none') {
return {}
}
const prefix = name === 'nuxt' ? 'nuxt' : `frameworks/${name}`
const pkg = this.requireJSON(`cna-template/template/${prefix}/package.json`)
const pkgHandler = this.requireFile(`cna-template/template/${prefix}/package.js`)
return pkgHandler.apply ? pkgHandler.apply(pkg, generator) : pkg
},
load (generator) {
const nuxtPkg = this.loadPackage('nuxt', generator)
const uiPkg = this.loadPackage(generator.answers.ui, generator)
const testPkg = this.loadPackage(generator.answers.test, generator)
const pkg = merge(nuxtPkg, uiPkg, testPkg)
pkg.dependencies = sortByKey(pkg.dependencies)
pkg.devDependencies = sortByKey(pkg.devDependencies)
return pkg
}
}
|
import { createActions } from 'redux-actions';
const actionTypes = {
SET_NAV: 'SET_NAV'
};
const { setNav } = createActions({ [actionTypes.SET_NAV]: payload => payload });
export { actionTypes, setNav };
|
(function(angular) {
angular.module('nameApp').controller('languageController', ['$scope', 'languageService', languageController]);
function languageController($scope, languageService) {
(function init() {
$scope.changeLanguage = changeLanguage;
})();
function changeLanguage(language) {
languageService.setLanguage(language);
$scope.content = $scope.pageData['content_' + language];
$scope.title = $scope.pageData['title_' + language];
}
}
})(angular); |
'use strict';
angular.module('scrumbo.sprintboard', ['ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/sprintboard/:sprintId', {
templateUrl: 'sprintboard/sprintboard.html',
controller: 'SprintboardCtrl'
});
}])
.controller('SprintboardCtrl', ['$rootScope', '$scope', '$routeParams', 'Sprint',
function($rootScope, $scope, $routeParams, Sprint) {
// Get the sprint
var sprintId = parseInt($routeParams.sprintId);
Sprint.getSprint(sprintId).then(
function(sprint) {
$scope.sprint = sprint;
},
function(reason) {
// TODO : Show a nice error to the user
console.log('Impossible to get the story');
});
$scope.editSprint = function() {
$scope.sprint.editing = true;
};
$scope.saveSprint = function() {
$scope.sprint.editing = false;
}
}]); |
import {combineReducers} from 'redux';
import {GET_EGRESOS_SUCCESS, SAVE_EGRESO_SUCCESS, EDIT_EGRESO_SUCCESS, DELETE_EGRESO_SUCCESS, GET_EGRESOS_DATA_SUCCESS} from "../../actions/administracion/egresosActions";
function list(state=[], action){
switch(action.type){
case GET_EGRESOS_SUCCESS:
return action.egresos;
case SAVE_EGRESO_SUCCESS:
return [...state, action.egreso];
case EDIT_EGRESO_SUCCESS:
let newL = state.filter(a=>{
return a.id!=action.egreso.id
});
return [...newL, action.egreso];
case DELETE_EGRESO_SUCCESS:
let acualL = state.filter(a=>{
return a.id!=action.egresoId;
});
return acualL;
default:
return state;
}
}
function allData(state={}, action) {
switch (action.type){
case GET_EGRESOS_DATA_SUCCESS:
return action.dataEgreso;
default:
return state;
}
}
const egresosReducer = combineReducers({
list:list,
allData:allData
});
export default egresosReducer; |
import React, {Component} from 'react'
class IndividualPreviousProduct extends Component {
constructor() {
super()
this.state = {}
this.handleChange = this.handleChange.bind(this)
}
componentDidMount() {
if(this.props.item.status === 'Invalid') {
this.setState({
status: 'Cancelled :(',
color: 'black'
})
} else if(this.props.item.readyToDispatch === false) {
this.setState({
status: 'Waiting',
color: 'white'
})
} else if(this.props.item.dispatched === false) {
this.setState({
status: 'Placed',
color: 'yellow'
})
} else {
this.setState({
status: 'Dispatched',
color: '#00C000'
})
}
}
handleChange(event, id) {
console.log(id)
const {value} = event.target
this.setState({
[id]: value
}, () => {
console.log(this.state)
})
}
render() {
return (
<div className = 'individual-product-container1 shadow-lg p-3 mb-5 rounded'>
<h3>{this.props.item.ProductName}</h3>
PRICE: {this.props.item.price}
<br/>
AMOUNT PURCHASED: {this.props.item.boughtAmount}
<br/>
ITEMS REMAINING: {this.props.item.available}
<br/>
VENDOR: {this.props.item.vendorEmail}
<div style = {{marginTop: '22px', bottom: '0', right: '0', textAlign: 'right', color: this.state.color}}>
{/* <br/> */}
status: {this.state.status}
{this.state.status == 'Waiting' ?
<div><input type='number' min='0' style = {{width: '120px'}} placeholder = 'Change Quantity' onChange = {(event) => this.props.handleQuantityChange(event, this.props.item.productId)}/> <button style = {{background: 'none', padding: '0', border: 'none', color: 'white'}} onClick = {(event) => this.props.changeOrder(event, this.props.item.productId, this.props.item.available, this.props.item.boughtAmount, this.props.item.soldItemId)}>CHANGE</button></div>:
null
}
</div>
</div>
)
}
}
export default IndividualPreviousProduct |
import axios from 'axios';
import apiKeys from '../apiKeys.json';
const baseUrl = apiKeys.firebaseKeys.databaseURL;
const getEventStaffByEventId = (eventId) => new Promise((resolve, reject) => {
axios.get(`${baseUrl}/eventStaff.json?orderBy="eventId"&equalTo="${eventId}"`)
.then((response) => {
const eventStaff = response.data;
const staff = [];
Object.keys(eventStaff).forEach((fbId) => {
eventStaff[fbId].id = fbId;
staff.push(eventStaff[fbId]);
});
resolve(staff);
})
.catch((err) => reject(err));
});
export default { getEventStaffByEventId };
|
//var -> supports only function scoping non fixed variables
//let -> block , function scoping for non fixed variables
//const -> block , function scoping but for fixed variables
// var vs let with if condition
let course = 'Engineering';
if(course === 'Engineering'){
let dept1 = 'Software';
var dept2 = 'govt';
}
console.log(course);
//console.log(dept1); // ReferenceError: dept1 is not defined
console.log(dept2);
// var vs let with for loop
for(let i=0; i<=10; i++){
}
// console.log(i); // ReferenceError: i is not defined
for(var i=0; i<=10; i++){
}
console.log(i); // 11
// let vs const
let name1 = 'John';
const name2 = 'Rajan';
name1 = 'Changed'; // Possible
//name2 = 'Changed'; // TypeError: Assignment to constant variable.
// const with an Object
const mobile = {
brand : 'Apple',
color : 'silver',
price : 35000
};
console.log(mobile);
mobile.brand = 'Lenovo';
console.log(mobile);
|
let arr = [1,20,15,17,12,7,25,14,13,19,30,16];
console.log(arr);
for(let i = 1; i < arr.length; i++){
let j = i;
let cur = arr[i];
while(j > 0 && arr[j-1] > cur){
arr[j] = arr[j-1];
j--;
}
arr[j] = cur;
}
console.log(arr);
|
function doFirst() {
// pic.addEventListener("dragstart", dragStart, false);
// pic.addEventListener("dragend", dragEnd, false);
cvs = document.getElementById('box');
cvs.addEventListener("dragenter", dragEnter, false);
cvs.addEventListener("dragleave", dragLeave, false);
tshirt = document.getElementById("tshirt");
tshirt.addEventListener("dragenter", dragEnter, false);
tshirt.addEventListener("dragleave", dragLeave, false);
canvas = tshirt.getContext("2d");
// cvs.addEventListener("dragover", dragOver, false);
//cvs.addEventListener("drop", dropped, false);
}
//search_result
function dragStart(e) {
e.dataTransfer.setData("Text", e.target.id);
}
function dragEnd(e) {
e.preventDefault();
}
//canvas
function allowDrop(e) {
e.preventDefault();
}
function drop(e) {
e.preventDefault();
var data = e.dataTransfer.getData("Text");
e.target.appendChild(document.getElementById(data));
cvs.style.background = "white";
cvs.style.border = "ridge #ff99cc";
//real canvas
tshirt.style.background = "white";
tshirt.style.border = "ridge #ff99cc";
var pic = document.getElementById("mypic");
canvas.drawImage(pic, 0, 0);
}
function dragEnter(e) {
e.preventDefault();
cvs.style.background = "#F0F0F0";
cvs.style.border = "dotted #ff99cc";
tshirt.style.background = "#F0F0F0";
tshirt.style.border = "dotted #ff99cc";
}
function dragLeave(e) {
e.preventDefault();
cvs.style.background = "white";
cvs.style.border = "ridge #ff99cc";
tshirt.style.background = "white";
tshirt.style.border = "ridge #ff99cc";
}
//animation
function dragItem(e) {
canvas.clearRect(0, 0, 450, 300);
//var data = e.target;
var x = e.clientX;
var y = e.clientY;
//var pic = "/Users/danmei/Pictures/profile/77405618596881674.jpg";
//canvas.drawImage(pic, x, y);
canvas.fillRect(x, y, 100, 100);
}
window.addEventListener("load", doFirst, false); |
import React from 'react';
import { describe, add } from '@sparkpost/libby-react';
import { ComboBox, ComboBoxTextField, ComboBoxMenu, Box } from '@sparkpost/matchbox';
import Downshift from 'downshift';
// This is an example of a multi select downshift typeahead
// A few things are missing from this example:
// - filtering and sorting by input value
// - limiting results list
function getItems() {
return [{ name: 'foo' }, { name: 'bar' }, { name: 'baz' }, { name: 'lorem' }, { name: 'ipsum' }];
}
function TypeaheadExample(props) {
const { error, delimiter } = props;
const [selected, setSelected] = React.useState([]);
function stateReducer(state, changes) {
switch (changes.type) {
case Downshift.stateChangeTypes.clickItem:
case Downshift.stateChangeTypes.keyDownEnter:
if (changes.selectedItem) {
addItem(changes.selectedItem);
return {
...changes,
inputValue: '',
selectedItem: null,
};
} else {
return changes;
}
default:
return changes;
}
}
function addItem(item) {
setSelected([...selected, item]);
}
function removeItem(item) {
setSelected(selected.filter(i => i !== item));
}
function itemToString(item) {
if (item) {
return item.name;
}
return '';
}
function typeaheadfn(downshift) {
const {
getInputProps,
getMenuProps,
isOpen,
getItemProps,
highlightedIndex,
openMenu,
getRootProps,
} = downshift;
const items = getItems()
.filter(item => !selected.some(({ name }) => name === item.name))
.map((item, index) =>
getItemProps({
content: itemToString(item),
highlighted: highlightedIndex === index,
index,
item,
}),
);
const rootProps = getRootProps({
refKey: 'rootRef',
isOpen: Boolean(isOpen),
});
const inputProps = getInputProps({
id: 'story',
label: 'Label',
selectedItems: selected,
itemToString,
removeItem,
onFocus: openMenu,
error: error && !isOpen ? 'test' : null,
placeholder: 'Type to search',
helpText: 'Help text',
delimiter,
});
const menuProps = getMenuProps({
items,
isOpen: Boolean(isOpen),
refKey: 'menuRef',
});
return (
<ComboBox {...rootProps}>
<ComboBoxTextField {...inputProps} />
<ComboBoxMenu {...menuProps} />
</ComboBox>
);
}
return (
<Downshift itemToString={itemToString} stateReducer={stateReducer}>
{typeaheadfn}
</Downshift>
);
}
describe('ComboBox', () => {
add('textfield with menu', () => <TypeaheadExample />);
add('textfield', () => (
<ComboBoxTextField
id="story-id"
selectedItems={[{ name: 'foo' }, { name: 'bar' }]}
itemToString={({ name }) => name}
defaultValue="input value"
label="Filters"
/>
));
add('menu', () => (
<Box maxWidth="20rem">
<ComboBoxMenu
isOpen={true}
items={[{ content: 'foo' }, { content: 'bar' }, { content: 'baz' }]}
maxHeight="5rem"
/>
</Box>
));
add('textfield with error', () => (
<ComboBoxTextField
id="story-id"
selectedItems={[{ name: 'foo' }, { name: 'bar' }]}
itemToString={({ name }) => name}
defaultValue="input value"
label="Filters"
error="Required"
required
/>
));
add('textfield with error and helptext', () => (
<ComboBoxTextField
id="story-id"
selectedItems={[{ name: 'foo' }, { name: 'bar' }]}
itemToString={({ name }) => name}
defaultValue="input value"
label="Filters"
error="Required"
helpText="Remember to filter something"
required
/>
));
add('textfield while disabled', () => (
<ComboBoxTextField
id="story-id"
selectedItems={[{ name: 'foo' }, { name: 'bar' }]}
itemToString={({ name }) => name}
defaultValue="input value"
label="Filters"
disabled
/>
));
add('delimiter', () => <TypeaheadExample delimiter="or" />);
});
|
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableContainer from '@material-ui/core/TableContainer';
import TableHead from '@material-ui/core/TableHead';
import TablePagination from '@material-ui/core/TablePagination';
import TableRow from '@material-ui/core/TableRow';
import PropTypes from 'prop-types';
import { v4 as uuidv4 } from 'uuid';
const useStyles = makeStyles({
root: {
width: '100%'
},
container: {
maxHeight: 640
}
});
const DataTable = ({
columns,
rows,
pageNo,
setPageNo,
pageSize,
setPageSize,
pageSizeOptions,
nextPage,
pagination
}) => {
const classes = useStyles();
const handleChangePage = (event, newPage) => {
setPageNo(newPage);
};
const handleChangeRowsPerPage = (event) => {
setPageSize(+event.target.value);
setPageNo(0);
};
const handleNextPage = () => {
if (nextPage) {
setPageNo(pageNo + 1);
}
};
const handlePreviousPage = () => {
if (pageNo > 0) {
setPageNo(pageNo - 1);
}
};
return (
<Paper className={classes.root}>
<TableContainer className={classes.container}>
<Table stickyHeader aria-label="sticky table">
<TableHead>
<TableRow>
{columns.map((column) => (
<TableCell
key={column.id}
align={column.align}
style={{ minWidth: column.minWidth }}
>
{column.label}
</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{rows.map((row) => {
return (
<TableRow hover role="checkbox" tabIndex={-1} key={uuidv4()}>
{columns.map((column) => {
const value = row[column.id];
return (
<TableCell key={column.id} align={column.align}>
{column.format && typeof value === 'number'
? column.format(value)
: value}
</TableCell>
);
})}
</TableRow>
);
})}
</TableBody>
</Table>
</TableContainer>
{pagination && (
<TablePagination
rowsPerPageOptions={pageSizeOptions}
component="div"
count={rows.length}
rowsPerPage={pageSize}
page={pageNo}
onChangePage={handleChangePage}
onChangeRowsPerPage={handleChangeRowsPerPage}
nextIconButtonProps={{
disabled: false,
onClick: handleNextPage
}}
backIconButtonProps={{
disabled: false,
onClick: handlePreviousPage
}}
/>
)}
</Paper>
);
};
DataTable.propTypes = {
columns: PropTypes.array,
rows: PropTypes.array,
pageNo: PropTypes.number,
setPageNo: PropTypes.func,
pageSize: PropTypes.number,
setPageSize: PropTypes.func,
pageSizeOptions: PropTypes.array,
nextPage: PropTypes.bool,
pagination: PropTypes.bool
};
export default DataTable;
|
var tape = require('tape')
var pull = require('pull-stream')
var Pushable = require('pull-pushable')
var mux = require('../')
module.exports = function(serializer) {
var client = {
hello : 'async',
goodbye: 'async',
stuff : 'source',
bstuff : 'source',
things : 'sink',
suchstreamwow: 'duplex'
}
tape('async handle closed gracefully', function (t) {
var A = mux(client, null, serializer) ()
var B = mux(null, client, serializer) ({
hello: function (a, cb) {
cb(null, 'hello, '+a)
}
})
var s = A.createStream()
pull(s, B.createStream(), s)
A.hello('world', function (err, value) {
if(err) throw err
console.log(value)
t.equal(value, 'hello, world')
A.close(function (err) {
if (err) throw err
console.log('closed')
A.hello('world', function (err, value) {
t.ok(err)
t.end()
})
})
})
})
tape('close twice', function (t) {
var A = mux(client, null, serializer) ()
var B = mux(null, client, serializer) ({
hello: function (a, cb) {
cb(null, 'hello, '+a)
}
})
var s = A.createStream()
pull(s, pull.through(console.log), B.createStream(), pull.through(console.log), s)
A.hello('world', function (err, value) {
if(err) throw err
console.log(value)
t.equal(value, 'hello, world')
A.close(function (err) {
if (err) throw err
A.close(function (err) {
if (err) throw err
t.end()
})
})
})
})
}
if(!module.parent)
module.exports();
|
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import Detail from './Detail';
const Section = styled.section`
display: grid;
grid-template-columns: repeat(6, 240px);
grid-gap: 40px 0px;
`;
function Board({ children, detail, isDetail, resetDetail, handleModal }) {
return (
<Section>
{children}
{isDetail() && (
<Detail
author={detail.author}
image={detail.image}
price={detail.price}
priceSales={detail.priceSales}
desc={detail.desc}
date={detail.date}
publisher={detail.publisher}
categoryName={detail.categoryName}
buyLink={detail.buyLink}
rating={detail.rating}
resetDetail={resetDetail}
handleModal={handleModal}
/>
)}
</Section>
);
};
Board.propTypes = {
children: PropTypes.array.isRequired,
detail: PropTypes.object,
isDetail: PropTypes.func,
setDetail: PropTypes.func,
handleModal: PropTypes.func,
}
export default Board;
|
"use strict";
/* eslint-env node, mocha */
var helloHandler = require("../myService/handler");
var assert = require("assert");
describe("Sample Tests", function() {
describe("Greetings", function() {
it("I greet the Yow West audience", function() {
helloHandler.hello({}, {}, (_, response)=>{
assert.equal(200, response.statusCode);
let body = JSON.parse(response.body);
assert.equal("Hello, YOW West!", body.message);
});
});
});
});
|
require("dotenv").config();
const fs = require("fs");
const path = require("path");
const fetch = require("node-fetch");
const request = require("request");
const PDFDocument = require("pdfkit");
const Product = require("../models/product");
const Order = require("../models/order");
exports.getProducts = (req, res, next) => {
res.render("shop/product-list", {
pageTitle: "Places",
path: "/places",
zipCode: "",
type: "",
address: "",
});
};
exports.postAddToFavorites = (req, res, next) => {
console.log("fine");
const zipCode = req.body.zipCode;
const type = req.body.type;
const address = req.body.address;
const rating = req.body.rating;
// res.render("shop/product-list", {
// pageTitle: "Places",
// path: "/places",
// zipCode: zipCode,
// type: type,
// address: address,
// rating: rating,
// });
};
exports.postProducts = (req, res, next) => {
const zipCode = req.body.zipCode;
const type = req.body.type;
const address = req.body.address;
const rating = req.body.rating;
res.render("shop/product-list", {
pageTitle: "Places",
path: "/places",
zipCode: zipCode,
type: type,
address: address,
rating: rating,
});
};
exports.getProduct = (req, res, next) => {
let placeId = req.params.place_id;
let imageUrl = req.params.image;
let passedId = `/product-detail/${placeId}/${imageUrl}`;
//console.log("req.params.place_id:", placeId);
//console.log("req.params.imageUrl:", imageUrl);
request(
`https://maps.googleapis.com/maps/api/place/details/json?place_id=${placeId}&key=AIzaSyBksN0SF4_mvexLxby3u1O8It8WplxbU_w`,
function (error, response, body) {
if (!error && response.statusCode === 200) {
let parsedBody = JSON.parse(body);
//console.log("parsedBody", parsedBody);
let result = parsedBody.result;
let phoneNo = result?.formatted_phone_number || "";
let address = result?.formatted_address || "";
let name = result?.name || "";
let rating = result?.rating || "";
let type = result?.type || [];
//console.log("result:", result);
res.render("shop/product-detail", {
path: "/product",
pageTitle: "Place Details",
products: [],
product: {
name: name,
phone: phoneNo,
photo: result?.photos[0]?.html_attributions[0] || "",
imageUrl: imageUrl,
rating: rating,
type: type,
address: address,
passedId: passedId,
},
});
}
}
);
};
exports.getIndex = (req, res, next) => {
res.render("shop/index", {
pageTitle: "Home",
path: "/",
});
};
exports.getCart = (req, res, next) => {
req.user
.populate("cart.items.productId")
.execPopulate()
.then((user) => {
const products = user.cart.items;
res.render("shop/cart", {
path: "/cart",
pageTitle: "Your Cart",
products: products,
});
})
.catch((err) => {
const error = new Error(err);
error.httpStatusCode = 500;
return next(error);
});
};
exports.postCart = (req, res, next) => {
//ADD to DB
//then run below code
let prodId = JSON.parse(req.body.productId);
Product.findById(prodId)
.then((product) => {
return req.user.addToCart(product);
})
.then((result) => {
console.log(result);
res.redirect("/cart");
})
.catch((err) => {
const error = new Error(err);
error.httpStatusCode = 500;
return next(error);
});
};
exports.postCartDeleteProduct = (req, res, next) => {
const prodId = req.body.productId;
req.user
.removeFromCart(prodId)
.then((result) => {
res.redirect("/cart");
})
.catch((err) => {
const error = new Error(err);
error.httpStatusCode = 500;
return next(error);
});
};
//This takes a zip code and type of location gets the results form the places api and returns the json
exports.getGooglePlaces = async (req, res, next) => {
let json = "";
let type = req.params.type;
let zipCode = req.params.zipCode;
//console.log(type, zipCode);
//if values are empty set them to a default value
if (type == "") {
type = "restraunt+museum+park";
}
if (zipCode == "") {
zipCode = "20001";
}
const apiURL = `https://maps.googleapis.com/maps/api/place/textsearch/json?query=${type}+in+${zipCode}&key=${process.env.API_KEY}`;
console.log(apiURL);
try {
const fetchResponse = await fetch(apiURL);
json = await fetchResponse.json();
} catch (error) {
console.log(
"Can’t access " + apiURL + " response. Blocked by browser?" + error
);
}
//console.log(JSON.stringify(json));
res.json(json);
};
//This takes a photo ref and returns the photo path from google photos to be used on website.
exports.getPlacesPhotos = async (req, res, next) => {
let photo_reference = req.params.photo_reference;
let myimage =
"{image: https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/No_image_available.svg/480px-No_image_available.svg.png}";
//if values are empty set them to a default value
if (req.params.photo_reference == "") {
return res.json(myimage);
}
const imageURL = `https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=${photo_reference}&key=${process.env.API_KEY}`;
try {
const photoresponse = await fetch(imageURL);
myimage = await photoresponse;
// console.log(myimage.url);
} catch (err) {
console.log(err);
throw error;
}
res.json(`${myimage.url}`);
};
|
/*!build time : 2014-09-16 2:10:53 PM*/
KISSY.config("modules",{"kg/xscroll/1.1.8/plugin/scrollbar":{requires:["node","base","anim","kg/xscroll/1.1.8/util"]}}); |
const generateGuid = () => {
var timeinMs = new Date().getTime();
var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (char) => {
var r = (timeinMs + Math.random() * 16) % 16 | 0;
timeinMs = Math.floor(timeinMs / 16);
return (char == "x" ? r : (r & 0x3) | 0x8).toString(16);
});
return uuid;
};
export const createTask = (text) => ({
text,
isDone: false,
id: generateGuid(),
});
export const createList = (name) => ({
name,
id: generateGuid(),
tasks: [],
});
|
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
import { createDrawerNavigator } from '@react-navigation/drawer';
import auth from '@react-native-firebase/auth';
import Signup from '../pages/Signup';
import Login from '../pages/Login';
import InputBuku from '../pages/InputBuku';
import ListBuku from '../pages/ListBuku';
import ViewBuku from '../pages/ViewBuku';
import Splash from '../pages/Splash';
const handleLogout = () => {
auth()
.signOut()
.then(() => alert('Signed out'));
}
const NavStack = createStackNavigator();
const NavStackScreen = () => (
<NavStack.Navigator
screenOptions={{
headerShown: false
}}
initialRouteName="Splash">
<NavStack.Screen name="Signup" component={Signup} />
<NavStack.Screen name="Splash" component={Splash} />
<NavStack.Screen name="Login" component={Login} />
<NavStack.Screen name="InputBuku" component={InputBuku} />
<NavStack.Screen name="ListBuku" component={ListBuku} />
<NavStack.Screen name="ViewBuku" component={ViewBuku} />
<NavStack.Screen name="Home" component={NavDrawerScreen} />
</NavStack.Navigator>
)
const NavTab = createMaterialTopTabNavigator();
const NavTabScreen = () => (
<NavTab.Navigator
screenOptions={{
headerShown: false
}}
initialRouteName="ListBuku">
<NavTab.Screen name="ListBuku" component={ListBuku} />
<NavTab.Screen name="InputBuku" component={InputBuku} />
</NavTab.Navigator>
)
const NavDrawer = createDrawerNavigator();
const NavDrawerScreen = () => (
<NavDrawer.Navigator
drawerContentOptions={{
activeTintColor: '#fff',
itemStyle: { marginVertical: 5 },
}}
drawerStyle={{
backgroundColor: '#00a4e4',
width: 240,
}}
screenOptions={{
headerShown: true,
title: 'My Library'
}}
initialRouteName="HomeTab">
<NavDrawer.Screen name="HomeTab" component={NavTabScreen} options={{ drawerLabel: 'Home' }} />
<NavDrawer.Screen name="Logout" component={NavTabScreen} options={{ drawerLabel: 'Logout' }} />
</NavDrawer.Navigator>
)
const Navigation = () => (
<NavigationContainer>
<NavStackScreen />
</NavigationContainer>
)
export default Navigation; |
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import $ from 'superagent';
import superagentJsonapify from 'superagent-jsonapify';
superagentJsonapify($);
// import util from '../../lib/util.js';
import './index.less';
class LoginBar extends React.Component {
constructor(props) { // 构造函数
super(props);
}
componentDidMount() {
this.props.checkUserLogin();
}
componentDidUpdate() {}
userKeyUp(e) {
if(e.keyCode=='13') {
this.props.getUserLogin();
}
}
render() {
let loginStatusClass = this.props.login.loginBarShow ? '' : 'J_disnone';
return (
<div className={`stock-login-container ${loginStatusClass}`}>
<div className="stock-login-mask" onClick={this.props.hideLoginSideBar}></div>
<div className="stock-login-warpper">
<div className="stock-login-header">
<div className="stock-login-logo-svg"></div>
<div className="stock-login-msg">{this.props.login.loginBarMSG}</div>
</div>
<div className="stock-login-body">
<input id="stock-login-user-input" type="text" placeholder="账号" onKeyUp={this.userKeyUp.bind(this)} />
<input id="stock-login-passwd-input" type="password" onKeyUp={this.userKeyUp.bind(this)} placeholder="密码" />
<a href="javascript:void(0);" className="J_doLoginBtn" onClick={this.props.getUserLogin.bind(this)}>登录</a>
</div>
<div className="stock-login-footer">
<a href="javascript:void(0);" className="J_registerBtn">注册</a> | <a href="javascript:void(0);" className="J_forgetPassBtn">忘记密码</a>
</div>
</div>
</div>
);
}
}
// export default LoginBar;
function mapStateToProps(state) {
return state;
}
let actions = {
checkUserLogin(e) {
return (dispatch, getState) => {
$.get('/api/checkUserLogin.do')
.then(function(response) {
const body = response.body;
if (body.code == 0) {
dispatch({
type: 'CHECK_LOGIN_STATUS',
userInfo: body.userInfo
});
dispatch({
type: 'INIT_LOGIN_FINISH'
});
} else {
/*dispatch({
type: 'SHOW_LOGIN_BAR_MSG',
loginBarMSG: body.message
});*/
console.log('获取登录信息失败');
}
}).catch(function(err) {
console.log(err)
});
}
},
getUserLogin(e) {
return (dispatch, getState) => {
let username = document.querySelector('#stock-login-user-input').value;
let password = document.querySelector('#stock-login-passwd-input').value;
if (username == '' || password == '') {
dispatch({
type: 'SHOW_LOGIN_BAR_MSG',
loginBarMSG: '请输入正确的账号和密码'
});
} else {
dispatch({
type: 'SHOW_LOGIN_BAR_MSG',
loginBarMSG: ''
});
}
$.get('/api/getUserLogin.do')
.query({
username: username,
password: password
// cv: encodeURIComponent(e.target.value)
})
.then(function(response) {
const body = response.body;
console.log(body)
if (body.code == 0) {
dispatch({
type: 'LOGIN_SUCCESS',
userInfo: body.data
});
} else {
dispatch({
type: 'SHOW_LOGIN_BAR_MSG',
loginBarMSG: body.message
});
}
}).catch(function(err) {
console.log(err)
});
}
},
/*getUserLogout(e) {
return (dispatch, getState) => {
$.get('/api/getUserLogout.do')
.then(function(response) {
const body = response.body;
console.log(body)
if (body.code == 0) {
// dispatch({
// type: 'LOGIN_SUCCESS',
// userInfo: body.data
// });
} else {
// dispatch({
// type: 'SHOW_LOGIN_BAR_MSG',
// loginBarMSG: body.message
// });
}
}).catch(function(err) {
console.log(err)
});
}
},*/
hideLoginSideBar() {
return (dispatch, getState) => {
dispatch({
type: 'HIDE_LOGIN_SIDEBAR'
});
}
}
};
function mapDispatchToProps(dispatch) {
return {
...bindActionCreators(actions, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(LoginBar);
|
var x = 2;
var y = 4;
var add = x + y;
var sub = x - y;
var mult = x * y;
var dvd = x / y;
var pow = Math.pow(x, y);
var sqrt = Math.sqrt(y);
console.log(add, sub, mult, dvd, pow, sqrt);
|
/*
* Copyright (C) 2021 Radix IoT LLC. All rights reserved.
*/
const comparatorPredicates = {
eq: val => val === 0,
ne: val => val !== 0,
le: val => val <= 0,
ge: val => val >= 0,
lt: val => val < 0,
gt: val => val > 0
};
const tokenSubstitutes = {
'\\\\': `\\\\`,
'\\*': '\\*',
'\\?': '\\?',
'*': '.*',
'?': '.'
};
export class RqlVisitor {
constructor(options) {
Object.assign(this, options);
}
visit(node) {
if (typeof this[node.name] === 'function') {
return this[node.name](node.args);
}
if (!comparatorPredicates.hasOwnProperty(node.name)) {
throw new Error('Unsupported node type: ' + node.name);
}
// default implementation for comparison operations
const propertyName = node.args[0];
const target = node.args[1];
const comparator = this.getComparator(propertyName);
const predicate = comparatorPredicates[node.name];
return item => predicate(comparator(this.getProperty(item, propertyName), target));
}
and(args) {
const children = args.map(a => this.visit(a));
return item => children.every(p => p(item));
}
or(args) {
const children = args.map(a => this.visit(a));
return item => children.some(p => p(item));
}
not(args) {
return !this.and(args);
}
limit(args) {
if (args.length) {
this.limitValue = args[0];
this.offset = args.length > 1 ? args[1] : 0;
}
return item => true;
}
sort(args) {
this.sortComparator = args.reduce((prev, arg) => {
let descending = false;
let propertyName = null;
if (Array.isArray(arg)) {
propertyName = arg[0];
if (arg.length > 1) {
descending = !!arg[1];
}
} else if (arg != null) {
// null propertyName means the object itself
if (arg.startsWith('-')) {
descending = true;
propertyName = arg.substring(1);
} else if (arg.startsWith('+')) {
propertyName = arg.substring(1);
} else {
propertyName = arg;
}
}
let comparator = this.getSortComparator(propertyName);
if (descending) {
comparator = this.constructor.reverseComparator(comparator);
}
return this.constructor.thenComparator(prev, comparator);
}, null);
return item => true;
}
in(args) {
const propertyName = args[0];
const searchIn = Array.isArray(args[1]) ? args[1] : args.slice(1);
const comparator = this.getComparator(propertyName);
return item => {
const propertyValue = this.getProperty(item, propertyName);
return searchIn.some(arg => comparator(propertyValue, arg) === 0);
};
}
match(args) {
const propertyName = args[0];
const matchString = args[1];
const caseSensitive = !!args[2];
const pattern = this.constructor.tokenize(Object.keys(tokenSubstitutes), matchString).map(t => {
return tokenSubstitutes.hasOwnProperty(t) ? tokenSubstitutes[t] : this.constructor.regExpEscape(t);
}).join('');
const regex = new RegExp('^' + pattern + '$', caseSensitive ? '' : 'i');
return item => {
const propertyValue = this.getProperty(item, propertyName);
return regex.test(propertyValue);
};
}
like(args) {
return this.match(args);
}
contains(args) {
const propertyName = args[0];
const target = args[1];
const comparator = this.getComparator(propertyName);
return item => {
const propertyValue = this.getProperty(item, propertyName);
if (typeof propertyValue === 'string') {
return propertyValue.includes(target);
} else if (Array.isArray(propertyValue)) {
return propertyValue.some(v => {
return comparator(v, target) === 0;
});
} else {
throw new Error('Cant search inside ' + typeof propertyValue);
}
};
}
getProperty(item, propertyName) {
if (this.propertyNameMap && this.propertyNameMap.hasOwnProperty(propertyName)) {
propertyName = this.propertyNameMap[propertyName];
}
if (propertyName == null) {
return item;
}
return propertyName.split('.')
.reduce((value, name) => value != null ? value[name] : undefined, item);
}
getComparator(propertyName) {
return this.constructor.compare;
}
getSortComparator(propertyName) {
const comparator = this.getComparator(propertyName);
return (a, b) => {
const valueA = this.getProperty(a, propertyName);
const valueB = this.getProperty(b, propertyName);
return comparator(valueA, valueB);
};
}
static compare(a, b) {
if (a === b) return 0;
// try using valueOf()
if (a < b) return -1;
if (a > b) return 1;
// items are loosely equal, use string comparison
const strA = String(a);
const strB = String(b);
if (strA < strB) return -1;
if (strA > strB) return 1;
return 0;
}
static reverseComparator(comparator) {
return (a, b) => -comparator(a, b);
}
static thenComparator(first, second) {
if (first == null) {
return second;
}
return (a, b) => first(a, b) || second(a, b);
}
static regExpEscape(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
/**
*
* @param {RegExp|string[]} delimiters
* @param {string} target
* @returns {*[]}
*/
static tokenize(delimiters, target) {
if (Array.isArray(delimiters)) {
const pattern = delimiters
.map(d => this.regExpEscape(d))
.join('|');
delimiters = new RegExp(pattern, 'g');
}
const tokens = [];
let prevIndex = 0;
let match;
while ((match = delimiters.exec(target)) != null) {
tokens.push(target.slice(prevIndex, match.index));
tokens.push(match[0]);
prevIndex = delimiters.lastIndex;
}
tokens.push(target.slice(prevIndex));
return tokens.filter(t => !!t);
}
}
export class RqlFilter {
/**
* @param {RqlNode} node
* @param {RqlVisitor} visitor
*/
constructor(node, visitor = new RqlVisitor()) {
this.test = visitor.visit(node);
this.limit = visitor.limitValue;
this.offset = visitor.offset;
this.sort = visitor.sortComparator;
}
/**
* Applies the filtering, sorting, limit and offset
*
* @param {*[]} array
* @returns {*[]}
*/
apply(array) {
let result = array.filter(this.test);
const total = result.length;
if (this.sort) {
result.sort(this.sort);
}
if (this.limit != null) {
result = result.slice(this.offset, this.offset + this.limit);
}
result.$total = total;
return result;
}
}
export default RqlFilter;
|
export default{
regions:[
'Africa', 'Americas', 'Asia', 'Europe', 'Oceania'
],
flags: [],
details: []
} |
"use strict";
exports.DataGridViewProps = void 0;
var DataGridViewProps = {};
exports.DataGridViewProps = DataGridViewProps; |
import React from 'react';
import {
View,
Text,
ListView,
ScrollView,
Alert,
} from 'react-native';
import { PView } from 'rnplus';
import {
COLOR_LIST_BORDER,
STYLE_ALL,
STYLE_SCROLL_VIEW,
} from '../../common/styles.js';
import NavBar from '../../common/NavBar';
class WebX extends PView {
routerPlugin = {
leftButtonText: '',
title: 'WebX',
};
styles = {
all: STYLE_ALL,
scrollView: STYLE_SCROLL_VIEW,
Text: {
color: '#CAAD45',
},
item: {
borderBottomColor: COLOR_LIST_BORDER,
borderBottomWidth: 1,
height: 40,
justifyContent: 'center',
backgroundColor: '#fff',
paddingLeft: 10,
},
'item-gap': {
marginTop: 20,
},
'vh-vw': {
fontSize: '3vh',
borderColor: 'red',
borderWidth: 1,
width: '50vw',
},
// active
'item-1': {
':active': {
backgroundColor: '#B1DEE8',
},
},
'item-2': {
':active': {
backgroundColor: '#B1DEE8',
},
},
'child-text': {
'item-2:active': {
color: 'red',
},
},
// 媒体查询
'@media (min-width: 400)': {
media: {
color: 'red',
},
},
'@media (max-width:900) and (min-width:400)': {
media: {
color: 'blue',
},
},
'media-inner': {
'@media (min-height: 500)': {
color: 'red',
},
'@media (max-height:900) and (min-height: 500)': {
color: 'blue',
},
},
transform: {
transform: 'translateX(50), rotate(-2deg)',
},
};
constructor(props) {
super(props);
this.state = {
dataSource: (new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 })).cloneWithRows(['row 1', 'row 2', 'row 3']),
};
}
testPressView() {
Alert.alert('You pressed a View.');
}
testAutoBind() {
console.log('testAutoBind', this);
}
render() {
return (
<View class="all">
<NavBar title="WebX" />
<ScrollView class="scrollView">
<View class="item">
<Text>
通过 className 写样式
</Text>
</View>
<View class="item">
<Text>
通过 ComponentName 写样式(查看 Text 样式)
</Text>
</View>
<View class="item item-gap">
<Text class="vh-vw">
支持 vh 和 vw 单位
</Text>
</View>
<View class="item item-gap item-1">
<Text>
支持 :active
</Text>
</View>
<View class="item item-2">
<Text class="child-text">
甚至支持通过获取其他组件的 :active 改变自己样式
</Text>
</View>
<View class="item item-gap">
<Text class="media">
支持媒体查询(宽高)
</Text>
</View>
<View class="item">
<Text class="media-inner">
样式内部也支持媒体查询(宽高)
</Text>
</View>
<View class="item item-gap">
<Text class="transform">
transform 增强
</Text>
</View>
<View class="item item-gap" onPress={this.testPressView}>
<Text>
View 上也可绑定 onPress 事件
</Text>
</View>
</ScrollView>
</View>
);
}
}
export default WebX;
|
'use strict';
import 'react-native';
import React from 'react';
import Text from '../Text';
import renderer from 'react-test-renderer';
jest.setTimeout(15000);
test('renders correctly', () => {
const tree = renderer.create(<Text size="sm" weight="bold" color="primary">hello</Text>).toJSON();
expect(tree).toMatchSnapshot();
});
it('check size', () => {
const tree = renderer.create(<Text size="xxlg">hello</Text>).toJSON();
expect(tree).toMatchSnapshot();
});
it('check weight', () => {
const tree = renderer.create(<Text weight="bold">hello</Text>).toJSON();
expect(tree).toMatchSnapshot();
});
it('check color', () => {
const tree = renderer.create(<Text color="primary">hello</Text>).toJSON();
expect(tree).toMatchSnapshot();
});
it('check style', () => {
const tree = renderer.create(<Text style={{ textAlign: 'center' }}>hello</Text>).toJSON();
expect(tree).toMatchSnapshot();
});
it('check onpress', () => {
const tree = renderer.create(<Text onPress={() => console.log(123)}>hello</Text>).toJSON();
expect(tree).toMatchSnapshot();
}); |
module.exports = [
{
"name": "[PETSOLICITOR]",
"label": "Petitioner's Solicitor",
"description": "Petitioner's Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[RESPSOLICITOR]",
"label": "Respondent's Solicitor",
"description": "Respondent's Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[BARRISTER]",
"label": "Barrister",
"description": "Barrister",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CAFCASSSOLICITOR]",
"label": "Cafcass Solicitor",
"description": "Cafcass Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[EPSMANAGING]",
"label": "External Professional Solicitor",
"description": "External Professional Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[LABARRISTER]",
"label": "LA Barrister",
"description": "LA Barrister",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[LAMANAGING]",
"label": "Managing Local Authority",
"description": "Managing Local Authority",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[LASOLICITOR]",
"label": "LA Solicitor",
"description": "LA Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITOR]",
"label": "Solicitor",
"description": "Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITORA]",
"label": "Solicitor A",
"description": "Solicitor A",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITORB]",
"label": "Solicitor B",
"description": "Solicitor B",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITORC]",
"label": "Solicitor C",
"description": "Solicitor C",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITORD]",
"label": "Solicitor D",
"description": "Solicitor D",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITORE]",
"label": "Solicitor E",
"description": "Solicitor E",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITORF]",
"label": "Solicitor F",
"description": "Solicitor F",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITORG]",
"label": "Solicitor G",
"description": "Solicitor G",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITORH]",
"label": "Solicitor H",
"description": "Solicitor H",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITORI]",
"label": "Solicitor I",
"description": "Solicitor I",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[SOLICITORJ]",
"label": "Solicitor J",
"description": "Solicitor J",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[LEGALREPRESENTATIVE]",
"label": "Legal Representative",
"description": "Legal Representative",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CREATOR]",
"label": "Creator",
"description": "Creator Role for Professional users",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CREATOR]",
"label": "Creator",
"description": "Creator Role for Citizen users",
"category": "CITIZEN",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CREATOR]",
"label": "Creator",
"description": "Creator Role for Judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CREATOR]",
"label": "Creator",
"description": "Creator Role for Staff users",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[APPSOLICITOR]",
"label": "Applicant's Solicitor",
"description": "Applicant's Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORA]",
"label": "Child Solicitor A",
"description": "Child Solicitor A",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORB]",
"label": "Child Solicitor B",
"description": "Child Solicitor B",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORC]",
"label": "Child Solicitor C",
"description": "Child Solicitor C",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORD]",
"label": "Child Solicitor D",
"description": "Child Solicitor D",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORE]",
"label": "Child Solicitor E",
"description": "Child Solicitor E",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORF]",
"label": "Child Solicitor F",
"description": "Child Solicitor F",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORG]",
"label": "Child Solicitor G",
"description": "Child Solicitor G",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORH]",
"label": "Child Solicitor H",
"description": "Child Solicitor H",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORI]",
"label": "Child Solicitor I",
"description": "Child Solicitor I",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORJ]",
"label": "Child Solicitor J",
"description": "Child Solicitor J",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORK]",
"label": "Child Solicitor K",
"description": "Child Solicitor K",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORL]",
"label": "Child Solicitor L",
"description": "Child Solicitor L",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORM]",
"label": "Child Solicitor M",
"description": "Child Solicitor M",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORN]",
"label": "Child Solicitor N",
"description": "Child Solicitor N",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CHILDSOLICITORO]",
"label": "Child Solicitor O",
"description": "Child Solicitor O",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[LASHARED]",
"label": "Shared local authority",
"description": "Shared local authority",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[APPLICANTSOLICITORONE]",
"label": "Applicant Solicitor 1",
"description": "Applicant Solicitor 1",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[APPLICANTSOLICITORTWO]",
"label": "Applicant Solicitor 2",
"description": "Applicant Solicitor 2",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[RESPONDENTSOLICITORONE]",
"label": "Respondent Solicitor 1",
"description": "Respondent Solicitor 1",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[RESPONDENTSOLICITORTWO]",
"label": "Respondent Solicitor 2",
"description": "Respondent Solicitor 2",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CLAIMANT]",
"label": "Claimant",
"description": "Claimant",
"category": "CITIZEN",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[CLAIMANTSOLICITOR]",
"label": "Claimant Solicitor",
"description": "Claimant Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[DEFENDANT]",
"label": "Defendant",
"description": "Defendant",
"category": "CITIZEN",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[DEFENDANTSOLICITOR]",
"label": "Defendant solicitor",
"description": "Defendant solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[APPLICANTSOLICITOR]",
"label": "Applicant Solicitor",
"description": "Applicant Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[OTHERPARTYSOLICITOR]",
"label": "Other Party Solicitor",
"description": "Other Party Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[RESPONDENTSOLICITOR]",
"label": "Respondent Solicitor",
"description": "Respondent Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[APPONESOLICITOR]",
"label": "Applicant 1 Solicitor",
"description": "Applicant 1 Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"PRIVATELAW",
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"PRLAPPS",
"NFD"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[APPTWOSOLICITOR]",
"label": "Applicant 2 Solicitor",
"description": "Applicant 2 Solicitor",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"NFD"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[APPLICANTTWO]",
"label": "Applicant 2",
"description": "Applicant 2",
"category": "CITIZEN",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"NFD"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[APPLICANTSOLICITORTWOSPEC]",
"label": "Applicant Solicitor 2 spec",
"description": "Applicant Solicitor 2 spec",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL"
]
},
"caseType": {
"mandatory": true,
"values": [
"CIVIL",
"GENERALAPPLICATION"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[APPBARRISTER]",
"label": "Applicant's Barrister",
"description": "Applicant's Barrister",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"FinancialRemedyContested"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[RESPBARRISTER]",
"label": "Respondent's Barrister",
"description": "Respondent's Barrister",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"FinancialRemedyContested"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[INTVRSOLICITOR1]",
"label": "Intervener Solicitor 1",
"description": "Role to isolate events for Intervener's Solicitor 1",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"FinancialRemedyContested"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[INTVRSOLICITOR2]",
"label": "Intervener Solicitor 2",
"description": "Role to isolate events for Intervener's Solicitor 2",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"FinancialRemedyContested"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[INTVRSOLICITOR3]",
"label": "Intervener Solicitor 3",
"description": "Role to isolate events for Intervener's Solicitor 3",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"FinancialRemedyContested"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[INTVRSOLICITOR4]",
"label": "Intervener Solicitor 4",
"description": "Role to isolate events for Intervener's Solicitor 4",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"FinancialRemedyContested"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[INTVRBARRISTER1]",
"label": "Intervener Barrister1",
"description": "Role to isolate events for Intervener's Barrister 1",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"FinancialRemedyContested"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[INTVRBARRISTER2]",
"label": "Intervener Barrister2",
"description": "Role to isolate events for Intervener's Barrister 2",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"FinancialRemedyContested"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[INTVRBARRISTER3]",
"label": "Intervener Barrister3",
"description": "Role to isolate events for Intervener's Barrister 3",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"FinancialRemedyContested"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "[INTVRBARRISTER4]",
"label": "Intervener Barrister4",
"description": "Role to isolate events for Intervener's Barrister 4",
"category": "PROFESSIONAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"DIVORCE"
]
},
"caseType": {
"mandatory": true,
"values": [
"FinancialRemedyContested"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "nbc-team-leader",
"label": "NBC Team Leader",
"description": "NBC Team Leader role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "case-allocator",
"label": "Case Allocator",
"description": "Case Allocator role for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "case-allocator",
"label": "Case Allocator",
"description": "Case Allocator role for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "case-allocator",
"label": "Case Allocator",
"description": "Case Allocator role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "case-allocator",
"label": "Case Allocator",
"description": "Case Allocator role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "case-allocator",
"label": "Case Allocator",
"description": "Case Allocator role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "task-supervisor",
"label": "Task Supervisor",
"description": "Task Supervisor role for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "task-supervisor",
"label": "Task Supervisor",
"description": "Task Supervisor role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "task-supervisor",
"label": "Task Supervisor",
"description": "Task Supervisor role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "task-supervisor",
"label": "Task Supervisor",
"description": "Task Supervisor role for ctsc users",
"category": "CTSC",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "case-allocator",
"label": "Case Allocator",
"description": "Case Allocator role for ctsc users",
"category": "CTSC",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "hmcts-judiciary",
"label": "HMCTS Judiciary",
"description": "HMCTS Judiciary role for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE"
]
},
"attributes": {
"contractType": {
"mandatory": false
}
},
"substantive": false
}
]
},
{
"name": "hmcts-legal-operations",
"label": "HMCTS Legal Operations",
"description": "HMCTS Legal Operations role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE"
]
},
"attributes": {
"primaryLocation": {
"mandatory": false
}
},
"substantive": false
}
]
},
{
"name": "hmcts-admin",
"label": "HMCTS Admin",
"description": "HMCTS admin role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE"
]
},
"attributes": {
"primaryLocation": {
"mandatory": false
}
},
"substantive": false
}
]
},
{
"name": "judge",
"label": "Judge",
"description": "Judge role for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "fee-paid-judge",
"label": "Fee Paid Judge",
"description": "Fee Paid Judge role for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-judge",
"label": "Hearing Judge",
"description": "Hearing Judge role for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "allocated-magistrate",
"label": "Allocated-Magistrate",
"description": "Allocated Magistrate role for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"PRIVATELAW",
"PUBLICLAW"
]
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "leadership-judge",
"label": "Leadership Judge",
"description": "Leadership Judge role for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "tribunal-caseworker",
"label": "Tribunal Caseworker",
"description": "Tribunal Caseworker role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "tribunal-caseworker",
"label": "Tribunal Caseworker",
"description": "Tribunal caseworker role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS",
"IA"
]
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "conflict-of-interest",
"label": "Conflict of Interest",
"description": "Conflict of Interest role for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"EXCLUDED"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "conflict-of-interest",
"label": "Conflict of Interest",
"description": "Conflict of Interest role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"EXCLUDED"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "conflict-of-interest",
"label": "Conflict of Interest",
"description": "Conflict of Interest role for admin users",
"category": "ADMIN",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"EXCLUDED"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-judiciary",
"label": "Specific Access (judiciary)",
"description": "Specific access for judicial users.",
"category": "JUDICIAL",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-requested",
"label": "Specific Access Requested",
"description": "Specific access Requested for Judicial user.",
"category": "JUDICIAL",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-granted",
"label": "Specific Access Granted",
"description": "Specific access Granted for Judicial user.",
"category": "JUDICIAL",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-denied",
"label": "Specific Access Denied",
"description": "Specific access Denied for Judicial user.",
"category": "JUDICIAL",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-legal-ops",
"label": "Specific Access (legal-ops)",
"description": "Specific access for staff users.",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC",
"BASIC"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-requested",
"label": "Specific Access Requested",
"description": "Specific access Requested for staff user.",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-granted",
"label": "Specific Access Granted",
"description": "Specific access Granted for staff user.",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-denied",
"label": "Specific Access Denied",
"description": "Specific access Denied for staff user.",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-admin",
"label": "Specific Access (admin)",
"description": "Specific access for admin users.",
"category": "ADMIN",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC",
"BASIC"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-ctsc",
"label": "Specific Access ctsc",
"description": "Specific access for ctsc users.",
"category": "CTSC",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-requested",
"label": "Specific Access Requested",
"description": "Specific access Requested for ctsc user.",
"category": "CTSC",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-granted",
"label": "Specific Access Granted",
"description": "Specific access Granted for ctsc user.",
"category": "CTSC",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-denied",
"label": "Specific Access Denied",
"description": "Specific access Denied for ctsc user.",
"category": "CTSC",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-requested",
"label": "Specific Access Requested",
"description": "Specific access Requested for admin user.",
"category": "ADMIN",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-granted",
"label": "Specific Access Granted",
"description": "Specific access Granted for admin user.",
"category": "ADMIN",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-denied",
"label": "Specific Access Denied",
"description": "Specific access Denied for admin user.",
"category": "ADMIN",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
},
"requestedRole": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "challenged-access-judiciary",
"label": "Challenged Access (judiciary)",
"description": "Challenged access for judicial users.",
"category": "JUDICIAL",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"CHALLENGED"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "challenged-access-legal-ops",
"label": "Challenged Access (legal-operations)",
"description": "Challenged access for staff users.",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"CHALLENGED"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "challenged-access-admin",
"label": "Challenged Access (admin)",
"description": "Challenged access for admin users.",
"category": "ADMIN",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"CHALLENGED"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "challenged-access-ctsc",
"label": "Challenged Access (ctsc)",
"description": "Challenged access for ctsc users.",
"category": "CTSC",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"CHALLENGED"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"endTime": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "hearing-centre-admin",
"label": "Hearing Centre Administrator",
"description": "Hearing Centre Administrator role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "national-business-centre",
"label": "National Business Centre",
"description": "National Business Centre role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"IA"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "ctsc",
"label": "CTSC",
"description": "CTSC role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "hearing-manager",
"label": "Hearing Manager",
"description": "Hearing Manager for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-manager",
"label": "Hearing Manager",
"description": "Hearing Manager for caseworker users",
"category": "LEGAL_OPERATIONS",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-manager",
"label": "Hearing Manager",
"description": "Hearing Manager for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-manager",
"label": "Hearing Manager",
"description": "Hearing Manager for admin users",
"category": "CTSC",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-manager",
"label": "Hearing Manager",
"description": "Hearing Manager for system users",
"category": "SYSTEM",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"caseType": {
"mandatory": true,
"values": [
"Benefit"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-viewer",
"label": "Hearing Viewer",
"description": "Hearing Viewer for system users",
"category": "SYSTEM",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"caseType": {
"mandatory": true,
"values": [
"Benefit"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-viewer",
"label": "Hearing Viewer",
"description": "Hearing Viewer for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-viewer",
"label": "Hearing Viewer",
"description": "Hearing Viewer for caseworker users",
"category": "LEGAL_OPERATIONS",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-viewer",
"label": "Hearing Viewer",
"description": "Hearing Viewer for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"SSCS",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-viewer",
"label": "Hearing Viewer",
"description": "Hearing Viewer for admin users",
"category": "CTSC",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "listed-hearing-viewer",
"label": "Listed Hearing Viewer",
"description": "Listed Hearing Viewer for OGD users",
"category": "OTHER_GOV_DEPT",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS",
"PRIVATELAW"
]
}
},
"substantive": false
}
]
},
{
"name": "hearing-centre-team-leader",
"label": "Hearing Centre Team Leader",
"description": "Hearing Centre Team Leader role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"PRIVATELAW",
"PUBLICLAW"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "senior-tribunal-caseworker",
"label": "Senior Tribunal Caseworker",
"description": "Senior Tribunal caseworker role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"IA",
"PRIVATELAW",
"PUBLICLAW"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "circuit-judge",
"label": "Circuit Judge",
"description": "Circuit Judge role for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "specific-access-approver-judiciary",
"label": "Specific Access Approver Judiciary",
"description": "Specific Access Approver role for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-approver-legal-ops",
"label": "Specific Access Approver Legal Ops",
"description": "Specific Access Approver role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "specific-access-approver-admin",
"label": "Specific Access Approver Admin",
"description": "Specific Access Approver role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "magistrate",
"label": "Magistrate",
"description": "Magistrate role for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"PRIVATELAW",
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "specific-access-approver-ctsc",
"label": "Specific Access Approver CTSC",
"description": "Specific Access Approver role for ctsc users",
"category": "CTSC",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "ctsc",
"label": "CTSC",
"description": "CTSC role for ctsc users",
"category": "CTSC",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"PRIVATELAW",
"IA",
"PUBLICLAW"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "hmcts-ctsc",
"label": "HMCTS CTSC",
"description": "HMCTS CTSC role for ctsc users",
"category": "CTSC",
"type": "ORGANISATION",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"BASIC"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"primaryLocation": {
"mandatory": false
}
},
"substantive": false
}
]
},
{
"name": "ctsc-team-leader",
"label": "CTSC Team Leader",
"description": "CTSC Team Leader role for ctsc users",
"category": "CTSC",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"CIVIL",
"PRIVATELAW",
"PUBLICLAW"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "allocated-judge",
"label": "Allocated Judge",
"description": "Allocated Judge role for Judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"PUBLICLAW"
]
}
},
"substantive": false
}
]
},
{
"name": "allocated-legal-adviser",
"label": "Allocated Legal Adviser",
"description": "Allocated Judge role for Staff users",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true,
"values": [
"RESTRICTED"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"PUBLICLAW"
]
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "senior-judge",
"label": "Senior Judge",
"description": "Senior Judge role for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"IA"
]
}
},
"substantive": false
}
]
},
{
"name": "lead-judge",
"label": "Lead Judge",
"description": "Lead Judge role for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"IA"
]
},
"caseType": {
"mandatory": true,
"values": [
"Asylum"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "ftpa-judge",
"label": "FTPA Judge",
"description": "FTPA Judge role for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"IA"
]
},
"caseType": {
"mandatory": true,
"values": [
"Asylum"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "hearing-panel-judge",
"label": "Hearing Panel Judge",
"description": "Hearing Panel Judge role for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"IA"
]
},
"caseType": {
"mandatory": true,
"values": [
"Asylum"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "case-manager",
"label": "Case Manager",
"description": "Case Manager role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"IA"
]
},
"caseType": {
"mandatory": true,
"values": [
"Asylum"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "medical",
"label": "Medical Member",
"description": "Medical Member for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
}
},
"substantive": false
}
]
},
{
"name": "fee-paid-medical",
"label": "Fee Paid Medical Member",
"description": "Fee Paid Medical Member for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
}
},
"substantive": false
}
]
},
{
"name": "fee-paid-disability",
"label": "Fee Paid Disability Member",
"description": "Fee Paid Disability Member for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
}
},
"substantive": false
}
]
},
{
"name": "fee-paid-financial",
"label": "Fee Paid Financial Member",
"description": "Fee Paid Financial Member for judicial users",
"category": "JUDICIAL",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
}
},
"substantive": false
}
]
},
{
"name": "tribunal-member-1",
"label": "Tribunal member 1",
"description": "Tribunal member - 1 for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"caseType": {
"mandatory": true,
"values": [
"Benefit"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "tribunal-member-2",
"label": "Tribunal member 2 ",
"description": "Tribunal member - 2 for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"caseType": {
"mandatory": true,
"values": [
"Benefit"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "appraiser-1",
"label": "Appraiser 1",
"description": "Appraiser 1 for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"caseType": {
"mandatory": true,
"values": [
"Benefit"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "appraiser-2",
"label": "Appraiser 2",
"description": "Appraiser 2 for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"caseType": {
"mandatory": true,
"values": [
"Benefit"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "interloc-judge",
"label": "Interlocutory Judge",
"description": "Interlocutory Judge for judicial users",
"category": "JUDICIAL",
"type": "CASE",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"caseType": {
"mandatory": true,
"values": [
"Benefit"
]
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "registrar",
"label": "Registrar",
"description": "Registrar role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "registrar",
"label": "Registrar",
"description": "Registrar role for staff users",
"category": "LEGAL_OPERATIONS",
"type": "CASE",
"substantive": false,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"CASE"
]
},
"grantType": {
"mandatory": true,
"values": [
"SPECIFIC"
]
},
"classification": {
"mandatory": true
},
"attributes": {
"jurisdiction": {
"mandatory": true
},
"caseType": {
"mandatory": true
},
"caseId": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "superuser",
"label": "Superuser",
"description": "Superuser role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "clerk",
"label": "Clerk",
"description": "Clerk role for admin users",
"category": "ADMIN",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "dwp",
"label": "DWP",
"description": "DWP role for other gov dept users",
"category": "OTHER_GOV_DEPT",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
},
{
"name": "hmrc",
"label": "HMRC",
"description": "HMRC role for other gov dept users",
"category": "OTHER_GOV_DEPT",
"type": "ORGANISATION",
"substantive": true,
"patterns": [
{
"roleType": {
"mandatory": true,
"values": [
"ORGANISATION"
]
},
"grantType": {
"mandatory": true,
"values": [
"STANDARD"
]
},
"classification": {
"mandatory": true,
"values": [
"PRIVATE",
"PUBLIC"
]
},
"attributes": {
"jurisdiction": {
"mandatory": true,
"values": [
"SSCS"
]
},
"primaryLocation": {
"mandatory": true
}
},
"substantive": false
}
]
}
] |
import axios from "axios";
export default {
// Gets all books
getDishes: function() {
return axios.get("/api/dish");
},
// Gets the book with the given id
getDish: function(id) {
return axios.get("/api/dish/" + id);
},
getProfileDish: function(name) {
return axios.get("/api/dish/" + name)
},
// Deletes the book with the given id
deleteDish: function(id) {
return axios.delete("/api/dish/" + id);
},
// Saves a book to the database
saveDish: function(dishData) {
return axios.post("/api/dish", dishData);
},
saveImage: function(imgData) {
return axios.post("/api/image", imgData);
},
findByUser: function(user) {
return axios.get("/api/dish/?user=" + user);
},
findByLocation: function(address) {
return axios.get("/api/dish/?address=" + address);
},
findByName: function(name) {
return axios.get("/api/dish/?name=" + name);
}
};
|
define(['frame'], function(ngApp) {
'use strict';
ngApp.provider.controller('ctrlNotice', ['$scope', 'http2', 'srvTmplmsgNotice', function($scope, http2, srvTmplmsgNotice) {
var oBatchPage, aBatches;
$scope.tmsTableWrapReady = 'N';
$scope.oBatchPage = oBatchPage = {};
$scope.batches = aBatches = [];
$scope.detail = function(batch) {
var url;
$scope.batchId = batch;
url = '/rest/pl/fe/matter/mission/notice/logList?batch=' + batch.id;
http2.get(url).then(function(rsp) {
var noticeStatus, result;
result = rsp.data;
if (result.logs && result.logs.length) {
result.logs.forEach(function(oLog) {
if (noticeStatus = oLog.status) {
oLog._noticeStatus = noticeStatus.split(':');
oLog._noticeStatus[0] = oLog._noticeStatus[0] === 'success' ? '成功' : '失败';
}
});
}
$scope.logs = result.logs;
$scope.activeBatch = batch;
});
};
$scope.choose = 'N';
$scope.fail = function(isCheck) {
if (isCheck == 'Y') {
$scope.logs.forEach(function(item, index) {
if (!(item.noticeStatus.indexOf('failed') < 0)) {
$scope.logs.splice(item, index);
}
});
} else {
$scope.detail($scope.batchId);
}
}
$scope.$watch('mission', function(mission) {
if (!mission) return;
srvTmplmsgNotice.init('mission:' + mission.id, oBatchPage, aBatches);
srvTmplmsgNotice.list();
$scope.tmsTableWrapReady = 'Y';
});
}]);
}); |
import {
AUTHENTICATE,
LOGOUT,
VERIFY_TOKEN,
} from '@/web-client/actions/constants';
import {
cond,
constant,
isPlainObject,
negate,
stubTrue,
flow,
get,
isString,
identity
} from 'lodash/fp';
const initialState = null;
const tokenProcessor =
flow([
cond([
[negate(isPlainObject), constant({})],
[stubTrue, identity]
]),
get('token'),
cond([
[negate(isString), constant(initialState)],
[stubTrue, identity]
]),
]);
const token = (state = initialState, {type, payload}) => {
if (type === AUTHENTICATE
|| type === VERIFY_TOKEN) {
return tokenProcessor(payload);
} else if (type === LOGOUT) {
return initialState;
}
return state;
};
export default token; |
// debugger;
const $util = require('util');
const $NodeClass = require('./node_1');
// debugger;
const $methodList = require('./methods_1b');
const $tagNameSolutionList = require('./method_2');
const $Tools = require('./tools');
// 主要在分離出所有的 tag
class FindTags {
constructor() {
this.nodeList = [];
this.methodList = $methodList;
this.tagNameSolutionList = $tagNameSolutionList;
this._initNodeList();
}
//=================================
solution(content) {
content = this._check1(content);
// 從文字內容找出所有的 tag
this._findTags(content);
return this.nodeList;
}
//=================================
_initNodeList() {
let $this = this;
// 監視 nodeList.push()
let arrayProtoClone = Object.create(Array.prototype);
(function (o, method) {
Object.defineProperty(o, method, {
enumerable: false,
writable: true,
configurable: true,
value: function (v) {
let args = Array.from(arguments);
let last = this[this.length - 1];
if ((last instanceof $NodeClass.TextNode) && (v instanceof $NodeClass.TextNode)) {
this[this.length - 1] = last.merge(v);
return this[this.length - 1];
} else {
let originalFn = Array.prototype[method];
return originalFn.apply(this, args);
}
}
});
})(arrayProtoClone, 'push');
Object.setPrototypeOf(this.nodeList, arrayProtoClone);
}
//=================================
_check1(content) {
if (typeof (content) != 'string') {
throw new TypeError('input must be string');
}
content = content.trim();
return content;
}
//=================================
// 從文字內容找出所有的 tag
_findTags(content) {
// debugger;
let i = 0;
let _chart;
let textArea = '';
//-----------------------
while ((_chart = content[i]) !== undefined) {
// debugger;
console.log('-------------------');
let leftContent = content.substring(0, i);
console.log('已檢查過(%s)正檢查(%s)', leftContent, _chart);
//-----------------------
let index;
let node;
let res;
let tagName;
let findContent;
let isEndtag;
if (/</.test(_chart)) {
debugger;
// 發現可能的起始標籤
console.log('find <.....');
let rightContent = content.substring(i);
//------------------
console.log('檢查是否有 command tag');
// 是否是 command tag
res = $Tools.isCommandTagHead(rightContent, i);
if (res != null) {
console.log('有 command tag');
tagName = res[1];
res = this._findTagSolution_1(i, content, tagName, false);
index = res.index;
node = res.node;
this.nodeList.push(node);
i = index + 1;
continue;
}
//------------------
// 使否能抓到 nodeName
res = $Tools.isTagHead(rightContent);
if (res != null) {
// 是正確的 tagHead
if (textArea.length > 0) {
console.log('有之前的 textContent, 產生 textNode(%s)', textArea);
let node = new $NodeClass.TextNode(textArea);
this.nodeList.push(node);
textArea = '';
}
//------------------
// 若能確定 tagName
// 避免進入 this._findTagSolution_2() 這更耗時的找法
// console.dir(res);
findContent = res[1];
isEndtag = (res[2]) ? true : false;
tagName = res[3];
console.log('是正確的 tagHead(%s%s) 繼續找結尾', (isEndtag ? '/' : ''), tagName);
//------------------
// 先找特殊解
res = this._findTagSolution_2(findContent, i, content);
index = res.index;
node = res.node;
if (node != null) {
console.log('有特殊解');
// 有解
this.nodeList.push(node);
i = index + 1;
continue;
}
//------------------
// 找 tagName 解
console.log('無特殊解 根據tagName 找尋');
res = this._findTagSolution_1(i, content, tagName, isEndtag);
index = res.index;
node = res.node;
this.nodeList.push(node);
i = index + 1;
continue;
}
}
//-----------------------
textArea += _chart;
i++;
} // end while
//-----------------------
if (textArea.length > 0) {
console.log('end textArea(%s)', textArea);
let node = new $NodeClass.TextNode(textArea);
this.nodeList.push(node);
textArea = '';
}
}
//=================================
// 若已經確定 nodeName
// i: 絕對座標
_findTagSolution_1(i, content, tagName, endTag) {
// debugger;
console.log('_findTagSolution_1()>');
tagName = tagName.trim();
tagName = tagName.toLowerCase();
// 返回值
let returnValue = {
node: null,
// 絕對位置
index: null
};
let index;
let tagContent;
let find;
//------------------
if (endTag) {
// 找 > 很簡單
let _res = $Tools.findEndTagEnd(content, i);
find = _res.find;
tagContent = _res.content;
index = _res.index;
} else {
// 找是否有特解
let solution = $tagNameSolutionList[tagName];
if (solution != null) {
// 若有特殊處理模組
let res = solution.solution(content, i);
console.log('根據 tagName 找到特殊解');
return res;
} else {
let res = $Tools.findTagEnd(content, i);
index = res.index;
tagContent = res.content;
find = res.find;
}
}
// debugger;
//------------------
if (find) {
// 確定能形成 tag
if (endTag) {
// 是結尾 tag
returnValue.node = new $NodeClass.EndNode(tagName, tagContent);
} else {
returnValue.node = new $NodeClass.NormalNode(tagName, tagContent);
}
console.log('根據 tagName 有找到結果');
} else {
// 無法形成 tag
returnValue.node = new $NodeClass.TextNode(tagContent);
console.log('根據 tagName 沒有找到結果');
}
returnValue.index = index;
return returnValue;
}
//=================================
// 找尋 tag 轉屬的模組
// 找出他的結尾與結尾的 index
_findTagSolution_2(tagArea, tagStartIndex, content) {
let model = null;
let r_value = {
node: null,
index: null
};
//------------------
let solution = this.methodList.filter(function (m) {
// debugger;
// console.log(m.tag);
let res = m.checkTagType(tagArea);
return (res === true);
});
//------------------
if (solution.length > 0) {
console.log('有找到特殊解(%d)組', solution.length);
if (solution.length > 1) {
solution.sort(function (a, b) {
let a_level = a.level;
let b_level = b.level;
return (b_level - a_level);
});
}
// debugger;
model = solution[0];
console.log('取一解(%s)', model.info);
}
// debugger;
//------------------
if (model != null) {
// 若有找到解決方法
// 就找解
let res = model.solution(content, tagStartIndex);
Object.assign(r_value, res);
}
if (r_value.node != null) {
console.log('特解有找到解');
} else {
console.log('特解沒找到解');
}
return r_value;
};
//=================================
toString() {
return JSON.stringify(this.nodeList);
}
}
//------------------------------------------------------------------------------
module.exports = function () {
return new FindTags();
}
|
/**
* @author 王集鹄(wangjihu,http://weibo.com/zswang)
*/
AceCore.addModule("Manager", function(sandbox){
/**
* 事件集合
*/
var events = sandbox.getConfig("Events");
/**
* 类库
*/
var lib = sandbox.getLib();
/**
* 聊天室api
*/
var chatApi = sandbox.getExtension("ChatApi");
/*
* 进入的频道
*/
var channel;
/**
* 当前pick序号
*/
var seq = 0;
/**
* 发起下一次请求
*/
function nextPick() {
chatApi.pick({
channel: channel,
seq: seq
}, function (data) {
if (!data || data.result != "ok") {
sandbox.log(data);
if (!data || data.result == 'overtime' ||
(data.result != "kill" && data.channel == channel)){
nextPick();
}
return;
}
// 所属频道或请求序号不一致
if (data.channel == channel && seq == data.currSeq) {
if ('nextSeq' in data) {
seq = data.nextSeq;
sandbox.log("seq change to:" + seq);
}
if ('fields' in data) sandbox.fire(events.pickSuccess, data.fields);
setTimeout(function() {
nextPick();
}, 100);
}
});
}
function setChannel(value) {
if (value == channel) return;
chatApi.command({
channel: channel,
desc: value,
command: "goto"
});
channel = value;
enterChannel();
}
function enterChannel() {
chatApi.command({
channel: channel,
command: "enter",
refer: document.referrer
}, function(data) {
data = data || {};
if (data.result != "ok") {
sandbox.fire(events.showDialog, {
type: "error",
message: data.error || "enter channel error."
});
return;
}
seq = 0;
setTimeout(function() {
nextPick();
}, 0);
});
}
function nick(nick) {
chatApi.command({
channel: channel,
command: "nick",
nick: nick
}, checkerror);
}
function weibo(weibo){
chatApi.command({
channel: channel,
command: "weibo",
weibo: weibo
}, checkerror);
}
function talk(content) {
chatApi.command({
channel: channel,
command: "talk",
format: content.format,
text: content.text
}, function(data) {
if (!data || data.result != "ok") return;
data.error && sandbox.fire(events.showDialog, {
type: "error",
message: data.error
});
lib.g('editor').value = "";
});
}
function vote(id) {
chatApi.command({
channel: channel,
command: "vote",
id: id
}, checkerror);
}
function checkerror(data){
data.error && sandbox.fire(events.showDialog, {
type: "error",
message: data.error
});
}
return {
init: function() {
/* Debug Start */
if (/\bstatic\b/.test(location.hash)){
return;
}
/* Debug End */
sandbox.on(events.nick, nick);
sandbox.on(events.talk, talk);
sandbox.on(events.vote, vote);
sandbox.on(events.weibo, weibo);
AceTemplate.register(); // 注册所有模板
lib.on(window, "hashchange", function(){
setChannel(location.hash.replace(/^#/, ''));
});
channel = location.hash.replace(/^#/, '') || 'home';
enterChannel();
}
};
}); |
(function() {
'use strict'
angular
.module('checkIn', [
'ui.router',
'customer',
'keypad'
])
})() |
fetch("http://localhost:3000/ships")
.then(response => response.json())
.then(ships => shipList(ships))
function shipList(ships) {
const list = document.querySelector(".list-ships");
list.innerHTML = "";
ships.forEach(ship => {
const item = document.createElement("li");
item.innerText = ship.name;
ship.pirates.forEach(pirate => {
const pitem = document.createElement("p");
pitem.innerText = pirate.name;
item.appendChild(pitem);
})
list.appendChild(item);
const form = document.createElement("form");
const plab = document.createElement("label");
plab.for="pirate";
plab.innerText="Join the crew!";
const pinp = document.createElement("input");
pinp.id="pirate";
pinp.type="text";
pinp.name="pirate";
const sub = document.createElement("input");
sub.id="submit";
sub.type="submit";
sub.value="Join Crew";
sub.addEventListener('click', (event) => {
event.preventDefault();
fetch('http://localhost:3000/pirates', {
method: 'POST',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
name: pinp.value,
ship_id: ship.id,
})
})
})
const br = document.createElement("br");
form.append(plab, br, pinp, sub);
optimism = document.createElement("p");
optimism.innerText = pinp.value;
list.append(optimism)
list.appendChild(form);
})
}
|
import React from 'react';
import { View, StyleSheet, AsyncStorage } from 'react-native';
import { Notifications, Permissions } from 'expo';
const NOTIFICATION_KEY = 'UdaciCards:notifications';
// Push Notification
export function clearLocalNotification() {
return AsyncStorage.removeItem(NOTIFICATION_KEY).then(
Notifications.cancelAllScheduledNotificationsAsync,
);
}
function createNotification() {
return {
title: "Don't forget your UdaciCards!",
body: '👋 study any of your flashcards today!',
ios: {
sound: true,
},
android: {
sound: true,
priority: 'high',
sticky: false,
vibrate: true,
},
};
}
export function setLocalNotification() {
AsyncStorage.getItem(NOTIFICATION_KEY)
.then(JSON.parse)
.then(data => {
if (data === null) {
Permissions.askAsync(Permissions.NOTIFICATIONS).then(({ status }) => {
if (status === 'granted') {
Notifications.cancelAllScheduledNotificationsAsync();
let tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(16);
tomorrow.setMinutes(15);
Notifications.scheduleLocalNotificationAsync(createNotification(), {
time: tomorrow,
repeat: 'day',
});
AsyncStorage.setItem(NOTIFICATION_KEY, JSON.stringify(true));
}
});
}
});
}
// Format Questions Lenght
export function formatQuestionsLength(questionsLength) {
const ql = questionsLength;
if (ql === 1) {
return `${ql} card`;
}
return `${ql} cards`;
}
|
/**
* @Summary: short description for the file
* @Date: 2020/3/19 12:29 PM
* @Author: Youth
*/
const {createProxyMiddleware} = require('http-proxy-middleware')
module.exports = function (app) {
app.use('/g2',createProxyMiddleware(
{
"target": "https://view.inews.qq.com",
"changeOrigin": true
}));
app.use('/news', createProxyMiddleware(
{
"target": "https://mat1.gtimg.com",
"changeOrigin": true,
}));
} |
'use strict';
describe('Loading Test Chrome Extension (integration)', function () {
var url = 'https://localhost:12222';
// Dummy variables so that functions can be passed to browser window
var window;
var login = function() {
return browser.executeScript(function() {
window.click('.login_button');
});
};
afterEach(function() {
closePopup();
});
it('should login', function() {
checkLogin(url, login);
});
it('should make api call', function () {
openPopup()
.then(function() {
}).then(function() {
return waitForExtensionScript(function(cb) {
window.setValue('.text_input', 'Testing', cb);
}, function(ret) {
return true;
});
}).then(function(ret) {
return waitForExtensionScript(function(cb) {
window.click('.api_button', cb);
}, function(ret) {
return true;
});
}).then(function(ret) {
return waitForExtensionScript(function(cb) {
window.getText('.api_result', cb);
}, function(ret) {
return ret.value;
});
}).then(function(val) {
// link has been bammed -- assert that correct API request was made
var apiPath = '/api/';
var apiRequest = getLastRequest(apiPath);
expect(apiRequest.path).toEqual(apiPath);
expect(apiRequest.method).toEqual('POST');
expect(apiRequest.post_body.text).toEqual('Testing');
expect(val).toEqual('RESULT');
});
});
it('should logout', function() {
checkLogout();
});
});
|
var bunyan = require('bunyan');
var log = bunyan.createLogger({name: "node-socketio-chat"});
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io')(server);
var port = 3000;
if(process.argv[2] === undefined) {
// do nothing
} else {
port = process.argv[2];
}
app.use(express.static(__dirname));
io.on('connection', function (socket) {
log.info("new connection received");
socket.on('logging-in', function (username) {
log.info("logging-in %s", username);
socket.username = username;
socket.broadcast.emit('logged-in', {
username: socket.username,
message: username + " logged in"
});
socket.emit('logged-in', {
username: socket.username,
message: username + " logged in"
});
});
socket.on('logging-out', function (username) {
log.info("logging-out %s", username);
socket.username = username;
socket.broadcast.emit('logged-out', {
username: socket.username,
message: username + " logged out"
});
socket.emit('logged-out', {
username: socket.username,
message: username + " logged out"
});
});
socket.on('send-message', function (chatMessage) {
log.info("%s clicked-button %s", socket.username, chatMessage);
socket.broadcast.emit('message-from-server', {
username: socket.username,
sender: socket.username,
message: chatMessage
});
socket.emit('message-from-server', {
username: socket.username,
sender: socket.username,
message: chatMessage
});
});
socket.on('disconnect', function () {
log.info("disconnect received");
});
});
server.listen(port, function () {
log.info('Server listening at port %d', port);
});
|
$(function () {
$("#userName").on("keyup", function () {
if($(this).val().length <= 0){
$(this).attr("placeholder", "请输入手机号");
$(this).siblings("i").addClass("hide");
} else {
$(this).siblings("i").removeClass("hide").on("click", function () {
$("#userName").val("").attr("placeholder", "请输入手机号");
$(this).addClass("hide");
ableToSubmit();
})
}
})
$("#userName,#passWord").on("focus", function () {
$(this).attr("placeholder", "");
})
$("#userName").on("blur", function () {
if($(this).val().length <= 0){
$(this).attr("placeholder", "请输入手机号");
}
})
$("#passWord").on("blur", function () {
if($(this).val().length <= 0){
$(this).attr("placeholder", "6-18,必须包含数字、字母和字符");
}
})
$("#userName,#passWord").on("keyup", function () {
ableToSubmit();
})
$("#regist").on("click", function () {
var tel = $("#userName").val(),
passWord = $("#passWord").val(),
rPhone = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/,
// rPassword = /^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&*]+$)(?![a-zA-z\d]+$)(?![a-zA-z!@#$%^&*]+$)(?![\d!@#$%^&*]+$)[a-zA-Z\d!@#$%^&*]+$/;
// rPassword = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
rPassword = /^(?=.{6,16}$)(?![0-9]+$)(?!.*(.).*\1)[0-9a-zA-Z]+$/
var UNameResult = rPhone.test(tel),
UPsdResult = rPassword.test(passWord),
massage = "",
params = {};
if(!UNameResult){
params.massage = "请输入合法的手机号";
showToast(params)
return
}
if(!UPsdResult){
params.massage = "请输入合法的密码";
showToast(params)
return
}
let user = {
tel,
pwd : passWord,
//userName ,
//sex,
//age ,
//userPic
}
registUser(user, "注册成功")
})
function ableToSubmit() {
if($("#userName").val() && $("#passWord").val()){
$(".submit").addClass("active");
} else{
$(".submit").removeClass("active");
}
}
$("#login").on("click", () => {
var userName = $("#userName").val(),
passWord = $("#passWord").val(),
rPhone = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/,
// rPassword = /^(?![a-zA-z]+$)(?!\d+$)(?![!@#$%^&*]+$)(?![a-zA-z\d]+$)(?![a-zA-z!@#$%^&*]+$)(?![\d!@#$%^&*]+$)[a-zA-Z\d!@#$%^&*]+$/;
// rPassword = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]");
rPassword = /^(?=.{6,16}$)(?![0-9]+$)(?!.*(.).*\1)[0-9a-zA-Z]+$/
var UNameResult = rPhone.test(userName),
UPsdResult = rPassword.test(passWord),
massage = "",
params = {};
if(!UNameResult){
params.massage = "请输入合法的手机号";
showToast(params)
return
}
if(!UPsdResult){
params.massage = "请输入合法的密码";
showToast(params)
return
}
login(userName, passWord)
})
})
function registUser(user, massage){
let params = user
myAjax.request({
url: basepath + "/userinfo/addUserinfo.do",
type: "POST"
}, params)
.then( (result) => {
//alert(JSON.stringify(result))
var lParams = {
message: massage,
time: 3000,
callback: function(){
if(result.status == 0){//console.log(1);
setTimeout(function () {
window.location.href = "login.html";
}, 3000);
}
}
}
showToast(lParams)
}).catch((error) => {
console.error("报错了:"+error);
});
}
function login(tel, pwd){
let params = {tel: tel,pwd: pwd}
myAjax.request({
url: basepath + "/userinfo/checkLogin.do",
type: "POST"
}, params)
.then((result) => {
//alert(JSON.stringify(result))
var lParams = {
message: result.msg,
callback: function(){
if(result.status == 0){//console.log(1);
ddsc.localStorage.set('userinfo', result.data)
window.history.go(-1);
}
}
}
showToast(lParams)
}).catch((error) => {
console.error("报错了:"+error);
});
} |
import { toRomNum } from "./roman-numerals";
describe("Converting Between Numbers and Roman Numerals", () => {
describe("Converting Num to RomNum", () => {
describe("Simple Numbers", () => {
it("Should return Is for each number <4", () => {
expect(toRomNum(1)).toBe("I");
expect(toRomNum(2)).toBe("II");
expect(toRomNum(3)).toBe("III");
});
it("Should return V for 5", () => {
expect(toRomNum(5)).toBe("V");
});
it("Should return X for 10", () => {
expect(toRomNum(10)).toBe("X");
});
it("Should return L for 50", () => {
expect(toRomNum(50)).toBe("L");
});
it("Should return C for 100", () => {
expect(toRomNum(100)).toBe("C");
});
it("Should return D for 500", () => {
expect(toRomNum(500)).toBe("D");
});
it("Should return M for 1000", () => {
expect(toRomNum(1000)).toBe("M");
});
});
describe("Combining letters", () => {
it("Should return V and Is relevant to each number 6-8", () => {
expect(toRomNum(6)).toBe("VI");
expect(toRomNum(7)).toBe("VII");
expect(toRomNum(8)).toBe("VIII");
});
it("Should return the appropriate values for numbers 11-18", () => {
expect(toRomNum(11)).toBe("XI");
expect(toRomNum(12)).toBe("XII");
expect(toRomNum(13)).toBe("XIII");
expect(toRomNum(15)).toBe("XV");
expect(toRomNum(16)).toBe("XVI");
expect(toRomNum(17)).toBe("XVII");
expect(toRomNum(18)).toBe("XVIII");
});
it("Should return the appropriate values for numbers 31-38", () => {
expect(toRomNum(31)).toBe("XXXI");
expect(toRomNum(32)).toBe("XXXII");
expect(toRomNum(33)).toBe("XXXIII");
expect(toRomNum(35)).toBe("XXXV");
expect(toRomNum(36)).toBe("XXXVI");
expect(toRomNum(37)).toBe("XXXVII");
expect(toRomNum(38)).toBe("XXXVIII");
});
it("Should return the appropriate values for numbers 61-68", () => {
expect(toRomNum(61)).toBe("LXI");
expect(toRomNum(62)).toBe("LXII");
expect(toRomNum(63)).toBe("LXIII");
expect(toRomNum(65)).toBe("LXV");
expect(toRomNum(66)).toBe("LXVI");
expect(toRomNum(67)).toBe("LXVII");
expect(toRomNum(68)).toBe("LXVIII");
});
});
describe("1 multiple less than next tier", () => {
it("Should return IV for 4", () => {
expect(toRomNum(4)).toBe("IV");
});
it("Should return XL for 40", () => {
expect(toRomNum(40)).toBe("XL");
});
it("Should return CD for 400", () => {
expect(toRomNum(400)).toBe("CD");
});
});
describe("1 less than next tier", () => {
it("Should return IX for 9", () => {
expect(toRomNum(9)).toBe("IX");
});
it("Should return XLIX for 49", () => {
expect(toRomNum(49)).toBe("XLIX");
});
it("Should return XCIX for 99", () => {
expect(toRomNum(99)).toBe("XCIX");
});
it("Should return CMXCIX for 999", () => {
expect(toRomNum(999)).toBe("CMXCIX");
});
});
describe("Extra tests.", () => {
it("Should return the correct values for these conversions", () => {
expect(toRomNum(75)).toBe("LXXV");
expect(toRomNum(689)).toBe("DCLXXXIX");
expect(toRomNum(92)).toBe("XCII");
expect(toRomNum(500)).toBe("D");
expect(toRomNum(42)).toBe("XLII");
});
});
});
});
|
test('des07', () => {
const alphabetGrec = [
'α',
'β',
'γ',
'δ',
'ε'
]
const [alpha, beta] = alphabetGrec
const rest = [alphabetGrec[2], alphabetGrec[3], alphabetGrec[4]]
console.log(rest)
}); |
import React from 'react'
import { Link } from 'react-router-dom'
import PosmeLogo from './images/PosmeLogo.png'
import './login.css'
import TextField from '@material-ui/core/TextField'
import Grid from "@material-ui/core/Grid"
import Home from '../../pages/Home'
const Login = props => {
return (
<>
<img alt='logo' className='posme' src={PosmeLogo} />
{/* <h4 className='meaning'>Point Of Sale Made Easy</h4> */}
<Grid container spacing={0}>
<Grid item xs={12}>
<form className='form-input' >
<TextField
id='username'
label='Username'
className='username-input'
type='username'
autoComplete='username'
margin='normal'
variant='outlined'
onChange={props.handleInputChange}
value={props.username}
/>
<TextField
id='password'
label='Password'
className='username-input'
type='password'
autoComplete='current-password'
margin='normal'
variant='outlined'
onChange={props.handleInputChange}
value={props.password}
/>
<div>
<Link to='/home'>
<button
className='login'
type='button'
name='data'
onClick={props.handleLogInUser}
>
LOGIN
</button>
</Link>
</div>
</form>
</Grid>
</Grid>
</>
)
}
export default Login
|
'use strict';
require('mocha');
var assert = require('assert');
var Base = require('templates');
var toc = require('./');
var app;
describe('verb-toc', function() {
beforeEach(function() {
app = new Base();
app.use(toc);
app.create('pages');
app.create('layouts', {viewType: 'layout'});
app.engine('.md', require('engine-base'));
});
describe('module', function() {
it('should export a function', function() {
assert.equal(typeof toc, 'function');
});
});
describe('middleware', function() {
it('should emit `toc`', function(cb) {
app.options.toc = { render: true };
app.on('toc', toc.injectToc(app));
app.layout('default', {content: 'abc {% body %} xyz'});
app.page('note.md', {
content: '\n<!-- toc -->\n\n## Foo\n This is foo.\n\n## Bar\n\nThis is bar.',
layout: 'default'
})
.render(function(err, res) {
if (err) return cb(err);
assert(res.content.indexOf('- [Foo](#foo)\n- [Bar](#bar)') !== -1);
cb();
});
});
});
describe('headings', function() {
it('should render templates in headings', function(cb) {
app.options.toc = true;
app.postRender(/./, toc.injectToc(app));
app.data({name: 'Test'});
app.layout('default', {content: 'abc {% body %} xyz'});
var page = app.page('note.md', {
content: '\n<!-- toc -->\n\n## <%= name %>\n This is foo.\n\n## Bar\n\nThis is bar.',
layout: 'default'
});
app.render(page, function(err, res) {
if (err) return cb(err);
assert.equal(res.content, 'abc \n- [Test](#test)\n- [Bar](#bar)\n\n## Test\n This is foo.\n\n## Bar\n\nThis is bar. xyz');
cb();
});
});
it('should remove `## TOC` when toc is disabled', function(cb) {
app.options.toc = false;
app.postRender(/./, toc.injectToc(app));
app.data({name: 'Test'});
app.layout('default', {content: 'abc {% body %} xyz'});
var page = app.page('note.md', {
content: '\n## TOC <!-- toc -->\n\n## <%= name %>\nThis is foo.\n\n## Bar\n\nThis is bar.',
layout: 'default'
});
app.render(page, function(err, res) {
if (err) return cb(err);
assert.equal(res.content, 'abc \n \n\n## Test\nThis is foo.\n\n## Bar\n\nThis is bar. xyz');
cb();
});
});
it('should remove `## Table of Contents` when toc is disabled', function(cb) {
app.options.toc = false;
app.postRender(/./, toc.injectToc(app));
app.data({name: 'Test'});
app.layout('default', {content: 'abc {% body %} xyz'});
var page = app.page('note.md', {
content: '\n## Table of Contents <!-- toc -->\n\n## <%= name %>\nThis is foo.\n\n## Bar\n\nThis is bar.',
layout: 'default'
});
app.render(page, function(err, res) {
if (err) return cb(err);
assert.equal(res.content, 'abc \n \n\n## Test\nThis is foo.\n\n## Bar\n\nThis is bar. xyz');
cb();
});
});
it('should render templates in headings with a helper', function(cb) {
app.helper('upper', function(str) {
return str.toUpperCase();
});
app.options.toc = true;
app.postRender(/./, toc.injectToc(app));
app.data({name: 'Test'});
app.layout('default', {content: 'abc {% body %} xyz'});
var page = app.page('note.md', {
content: '\n<!-- toc -->\n\n## <%= upper(name) %>\n This is foo.\n\n## Bar\n\nThis is bar.',
layout: 'default'
});
app.render(page, function(err, res) {
if (err) return cb(err);
assert.equal(res.content, 'abc \n- [TEST](#test)\n- [Bar](#bar)\n\n## TEST\n This is foo.\n\n## Bar\n\nThis is bar. xyz');
cb();
});
});
});
});
|
// This is a small program. There are only two sections. This first section is what runs
// as soon as the page loads and is where you should call your functions.
$(document).ready(function(){
const $display = $('#display');
// TODO: Call your apply function(s) here
applyFilterNoBackground(reddify);
applyFilterNoBackground(decreaseBlue);
applyFilterNoBackground(increaseGreenByBlue);
render($display, image);
});
/////////////////////////////////////////////////////////
// "apply" and "filter" functions should go below here //
/////////////////////////////////////////////////////////
function filterFunction() {
}
// TODO 1 & 3: Create the applyFilter function here
function applyFilter(filterFunction) {
for (var i = 0; i < image.length; i++) {
for (var j = 0; j < image[i].length; j++) {
var rgbString = image[i][j]
var rgbNumbers = rgbStringToArray(rgbString);
filterFunction(rgbNumbers);
var rgbString = rgbArrayToString(rgbNumbers);
image[i][j] = rgbString
}
}
}
// TODO 5: Create the applyFilterNoBackground function
function applyFilterNoBackground(filterFunction){
var background = image[0][0]
for (var i = 0; i < image.length; i++) {
for (var j = 0; j < image[i].length; j++) {
var rgbString = image[i][j]
var rgbNumbers = rgbStringToArray(rgbString);
if (image[i][j] === background){
rgbString = rgbArrayToString(rgbNumbers);
image[i][j] = rgbString
}
else {
filterFunction(rgbNumbers);
rgbString = rgbArrayToString(rgbNumbers);
image[i][j] = rgbString
}
}
}
}
// TODO 2 & 4: Create filter functions
function reddify(array){
array[RED] = 255;
}
function decreaseBlue(array){
Math.max(0, array[BLUE] = array[BLUE] - 30);
}
function increaseGreenByBlue(array){
Math.min(0, array[GREEN] = array[GREEN] + array[BLUE]);
}
// CHALLENGE code goes below here
|
// import openSocket from 'socket.io-client';
import io from 'socket.io-client'
import { loadState, saveState } from 'trading_app/lib/utils/localStorage'
class WebSocketService {
constructor() {
const agentAddress = loadState('REKCLE::IP') || '127.0.0.1'
saveState('REKCLE::IP', agentAddress)
this.socket = io(`http://${agentAddress}:5000/`, {
autoConnect: false,
reconnection: false,
// reconnectionAttempts: 3,
transports: ['websocket']
})
// console.log(this.socket)
}
connect() {
this.socket.open()
// this.socket.connect()
}
disconnect() {
this.socket.disconnect()
}
send(message) {
this.socket.send(message)
}
emit(event, data) {
this.socket.emit(event, data)
// socket.emit('CSE', {data: 'blah'})
}
}
export default WebSocketService
|
import { connect } from "react-redux";
import Projects from "./Projects";
import actions from "../../redux/actions";
const mapStateToProps = state => ({
...state.projectsParams
});
export default connect(
mapStateToProps,
actions
)(Projects);
|
class Librarian {
constructor(name, library) {
this.name = name;
this.library = library;
}
greetPatron(name, morning = false){
if (morning == true){
return `Good morning, ${name}!`
} else{
return `Hello, ${name}!`
}
}
findBook(bookName){
var fantasyBooks = this.library.shelves.fantasy
for (var i = 0; i < fantasyBooks.length; i++) {
if ( fantasyBooks[i].title == bookName){
fantasyBooks.splice(i, 1)
return `Yes, we have ${bookName}`
}
}
return `Sorry, we do not have ${bookName}`
}
calculateLateFee(days) {
return Math.round(0.25 * days)
}
}
module.exports = Librarian; |
canvas=document.getElementById("myCanvas");
ctx=canvas.getContext("2d");
color="red";
ctx.beginPath();
ctx.strokeStyle=color;
ctx.lineWidth=2;
ctx.rect(150,143,430,200);
ctx.stroke();
color="blue";
ctx.beginPath();
ctx.strokeStyle=color;
ctx.lineWidth=6;
ctx.arc(250,210,40,0,2*Math.PI);
ctx.stroke();
color="black";
ctx.beginPath();
ctx.strokeStyle=color;
ctx.lineWidth=6;
ctx.arc(340,210,40,0,2*Math.PI);
ctx.stroke();
color="red";
ctx.beginPath();
ctx.strokeStyle=color;
ctx.lineWidth=6;
ctx.arc(430,210,40,0,2*Math.PI);
ctx.stroke();
color="yellow";
ctx.beginPath();
ctx.strokeStyle=color;
ctx.lineWidth=6;
ctx.arc(296,260,40,0,2*Math.PI);
ctx.stroke();
color="green";
ctx.beginPath();
ctx.strokeStyle=color;
ctx.lineWidth=6;
ctx.arc(390,260,40,0,2*Math.PI);
ctx.stroke(); |
exports.Section = `
type Section {
title: String!
description: String!
category: String!
videos: [Video]
}
`;
|
import "./styles.css";
document.getElementById("app").innerHTML = `
<h1>Hello Vanilla!</h1>
<div>
We use the same configuration as Parcel to bundle this sandbox, you can find more
info about Parcel
<a href="https://parceljs.org" target="_blank" rel="noopener noreferrer">here</a>.
</div>
`;
// 分割代入
// const myProfile = {
// name: "yu",
// age: 26
// };
// const { name, age } = myProfile;
// const message1 = `名前は${name}, 年齢は${age}です。`;
// console.log(message1);
// const myProfile = ["yu", 26];
// const message3 = `名前は${myProfile[0]}, 年齢は${myProfile[1]}`;
// const [name, age] = myProfile;
// const message4 = `名前は${name}、年齢は${age}`;
// console.log(message4);
// スプレッド構文
// ...
// 配列の展開
// const arr1 = [1, 2];
// // console.log(arr1);
// // console.log(...arr1);
// const sumFunc = (num1, num2) => console.log(num1 + num2);
// console.log(arr1);
// // sumFunc(arr1[0], arr1[1]);
// sumFunc(...arr1);
// まとめる
// const arr2 = [1, 2, 3, 4];
// const [num1, num2, ...arr3] = arr2;
// console.log(num1);
// console.log(arr3);
// 配列のコピーと結合
const arr4 = [10, 20];
const arr5 = [30, 40];
// const arr6 = [...arr4];
// console.log(arr6);
// const arr7 = [...arr4, ...arr5];
// console.log(arr7);
// const arr8 = arr4;
// console.log(arr8);
// arr8[0] = 100;
// console.log(arr4);
// for (let i = 0; i < nameArr.length; i++) {
// console.log(nameArr[i]);
// }
// const nameArr2 = nameArr.map((name) =>{
// return name;
// });
// console.log(nameArr2);
// nameArr.map((name) => console.log(name));
// const numArr = [1, 2, 3, 4, 5];
// // const newNumArr = numArr.filter((num) => {
// // return num % 2 === 1;
// // });
// // console.log(newNumArr);
// // nameArr.map((name, index) => console.log(`${index + 1}の要素は${name}です`));
// const nameArr = ["田中", "山田", "yu"];
// const newNameArr = nameArr.map((name) => {
// if (name === "yu") {
// return name;
// } else {
// return `${name}さん`;
// }
// });
// console.log(newNameArr);
// const num = "1300";
// console.log(num.toLocaleString());
// const formattedNum =
// typeof num === "number" ? num.toLocaleString() : "数値を入力してください";
// console.log(formattedNum);
// const checkSum = (num1, num2) => {
// return num1 + num2 > 100 ? "100を超えています!!" : "許容範囲内です";
// };
// console.log(checkSum(500, 1));
// ||は左がfalseなら右を返す
const num = 100;
const fee = num && "金額未設定です";
console.log(fee);
|
import React from 'react';
import styled from 'styled-components';
const AvatarContainer = styled.div`
margin-right: 30px;
`;
const AvatarImage = styled.img`
margin-top: 24px;
width: 90px;
height: 90px;
border-radius: 100px;
`;
const Username = styled.p`
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
`;
const Avatar = (props) => {
return (
<AvatarContainer>
<AvatarImage src={props.avatar}></AvatarImage>
<Username>{`${props.firstName} ${props.lastName}`}</Username>
</AvatarContainer>
);
};
export default Avatar; |
var gulp = require('gulp');
var pkg = require('./package.json');
// Gulp Package
var browser = require('browser-sync');
var ts = require('gulp-typescript');
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
var header = require('gulp-header');
var plumber = require('gulp-plumber');
// Path
var build = "./build";
var source = "./source";
gulp.task('html', function() {
gulp.src(source + '/html/*')
.pipe(gulp.dest('./build'))
.pipe(browser.reload({stream: true}));
});
gulp.task('sass', function() {
gulp.src(source + "/sass/*.sass")
.pipe(plumber())
.pipe(sass({outputStyle: 'compressed'}))
.pipe(header('/* copyright <%= pkg.author %> */', {pkg: pkg}))
.pipe(gulp.dest("./build/stylesheets"))
.pipe(browser.reload({stream: true}));
});
gulp.task('typescript', function() {
gulp.src(source + '/**/js/*.ts')
.pipe(plumber())
.pipe(ts({
nolmplicitAny: true,
out: 'main.js'
}))
.pipe(uglify())
.pipe(header('/* copyright <%= pkg.author %> */', {pkg: pkg}))
.pipe(gulp.dest(build + '/javascript'))
.pipe(browser.reload({stream: true}));
});
gulp.task('server', function() {
browser({
server: {
baseDir: build
}
});
});
gulp.task('build', ['html', 'sass', 'typescript']);
gulp.task('default', ['build', 'server'], function() {
gulp.watch([build + "/*"]);
gulp.watch(source + "/html/*", ["html"]);
gulp.watch(source + "/sass/*.sass", ["sass"]);
gulp.watch(source + "/js/*.ts", ["typescript"]);
}); |
import { AuthenticationError, ForbiddenError } from "apollo-server";
import models from "./../../graphql/models/index.js";
import { encryptor } from "./Encryption.js";
import jwt from "jsonwebtoken";
import _ from "lodash";
export const auth = {
authorize: async (license, credentials) => {
if (!license)
throw new AuthenticationError("You must be logged in for use this query");
const { rolType } = (await models.Roles.findById(license)) || [];
if (!rolType || !credentials.includes(rolType))
throw new ForbiddenError(
"invalid credentials: You are not allowed to use this query"
);
},
authenticate: async (email, password) => {
const user = await models.Users.findOne({ email: email });
if (user) {
const userPSW = encryptor.decrypt(user.password);
if (userPSW == password) {
return {
found: true,
authenticated: true,
user,
};
}
return {
found: true,
authenticated: false,
};
}
return {
found: false,
authenticated: false,
};
},
setToken: (user) => {
console.log("setting token");
const token = jwt.sign({ user }, "secret");
return token;
},
getLicense: async (token) => {
if (!token) return "";
const { user } = jwt.verify(token, "secret");
// console.log(user);
if (user) {
const getUser = await models.Users.findById({
_id: user,
});
if (!getUser) throw new AuthenticationError("Invalid token");
if (await models.Roles.findById({ _id: getUser.role }))
return getUser.role;
}
},
};
|
// LAY DANH SACH LOAI NGUOI DUNG
export const LAY_DANH_SACH_LOAI_NGUOI_DUNG_REQUEST =
"LAY_DANH_SACH_LOAI_NGUOI_DUNG_REQUEST";
export const LAY_DANH_SACH_LOAI_NGUOI_DUNG_SUCCESS =
"LAY_DANH_SACH_LOAI_NGUOI_DUNG_SUCCESS";
export const LAY_DANH_SACH_LOAI_NGUOI_DUNG_FAILURE =
"LAY_DANH_SACH_LOAI_NGUOI_DUNG_FAILURE";
//LAY DANH SACH NGUOI DUNG PHAN TRANG
export const LAY_DANH_SACH_NGUOI_DUNG_PHAN_TRANG_REQUEST =
"LAY_DANH_SACH_NGUOI_DUNG_PHAN_TRANG_REQUEST";
export const LAY_DANH_SACH_NGUOI_DUNG_PHAN_TRANG_SUCCESS =
"LAY_DANH_SACH_NGUOI_DUNG_PHAN_TRANG_SUCCESS";
export const LAY_DANH_SACH_NGUOI_DUNG_PHAN_TRANG_FAILURE =
"LAY_DANH_SACH_NGUOI_DUNG_PHAN_TRANG_FAILURE";
// THAY DOI THONG TIN PHAN TRANG
export const THAY_DOI_THONG_TIN_PHAN_TRANG_NGUOI_DUNG =
"THAY_DOI_THONG_TIN_PHAN_TRANG_NGUOI_DUNG";
|
import React, { useContext } from "react"
import { SearchWrapper, SearchInput, SearchIcon, SearchButton } from "./Styled"
import { ContentContext } from "../DataContent"
export function Search(props) {
const [dispatch, actions] = useContext(ContentContext)
const handleChange = e => {
const input = e.target.value
if (input.length > 3) {
dispatch({ type: actions.CHANGE_INPUT, payload: e.target.value })
} else {
dispatch({ type: actions.CHANGE_INPUT, payload: "" })
}
}
return (
<SearchWrapper>
<SearchInput
type="text"
placeholder="Search..."
onChange={handleChange} />
<SearchButton>
<SearchIcon
src="/assets/search.svg" />
</SearchButton>
</SearchWrapper>
)
} |
import {applyMiddleware, combineReducers, createStore} from 'redux';
import {createForms} from 'react-redux-form';
// reducers
import {Dishes} from './reducers/dishes';
import {Comments} from './reducers/comments';
import {Promotions} from './reducers/promotions';
import {Leaders} from './reducers/leaders';
import {Authentication} from './reducers/authentication'
import {Favorites} from "./reducers/favorites";
import {SignUpUser} from "./reducers/signUpUser";
import {InitialFeedback} from './form';
import thunk from 'redux-thunk';
import logger from 'redux-logger';
export const ConfigureStore = () => {
return createStore(
combineReducers({
dishes: Dishes,
comments: Comments,
promotions: Promotions,
leaders: Leaders,
...createForms({
feedback: InitialFeedback
}),
authentication: Authentication,
signUpUser: SignUpUser,
favorites: Favorites
}),
applyMiddleware(thunk, logger)
);
} |
/*
* Copyright (C) 2021 Radix IoT LLC. All rights reserved.
*/
serialPortFactory.$inject = ['$http'];
function serialPortFactory($http) {
const baseUrl = '/rest/latest/server/serial-ports';
class SerialPort {
static list(params = {}) {
return $http({
method: 'GET',
url: baseUrl,
params: params
}).then(response => {
return response.data;
});
}
}
return SerialPort;
}
export default serialPortFactory;
|
import Vue from 'vue';
import App from '../components/App.vue';
export function createApp(data = {
list: [],
sort: 0,
type: 0,
sortFn: () => null,
filtFn: () => null,
}) {
const app = new Vue({
render: h => h(App, {
props: data,
}),
});
return { app }
} |
/*
* @Author: xr
* @Date: 2021-03-20 12:05:07
* @LastEditors: xr
* @LastEditTime: 2021-03-20 12:10:24
* @version: v1.0.0
* @Descripttion: 功能说明
* @FilePath: \ui\src\store\index.js
*/
import { createStore } from 'vuex'
import modules from './modules'
export default createStore({
modules
})
|
/***
* Project: MDL
* Author: Rushan Arunod
* Module: GPS Services
*/
'use strict';
var serviceName = 'mdl.mobileweb.service.gpstrack'
angular.module('newApp').service(serviceName,['$http','$location','settings','mdl.mobileweb.service.login',
function($http,$location,settings,loginService) {
var vm = this;
vm.webApiBaseUrl = settings.webApiBaseUrl;
vm.jaxrsApiBaseUrl = settings.mdljaxrsApiBaseUrl;
vm.startGpsTracking = function(storeLocation,callback){
var body ={
"longtitude":storeLocation.longitude,
"latitude":storeLocation.latitude };
var authEndpoint = vm.jaxrsApiBaseUrl+'gpstrack/starttrack';
$http.post(authEndpoint,body,{headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}})
.success(function (response) {
callback(response);
})
.error(function (errResponse) {
console.log(" Error returning from " + authEndpoint);
callback(errResponse);
});
}
vm.updateGpsTracking = function(storeLocation,callback){
var body ={
"longtitude":storeLocation.longitude,
"latitude":storeLocation.latitude };
var authEndpoint = vm.jaxrsApiBaseUrl+'gpstrack/updatetrack';
$http.post(authEndpoint,body,{headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}})
.success(function (response) {
callback(response);
})
.error(function (errResponse) {
console.log(" Error returning from " + authEndpoint);
callback(errResponse);
});
}
vm.stopGpsTracking = function(callback){
var body ={
"token":"" };
var authEndpoint = vm.jaxrsApiBaseUrl+'gpstrack/closetrack';
$http.post(authEndpoint,body,{headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}})
.success(function (response) {
callback(response);
})
.error(function (errResponse) {
console.log(" Error returning from " + authEndpoint);
callback(errResponse);
});
}
vm.getMapCenter = function(callback){
var body ={
"token":""
};
var authEndpoint = vm.jaxrsApiBaseUrl + 'gpstrack/getmapcenter';
$http.post(authEndpoint,body,{
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
})
.success(function (response) {
callback(response);
})
.error(function (errResponse) {
console.log(" Error returning from " + authEndpoint);
});
}
} ]); |
import React, { Component } from "react";
import JobDB from "../../utils/DB/JobDB"
import "./Results.css"
import {Redirect} from "react-router-dom"
class JobResults extends Component {
state = {
applied: "",
type: this.props.type,
filter: this.props.filter,
userID: "",
jobs: [],
}
componentDidUpdate(){
if(this.state.type === "browse")
this.getJobs()
else if(this.state.type === "profile")
this.getUsersJob()
}
getUsersJob(){
JobDB.getUsersJobs(sessionStorage.getItem("id")).then(
res => this.setState({jobs: res.data.jobs}))
//res => console.log(res.data.jobs))
}
getJobs(){
if(this.state.filter === "All" && this.state.type === "browse"){
JobDB.get()
.then(res =>
this.setState({jobs: res.data}))
.catch(err => console.log(err));
}
else if(this.state.filter != "All" && this.state.type === "browse"){
JobDB.getFiltered(this.state.filter).then(res => this.setState({jobs: res.data}))
.catch(err => console.log(err))
}
}
componentDidMount() {
if(this.state.type === "browse")
this.getJobs()
else if(this.state.type === "profile")
this.getUsersJob()
}
handleApplication(subject){
if(sessionStorage.getItem("id") === null){
this.setState({applied:"failed"})
}else{
sessionStorage.setItem("subject", subject)
this.setState({applied: "success"})
}
}
handleDelete(subject){
JobDB.delete(subject).then(this.getUsersJob())
}
render(){
if(this.state.applied === "success"){
return(
<Redirect to="/apply"/>
)
}
else if(this.state.applied === "failed"){
return(
<Redirect to="/login"/>
)
}
return(
<div>
{this.state.jobs.map(job => {
if(job.creatorID === sessionStorage.getItem("id") & this.state.type === "browse"){
return(<div></div>)
}
else{
return(
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-4"><h4 class="creator" >Job: {job.title}</h4></div>
<div class="col-md-4"><h4 class="creator" >Creator: {job.creator}</h4></div>
<div class="col-md-4 category"><h4 class="cat">Type: {job.category}</h4></div>
</div>
<div class="row">
<div class="col-md-12 desc"><h4>Description:</h4><p class="desc">{job.description}</p></div>
</div>
<div class="row">
<div class="col-md-6 price"><h4 class="est">Estimate: ${job.estimate}</h4></div>
<div class="col-md-6 apply"><button class="browseBtn" onClick={(subject) => this.state.type === "browse" ? this.handleApplication(job._id) : this.handleDelete(job._id)}>{this.state.type === "browse" ? "Apply" : "Delete"}</button></div>
</div>
</div>
</div>
</div>
</div>
)}})}
</div>
)}
}
export default JobResults; |
const path = require("path");
const router = require("express").Router();
const apiRoutes = require("./api");
// Add Imported API Routes and add the "/api" part the the URL request
router.use("/api", apiRoutes);
// If no API routes are hit then send back to the React app by default
router.use(function(req, res) {
res.sendFile(path.join(__dirname, "../client/build/index.html"));
});
module.exports = router;
|
//handleData will calculate sum of revenue and stuff on the home page -applist-company card
export const handleData = (arr) => {
//sumObj contains sum of field revenue,adRequest,adResponse, impressions which are initialized with 0
const sumObj = { revenue: 0, adRequest: 0, adResponse: 0, impressions: 0 };
arr.forEach((obj) => {
sumObj["revenue"] += obj["revenue"];
sumObj["adRequest"] += obj["adRequest"];
sumObj["adResponse"] += obj["adResponse"];
sumObj["impressions"] += obj["impressions"];
});
function dataFormat(num) {
// Nine Zeroes for Billions
return Math.abs(Number(num)) >= 1.0e9
? Math.round(Math.abs(Number(num)) / 1.0e9) + "B"
: // Six Zeroes for Millions
Math.abs(Number(num)) >= 1.0e6
? Math.round(Math.abs(Number(num)) / 1.0e6) + "M"
: // Three Zeroes for Thousands
Math.abs(Number(num)) >= 1.0e3
? Math.round(Math.abs(Number(num)) / 1.0e3) + "K"
: Math.abs(Number(num));
}
for (let prop in sumObj) {
// sumObj[prop] = dataFormat(sumObj[prop])
sumObj[prop] = dataFormat(sumObj[prop]);
}
return sumObj;
};
|
import instanceAxios from '../api.config'
class TestStepAPI {
// The fields from the testObj update must be the same as in the Test model (see backend)
async create(lessonId) {
const { data } = await instanceAxios.post(`/lesson/test/create/${lessonId}`)
return data
}
async update(id, updateObj) {
const { data } = await instanceAxios.patch(`/lesson/test/update/${id}`, updateObj)
return data
}
async getOne(id) {
const { data } = await instanceAxios.get(`/lesson/test/${id}`)
return data
}
}
export default new TestStepAPI()
|
import React, {useEffect, useState, Fragment} from 'react';
import {useSelector, useDispatch} from 'react-redux';
import {addAsset} from '../../actions/assetActions';
import {addLiability} from '../../actions/liabilityActions';
import Alert from '../alert/Alert';
const Item = ({component_type, user_id}) => {
const dispatch = useDispatch();
const message = useSelector(state => state.message);
//Set item object state
const [isItem, setItem] = useState(
{
description_text : "",
item_number : -1.00,
message: null,
state: null
}
)
useEffect(() => {
//check for added item
if(message.id === 'ADD_ASSET_FAIL' || message.id === 'ADD_ASSET_SUCCESS' | message.id === 'ADD_LIABILITY_FAIL' || message.id === 'ADD_LIABILITY_SUCCESS'){
setItem(prevState => {
return {
...prevState,
message: message.msg.msg,
status: message.status
}
})
} else {
setItem(prevState => {
return {
...prevState,
message : null,
status: null
}
})
}
},[message])
const onChange = (e) => {
const value = e.target.value;
const inputName = e.target.name;
setItem(prevState => {
return {...prevState, [inputName] : value}
})
}
const onSubmit = (e) => {
e.preventDefault();
const newItem = {
description_text : isItem.description_text,
item_number : isItem.item_number === '' ? -1.00 : parseFloat(isItem.item_number).toFixed(2),
user_id : user_id
}
component_type === 1 ? dispatch(addAsset(newItem)) : dispatch(addLiability(newItem));
}
let returnMessage = '';
if(isItem.message){
returnMessage = (
<Fragment>
<div className="flex justify-center mb-0">
<div className="w-full px-3">
<Alert message={isItem.message} status={isItem.status}/>
</div>
</div>
</Fragment>
)
} else {
returnMessage = null;
}
//Determine color of button
let buttonCls = '';
component_type === 1 ? buttonCls = "bg-blue-500 text-white hover:bg-blue-600 font-bold uppercase text-sm py-3 px-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1" : buttonCls = "bg-orange-400 text-white hover:bg-orange-500 font-bold uppercase text-sm py-3 px-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1";
return (
<div>
<div className="md:flex justify-center md:mb-4 sm:mb-0">
<div className="w-full md:w-2/5 px-3 mb-2 md:mb-0">
<input className="block appearance-none w-full bg-white border border-gray-400 text-black py-3 px-3 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-700" type="text" placeholder="Enter account/description" name="description_text" onChange={onChange}/>
</div>
<div className="w-full md:w-2/5 px-3 mb-2 md:mb-0">
<input className="block appearance-none w-full bg-white border border-gray-400 text-black py-3 px-3 pr-8 rounded leading-tight focus:outline-none focus:bg-white focus:border-gray-700" type="number" placeholder="Enter number (without $)" name="item_number" onChange={onChange}/>
</div>
<div className="w-full md:w-1/5 px-3 mb-2 md:mb-0 text-center">
<button className={buttonCls} type="button" style={{ transition: "all .15s ease" }} onClick={onSubmit}>
Update
</button>
</div>
</div>
{returnMessage}
</div>
)
}
export default Item;
|
import { useEffect } from 'react';
function useCreateRoom(socket, room, setRoom, isCreated) {
useEffect(() => {
if(isCreated) {
socket.emit('create room', room.name, room.host.name, room.host.allowVideo);
socket.emit('join room', room.name);
setRoom({...room, isCreated: false});
}
}, [isCreated, socket, room, setRoom]);
}
export default useCreateRoom; |
//犬
function autodog() {
// 定期的に通知する内容を記載
const url = "http://shibe.online/api/shibes?count=1&urls=true&httpsUrls=true"; //URL+cityID
const resdog = UrlFetchApp.fetch(url);
Logger.log(resdog);
const dogimg = JSON.parse(resdog.getContentText());
Logger.log(dogimg);
const jsonData = {
username: "ユーザ名てすと",
icon_emoji: ":dog:",
attachments: [
{
fields: [
{
title: "しば",
},
],
image_url: dogimg[0],
},
],
};
const payload = JSON.stringify(jsonData);
// リクエスト内容を整形
const options = {
method: "post",
contentType: "application/json",
payload: payload,
};
//投稿先
UrlFetchApp.fetch(options);
}
//ねこ
function autocat() {
// APIの呼出し
const url = "https://aws.random.cat/meow";
const rescat = UrlFetchApp.fetch(url);
Logger.log(rescat);
// JSON形式に変換
catJSN = JSON.parse(rescat.getContentText());
Logger.log(catJSN);
// 画像のURLを取得
catimg = catJSN.file;
Logger.log(catimg);
const jsonData = {
username: "ユーザ名てすと",
icon_emoji: ":dog:",
attachments: [
{
fields: [
{
title: "ねこ",
value: "ここは画像の説明を記述できます。",
},
],
image_url: catimg,
},
],
};
const payload = JSON.stringify(jsonData);
// リクエスト内容を整形
const options = {
method: "post",
contentType: "application/json",
payload: payload,
};
//投稿先
UrlFetchApp.fetch(options);
}
//きつね
function autofox() {
// 定期的に通知する内容を記載
const url = "https://randomfox.ca/floof";
const resfox = UrlFetchApp.fetch(url);
Logger.log(resfox);
foximg = JSON.parse(resfox.getContentText());
Logger.log(foximg);
foximg2 = foximg.image;
Logger.log(foximg2);
const jsonData = {
username: "ユーザ名てすと",
icon_emoji: ":dog:",
attachments: [
{
fields: [
{
title: "きつね",
value: "ここは画像の説明を記述できます。",
},
],
image_url: foximg2,
},
],
};
const payload = JSON.stringify(jsonData);
// リクエスト内容を整形
const options = {
method: "post",
contentType: "application/json",
payload: payload,
};
//投稿先
UrlFetchApp.fetch(options);
}
|
function updateRecentPosts(){
jQuery.ajax({
url: "posts?actionName=recentPosts",
method: "GET",
contentType: "",
success:function(posts){
var postsArray = JSON.parse(posts)
var $recntPostsContainer = $(".recent");
for(var i in postsArray){
$recntPostsContainer.append('<div class="recent-post"><a href="Post.jsp?postId='+postsArray[i].post_id+'" style="font-size:15px" >'+postsArray[i].title+'</a></div>');
$recntPostsContainer.append('<div>'+postsArray[i].createdAt+'</div><br>')
}
},
error:function(e){
}
});
} |
module.exports = (app) => {
const duckie = require("../controllers/duckie.controller");
app.get("/", duckie.welcome);
app.post("/api/following", duckie.getFollowingUser);
app.post("/api/followers", duckie.getFollowersUser);
app.post("/api/:followerId/follow/:userToFollowId", duckie.followUser);
app.delete(
"/api/:followerId/unfollow/:userToUnfollowId",
duckie.unfollowUser
);
};
|
"use strict";
$(function() {
//查询购物车列表
shoppingQuery();
function shoppingQuery() {
$.utils
.ajax({
url : "/shoppingCart/queryshoppingCartList",
success : function(data) {
var div;
if (data.length == 0) {
div = '<div class="col-sm-12 orderList">'
+ '<p class="title"><strong>'+server_consts.noAdd+'</strong></p>'
+ '</div>'
} else {
div = '<div class="col-sm-12 orderList">'
+ '<p class="title"><strong>'+server_consts.tableTitle+'</strong></p>'
+ '<table class="table table-condensed">'
+ '<colgroup>'
+ '<col width="1%">'
+ '<col width>'
+ '<col width="5%">'
+ '<col width="20%">'
+ '<col width="7%">'
+ '</colgroup>'
+ '<thead>'
+ '<tr>'
+ '<th><button type="button" class="btn btn-default btn-xs selectAll">'+server_consts.selectAll+'</button></th>'
+ '<th><div class="col-sm-3"></div><div class="col-sm-9">'+server_consts.productName+'</div></th>'
+ '<th>'+server_consts.price+'</th>' + '<th>'+server_consts.count+'</th>'
+ '<th>'+server_consts.total+'</th>' + '<th>'+server_consts.operation+'</th>' + '</tr>'
+ '</thead>' + '<tbody class="condensedList">';
for ( var i in data) {
div += '<tr>'
+ '<td style="vertical-align: middle;">'
+ '<input type="checkbox" name="options" value="'+data[i].id+'">'
+ '<input type="hidden" name="inventory" value="'+data[i].inventory+'"></td>'
+ '<td><a href="'+server_consts.root+'/buyProduction?productId='+data[i].productId+'">'
+ '<div class="col-sm-3">'
+ '<img src='+imgUrl+''+data[i].pictureUrl+' width="70px">'
+ '</div>'
+ '<div class="col-sm-9">'
if(server_consts.language == "zh_CN"){
div += '<p>'+data[i].productNameZhCn+'</p>'
}else{
div += '<p>'+data[i].productNameEn+'</p>'
}
div += '</div>'
+ '</a></td>'
if(server_consts.language == "zh_CN"){
div += '<td><p class="price">'+data[i].productPriceRMB+'</p></td>'
}else{
div += '<td><p class="price">'+data[i].productPriceUSD+'</p></td>'
}
div += '<td>'
if(data[i].productQuantity <= 1){
div += '<span class="glyphicon glyphicon-minus min" style="color:#ccc;pointer-events:none"></span>'
}else{
div += '<span class="glyphicon glyphicon-minus min"></span>'
}
div += '<input class="enteramount2" type="hidden" onkeyup=\'this.value=this.value.replace(/[^\\d]/g,"")\' value='+data[i].productQuantity+'>'
div += '<input class="enteramount" type="text" onkeyup=\'this.value=this.value.replace(/[^\\d]/g,"")\' value='+data[i].productQuantity+'>'
if(data[i].productLimitedPurchaseAmount < data[i].inventory){
if(data[i].productQuantity >= data[i].productLimitedPurchaseAmount){
div += '<span class="glyphicon glyphicon-plus add" style="color:#ccc;pointer-events:none"></span><br/>'
}else{
div += '<span class="glyphicon glyphicon-plus add"></span><br/>'
}
}else{
if(data[i].productQuantity >= data[i].inventory){
div += '<span class="glyphicon glyphicon-plus add" style="color:#ccc;pointer-events:none"></span><br/>'
}else{
div += '<span class="glyphicon glyphicon-plus add"></span><br/>'
}
}
div += '<span style="margin-top:3px;display: block;">'+server_consts.inventory+':<span class="inventoryShow">'+data[i].inventory+'</span>'
+ '<span style="margin-left:20px">'+server_consts.limitedPurchaseAmount+':<span class="productLimitedPurchaseAmountShow">'+data[i].productLimitedPurchaseAmount+'</span></span></span>'
+ '</td>'
if(server_consts.language == "zh_CN"){
div += '<td><p class="totalPrices">'+accMul(data[i].productPriceRMB , data[i].productQuantity)+'</p></td>'
}else{
div += '<td><p class="totalPrices">'+accMul(data[i].productPriceUSD , data[i].productQuantity)+'</p></td>'
}
div += '<td><a class="del">'+server_consts.deleteData+'</a></td>'
+ '</tr>';
}
div += '</tbody>'
+ '</table>'
+ '<div class="col-sm-12" style="padding: 0;">'
+ '<div class="col-sm-12 clearbox">'
+ '<a class="bulk" style="float:left;">'+server_consts.deleteSelectedProduct+'</a>'
+ '<button type="button" class="btn submitOrder">'+server_consts.checkOut+'</button>'
+ '</div>' + '</div>' + '</div>'
}
$("#shoppingCartList").append(div);
submitFlag = true;
}
})
}
/*删除*/
$("#shoppingCartList").on("click",".table-condensed .del",function(){
if(submitFlag==false){
return;
}
var even = this;
var id = $(even).parent().parent().find("input[type='checkbox']").val();
$.utils.ajax({
url: "/shoppingCart/delete",
data: {ids: id},
success: function (data) {
var condensedList = $(even).parent().parent().parent().children();
var condensedIndex = condensedList.length;
$(even).parent().parent().remove();
if(condensedIndex <= 1){
if(server_consts.language == "zh_CN"){
$("#shoppingCartList").find('.orderList').html('<strong>暂未添加购物车</strong>');
}else{
$("#shoppingCartList").find('.orderList').html('<strong>No shopping cart added</strong>');
}
}
}
})
})
/*批量删除*/
$("#shoppingCartList").on("click",".clearbox .bulk",function(){
if(submitFlag==false){
return;
}
var even = this;
var data = $(this).parent().parent().parent().find("input[name='options']:checked");
var ids = [];
if(data.length<=0){
alert(server_consts.selectData);
return;
}
for ( var i=0;i<data.length;i++) {
ids.push(data[i].value)
}
$.utils.ajax({
url: "/shoppingCart/delete",
data: {ids: ids.join(",")},
success: function () {
$(data).each(function(){
var condensedList = $(even).parent().parent().parent().find('.condensedList').children();
var condensedIndex = condensedList.length;
$(this).parent().parent().remove();
if(condensedIndex <= 1){
if(server_consts.language == "zh_CN"){
$("#shoppingCartList").find('.orderList').html('<strong>暂未添加购物车</strong>');
}else{
$("#shoppingCartList").find('.orderList').html('<strong>No shopping cart added</strong>');
}
}
});
}
})
})
/*全选*/
var s = 1;
$("#shoppingCartList").on("click",".selectAll",function(){
var options = $(this).parent().parent().parent().parent().find("input[name='options']");
if(s == 1){
options.prop('checked', true);
s = 2;
}else{
options.prop('checked', false);
s = 1;
}
})
/*批量结算*/
$("#shoppingCartList").on("click",".submitOrder",function(){
if(submitFlag==false){
return;
}
var data = $(this).parent().parent().parent().parent().find("input[name='options']:checked");
var ids = [];
if(data.length<=0){
alert(server_consts.selectData);
return;
}
for ( var i=0;i<data.length;i++) {
ids.push(data[i].value)
}
$.utils.ajax({
url: "/shoppingCart/checkout",
data: {ids: ids.join(",")},
success: function (data) {
window.location.href = server_consts.root + "/order/prepareOrder?prepareOrderId="+data
},
fail: function(data){
alert(data.message);
$("#shoppingCartList").empty();
shoppingQuery();
}
})
})
/*增加*/
$("#shoppingCartList").on("click",".orderList .add",function(){
if(submitFlag==false){
return;
}
var even = this;
var id = $(this).parent().parent().find("input[type='checkbox']").val();
var inventory = $(even).siblings().find(".inventoryShow").text();
var productLimitedPurchaseAmount = parseInt($(even).siblings().find(".productLimitedPurchaseAmountShow").text());
var price = $(this).parent().parent().find('.price').text();
var priceInput = $(this).parent().find('.enteramount');
var priceInput2 = $(this).parent().find('.enteramount2');
var priceInputInt = parseInt(priceInput.val());
var totalPrices = $(this).parent().parent().find('.totalPrices');
$.utils.ajax({
url: "/shoppingCart/update",
data: {id: id , productQuantityWeb: parseInt(priceInput.val()) + 1},
success: function (data) {
data = parseInt(data);
if(productLimitedPurchaseAmount < data){
if(priceInputInt + 1 >= productLimitedPurchaseAmount){
$(even).css('color',"#ccc");
$(even).css('pointer-events',"none");
}
if(priceInputInt + 1 > 1){
$(even).parent().find('.min').css('color',"#8a8a8a");
$(even).parent().find('.min').css('pointer-events',"auto");
}
}else{
if(priceInputInt + 1 >= data){
$(even).css('color',"#ccc");
$(even).css('pointer-events',"none");
}
if(priceInputInt + 1 > 1){
$(even).parent().find('.min').css('color',"#8a8a8a");
$(even).parent().find('.min').css('pointer-events',"auto");
}
}
priceInput.val(parseInt(priceInput.val()) + 1);
priceInput2.val(parseInt(priceInput.val()));
$(even).siblings().find(".inventoryShow").text(data);
var all = accMul(price , parseInt(priceInput.val()))
totalPrices.text(all);
},
fail: function(data){
alert(data.message);
$("#shoppingCartList").empty();
shoppingQuery();
}
})
})
/*减少*/
$("#shoppingCartList").on("click",".orderList .min",function(){
if(submitFlag==false){
return;
}
var even = this;
var id = $(this).parent().parent().find("input[type='checkbox']").val();
var price = $(this).parent().parent().find('.price').text();
var priceInput = $(this).parent().find('.enteramount');
var priceInput2 = $(this).parent().find('.enteramount2');
var totalPrices = $(this).parent().parent().find('.totalPrices');
var inventory = $(even).siblings().find(".inventoryShow").text();
var productLimitedPurchaseAmount = $(even).siblings().find(".productLimitedPurchaseAmountShow").text();
$.utils.ajax({
url: "/shoppingCart/update",
data: {id: id,productQuantityWeb: parseInt(priceInput.val()-1)},
success: function (data) {
data = parseInt(data);
if (parseInt(priceInput.val()) <= 2) {
$(even).css('color',"#ccc");
$(even).css('pointer-events',"none");
}
if(productLimitedPurchaseAmount < data){
if (parseInt(priceInput.val()) >= 2 && parseInt(priceInput.val()) -1 < productLimitedPurchaseAmount) {
$(even).parent().find('.add').css('color',"#8a8a8a");
$(even).parent().find('.add').css('pointer-events',"auto");
priceInput.val(parseInt(priceInput.val()) - 1)
priceInput2.val(parseInt(priceInput.val()));
}
}else{
if (parseInt(priceInput.val()) >= 2 && parseInt(priceInput.val()) -1 < parseInt(data)) {
$(even).parent().find('.add').css('color',"#8a8a8a");
$(even).parent().find('.add').css('pointer-events',"auto");
priceInput.val(parseInt(priceInput.val()) - 1)
priceInput2.val(parseInt(priceInput.val()));
}
}
$(even).siblings().find(".inventoryShow").text(data);
$(even).parent().parent().find("input[name='inventory']").val(data);
var all = accMul(price , parseInt(priceInput.val()))
totalPrices.text(all);
},
fail: function(data){
alert(data.message);
$("#shoppingCartList").empty();
shoppingQuery();
}
})
})
var submitFlag = true;
/*监听输入框*/
$("#shoppingCartList").on("change",".orderList .enteramount",function(){
/*原始数据*/
submitFlag = false;
var even = this;
var priceInputIntBefore = $(this).parent().find('.enteramount2').val();
var priceInputInt = $(this).val();
var price = $(this).parent().parent().find('.price').text();
var totalPrices = $(this).parent().parent().find('.totalPrices');
var productLimitedPurchaseAmount = parseInt($(even).siblings().find(".productLimitedPurchaseAmountShow").text());
var add = $(this).parent().find('.add');
var min = $(this).parent().find('.min');
var id = $(this).parent().parent().find("input[type='checkbox']").val();
var r = /^\+?[0-9][0-9]*$/;
var patrn = /^([1-9]\d*|0)(\.\d*[1-9])?$/;
if(r.test(priceInputInt)==false || !patrn.exec(priceInputInt)){
$(this).val(priceInputIntBefore);
alert(server_consts.positiveInteger);
return;
}
if(parseInt(priceInputInt) < 1){
$(this).val(parseInt(priceInputIntBefore));
alert(server_consts.positiveInteger);
return;
}
$.utils.ajax({
url: "/shoppingCart/update",
data: {id: id,productQuantityWeb: parseInt(priceInputInt)},
success: function (data) {
submitFlag = true;
if(productLimitedPurchaseAmount < data){
if(parseInt(priceInputInt) == productLimitedPurchaseAmount){
add.css('color',"#ccc");
add.css('pointer-events',"none");
min.css('color',"#8a8a8a");
min.css('pointer-events',"auto");
}
if(parseInt(priceInputInt) > 1 && parseInt(priceInputInt) < productLimitedPurchaseAmount){
min.css('color',"#8a8a8a");
min.css('pointer-events',"auto");
add.css('color',"#8a8a8a");
add.css('pointer-events',"auto");
}
$(even).parent().find('.enteramount2').val(parseInt(productLimitedPurchaseAmount))
}else{
if(parseInt(priceInputInt) == parseInt(data)){
add.css('color',"#ccc");
add.css('pointer-events',"none");
min.css('color',"#8a8a8a");
min.css('pointer-events',"auto");
}
if(parseInt(priceInputInt) > 1 && parseInt(priceInputInt) < parseInt(data)){
min.css('color',"#8a8a8a");
min.css('pointer-events',"auto");
add.css('color',"#8a8a8a");
add.css('pointer-events',"auto");
}
$(even).parent().find('.enteramount2').val(parseInt(data))
}
if(parseInt(priceInputInt) == 1){
min.css('color',"#ccc");
min.css('pointer-events',"none");
add.css('color',"#8a8a8a");
add.css('pointer-events',"auto");
}
$(even).siblings().find(".inventoryShow").text(data);
var all = accMul(price , parseInt(priceInputInt))
totalPrices.text(all);
},
fail: function(data){
alert(data.message);
$("#shoppingCartList").empty();
shoppingQuery();
}
})
})
function accMul(arg1,arg2){
var m=0,s1=arg1.toString(),s2=arg2.toString();
try{m+=s1.split(".")[1].length}catch(e){}
try{m+=s2.split(".")[1].length}catch(e){}
return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m)
}
});
|
define([
'extensions/views/view'
],
function (View) {
var SectionView = View.extend({});
return SectionView;
});
|
import React, {Component} from 'react'
import {StyleSheet, Text, View,Button} from 'react-native';
class Images extends React.Component{
render(){
return (
<View>
<Image
source={require('/react-native/img/favicon.png')}
/>
<Image
style={{width: 50, height: 50}}
source={{uri: 'https://facebook.github.io/react-native/docs/assets/favicon.png'}}
/>
<Image
style={{width: 66, height: 58}}
source={{uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAEXRFWHRTb2Z0d2FyZQBwbmdjcnVzaEB1SfMAAABQSURBVGje7dSxCQBACARB+2/ab8BEeQNhFi6WSYzYLYudDQYGBgYGBgYGBgYGBgYGBgZmcvDqYGBgmhivGQYGBgYGBgYGBgYGBgYGBgbmQw+P/eMrC5UTVAAAAABJRU5ErkJggg=='}}
/>
</View>
);
}
}
export default Images; |
/*
On each page we have a filter. The filter contains tags.
Treat this as a component.
Actions:
get filter values
add to filter
remove from filter
get next - ajax call
get previous - ajax call
get pages - ajax call (paginated)
*/
if (typeof Filter === "undefined") {
var Filter = {
properties: {
filterSelector: ".filter"
},
createItem: function(value) {
return '<a class="tag" onclick="Filter.toggle(this);">' + value + '</a>'
},
getValue: function(item) {
return $(item).text().trim();
},
getValues: function () {
var filter = [];
$(properties.filterSelector + " *").each(function (index, item) {
filter.push(getValue(item));
})
return filter;
},
contains: function(value) {
return getValues().indexOf(value) != -1;
},
toggle: function(element) {
var value = getValue(element);
var filter = getFilterValues();
if (contains(value)) {
$(properties.filterSelector + " *:contains(" + value + ")").remove();
} else {
$(properties.filterSelector).append(createItem(value));
}
},
getNext: function() {
},
getPrevious: function() {
},
getPages: function(start, count) {
var tags = getFilterValues();
console.log(tags);
var data = {
'tag': tags
};
console.log(data);
$.ajax({
traditional: true,
url: "filter",
data: data,
dataType : "json",
success: function (data) {
console.log(data);
}
});
}
}
}
function loadNext(filterType, tags) {
$.ajax({
url: "filterNext",
data: {
'id': window.location.pathname,
'filterType': "or",
'tag': getFilter()
},
dataType: "json",
context: $(".next"),
success: function(result) {
console.log(result);
}
}).done(function() {
$(this).title()
});
}
function getFilter() {
}
$(document).ready(function() {
fixTagWidths(50);
/*$(window).resize(resizeLogo);
resizeLogo();*/
}); |
import React, { Component } from "react";
import Cart from "../components/Orders/Cart";
import { connect } from "react-redux";
import * as actions from "../store/actions/index";
class CartContainer extends Component {
proceed = () => {
this.props.history.push("/checkout");
};
render() {
return (
<Cart
cartItems={this.props.items}
removeItem={this.props.onRemoveItem}
proceed={this.proceed}
/>
);
}
}
const mapStateToProps = (state) => {
return {
items: state.cartState.items,
cartLength: state.cartState.cartLength,
};
};
const mapDispatchToProps = (dispatch) => {
return {
onRemoveItem: (item) => dispatch(actions.removeFromCart(item)),
};
};
export default connect(mapStateToProps, mapDispatchToProps)(CartContainer);
|
// Inputs du formulaire
var radioSalle1 = document.getElementById("1");
var radioSalle2 = document.getElementById("2");
var radioSalle3 = document.getElementById("3");
var radioSalle4 = document.getElementById("4");
var radioSalle5 = document.getElementById("5");
var radioSalle6 = document.getElementById("6");
var radioSalle7 = document.getElementById("7");
var radioSalle8 = document.getElementById("8");
var radioSalle9 = document.getElementById("9");
var radioSalle10 = document.getElementById("10");
var service = document.getElementById("textService");
var date = document.getElementById("date");
var intitule = document.getElementById("intitule");
var nbPers = document.getElementById("nbpers");
var radioFormation = document.getElementById("radioFormation");
var radioReunion = document.getElementById("radioReunion");
var textDemandeur = document.getElementById("textDemandeur");
var textIntervenant = document.getElementById("textIntervenant");
var radioOuiEcran = document.getElementById("ouiEcran");
var radioNonEcran = document.getElementById("nonEcran");
var textAnnonce = document.getElementById("inputAnnonce");
var heureDebut = document.getElementById("heureDebut");
var heureFin = document.getElementById("heureFin");
var CbElu = document.getElementById("elu");
var CbExt = document.getElementById("ext");
var CbPerso = document.getElementById("perso");
var CbCafe = document.getElementById("cafe");
var CbTea = document.getElementById("tea");
var CbEau = document.getElementById("eau");
var CbBuffet = document.getElementById("buffetPresta");
var CbRien = document.getElementById("rien");
var cbConf = document.getElementById("conference");
var cbCarre = document.getElementById("carre");
var cbRonde = document.getElementById("ronde");
var cbBuffetDispo = document.getElementById("buffetDispo");
var cbAutre = document.getElementById("autre");
var textAutre = document.getElementById("autreText");
var cbPC = document.getElementById("pc");
var cbAutreMateriel = document.getElementById('autreMateriel');
var nbOrdis = document.getElementById("nbordis");
var radioOuiInternet = document.getElementById("ouiInternet");
var radioNonInternet = document.getElementById("nonInternet");
var CH_salle = document.getElementById("CHsalle");
var CB_salle = document.getElementById("CBsalle");
var CH_participant = document.getElementById("CHparticipant");
var CB_participant = document.getElementById("CBparticipant");
var CH_logistique = document.getElementById("CHlogistique");
var CB_logistique = document.getElementById("CBlogistique");
var CH_presta = document.getElementById("CHpresta");
var CB_presta = document.getElementById("CBpresta");
var btnSubmit = document.getElementById("btnForm");
var textAutreMateriel = document.getElementById('textAutreMateriel');
// Fonctions
function InputAnnonce() {
// Affiche une zone de texte pour rentre une annonce si le bouton est coché
if (radioOuiEcran.checked) {
textAnnonce.disabled = false;
} else {
textAnnonce.value = "";
textAnnonce.disabled = true;
}
}
function Confirm() {
// Fonction qui fait un pop avant de soumettre ou de réinitialiser le formulaire
var popUpConfirm = confirm("Voulez-vous continuer ?");
if (popUpConfirm == true) {
document.forms[0].submit();
btnSubmit.class = "btn btn-success";
btnSubmit.value = "Envoyer le formulaire";
} else {
}
}
function HideOthers() {
if (CbRien.checked) {
CbCafe.disabled = true;
CbTea.disabled = true;
CbEau.disabled = true;
CbBuffet.disabled = true;
CbCafe.checked = false;
CbTea.checked = false;
CbEau.checked = false;
CbBuffet.checked = false;
} else {
CbCafe.disabled = false;
CbTea.disabled = false;
CbEau.disabled = false;
CbBuffet.disabled = false;
}
if (CbCafe.checked || CbEau.checked || CbTea.checked || CbBuffet.checked) {
CbRien.checked = false;
CbRien.disabled = false;
}
}
function EnableCheckPresta() {
if (CbElu.checked || (CbExt.checked && nbPers.value >= 20)) {
CbRien.checked = false;
CbRien.disabled = false;
CbCafe.disabled = false;
CbTea.disabled = false;
CbEau.disabled = false;
CbBuffet.disabled = false;
} else {
CbRien.disabled = false;
CbCafe.disabled = true;
CbTea.disabled = true;
CbEau.disabled = true;
CbBuffet.disabled = true;
CbCafe.checked = false;
CbTea.checked = false;
CbEau.checked = false;
CbBuffet.checked = false;
}
}
function EnableTextAutreDisposition() {
// Fait apparaître une zone de texte pour que l'utilisateur entre son autre disposition
if (cbAutre.checked) {
textAutre.disabled = 0;
} else {
textAutre.value = "";
textAutre.disabled = 1;
}
}
function detailsMateriels() {
// Fait apparaitres des champs spécifiques à l'ordinateur lorsque celui ci est coché
if (cbPC.checked) {
nbOrdis.disabled = 0;
radioOuiInternet.disabled = false;
radioNonInternet.disabled = false;
} else {
nbOrdis.value = "";
nbOrdis.disabled = 1;
radioOuiInternet.checked = false;
radioNonInternet.checked = false;
radioOuiInternet.disabled = true;
radioNonInternet.disabled = true;
}
}
function nouveauMateriel() {
// fait apparaitre la zone de texte lorsque l'utilisateur souhaite entrer un nouveau matériel
if (cbAutreMateriel.checked) {
textAutreMateriel.disabled=false;
} else {
textAutreMateriel.value= "";
textAutreMateriel.disabled=true;
}
}
function Affiche() {
var d1 = new Date("01/01/2019 12:30:00");
var d2 = new Date("01/01/2019 " + heureDebut.value + ":00");
// Fonction qui permet l'affichage progressif du formulaire afin de simplifier son utilisation et éviter des erreurs
if (radioReunion.checked || radioFormation.checked) {
// les inputs radio/checkbox et les inputs text/number sont séparés --> Sinon valeur de vérité alterée
if (
service.value != "" &&
textIntervenant.value != "" &&
textDemandeur.value != "" &&
nbPers != "" &&
intitule.value != "" &&
heureDebut.value != "" &&
heureFin.value != ""
) {
CH_salle.hidden = false;
CB_salle.hidden = false;
if (
radioSalle1.checked ||
radioSalle2.checked ||
radioSalle3.checked ||
radioSalle4.checked ||
radioSalle5.checked ||
radioSalle6.checked ||
radioSalle7.checked ||
radioSalle8.checked ||
radioSalle9.checked ||
radioSalle10.checked
) {
CH_participant.hidden = false;
CB_participant.hidden = false;
if (CbElu.checked || CbExt.checked) {
if (radioNonEcran.checked) {
CH_logistique.hidden = false;
CB_logistique.hidden = false;
if (
cbConf.checked ||
cbCarre.checked ||
cbRonde.checked ||
cbBuffetDispo.checked
) {
// Les prestations sont accessibles pour les élus et les participants extérieurs à n'importe quelle heure de la journée
CH_presta.hidden = false;
CB_presta.hidden = false;
if (
CbCafe.checked ||
CbTea.checked ||
CbEau.checked ||
CbBuffet.checked ||
CbRien.checked
) {
// Prestations(s) choisie(s), fin du formulaire
btnSubmit.onclick = Confirm();
}
}
if (cbAutre.checked && textAutre.value != "") {
// Les prestations sont accessibles pour les élus et les participants extérieurs à n'importe quelle heure de la journée
CH_presta.hidden = false;
CB_presta.hidden = false;
if (
CbCafe.checked ||
CbTea.checked ||
CbEau.checked ||
CbBuffet.checked ||
CbRien.checked
) {
// Prestations(s) choisie(s), fin du formulaire
btnSubmit.onclick = Confirm();
}
}
}
if (radioOuiEcran.checked && textAnnonce.value != "") {
CH_logistique.hidden = false;
CB_logistique.hidden = false;
if (
cbConf.checked ||
cbCarre.checked ||
cbRonde.checked ||
cbBuffetDispo.checked
) {
// Les prestations sont accessibles pour les élus et les participants extérieurs à n'importe quelle heure de la journée
CH_presta.hidden = false;
CB_presta.hidden = false;
if (
CbCafe.checked ||
CbTea.checked ||
CbEau.checked ||
CbBuffet.checked ||
CbRien.checked
) {
// Prestations(s) choisie(s), fin du formulaire
btnSubmit.onclick = Confirm();
} else {
// L'utilisateur n'a pas accès aux prestations, c'est la fin du formulaire
btnSubmit.onclick = Confirm();
}
}
if (cbAutre.checked && textAutre.value != "") {
// Les prestations sont accessibles pour les élus et les participants extérieurs à n'importe quelle heure de la journée
CH_presta.hidden = false;
CB_presta.hidden = false;
if (
CbCafe.checked ||
CbTea.checked ||
CbEau.checked ||
CbBuffet.checked ||
CbRien.checked
) {
// Prestations(s) choisie(s), fin du formulaire
btnSubmit.onclick = Confirm();
} else {
// L'utilisateur n'a pas accès aux prestations, c'est la fin du formulaire
btnSubmit.onclick = Confirm();
}
}
}
}
if (CbPerso.checked) {
if (radioNonEcran.checked) {
CH_logistique.hidden = false;
CB_logistique.hidden = false;
if (
cbConf.checked ||
cbCarre.checked ||
cbRonde.checked ||
cbBuffetDispo.checked
) {
if (nbPers.value >= 20 && d1.getTime() > d2.getTime()) {
// Si il y a plus de 20 participants venant du personnel et que c'est le matin, on affiche les prestas
// Le premier janvier ne signifie rien, il est là que pour la comparaison utilisant la classe "Date"
CH_presta.hidden = false;
CB_presta.hidden = false;
if (
CbCafe.checked ||
CbTea.checked ||
CbEau.checked ||
CbBuffet.checked ||
CbRien.checked
) {
// Prestations(s) choisie(s), fin du formulaire
btnSubmit.onclick = Confirm();
} else {
// L'utilisateur n'a pas accès aux prestations, c'est la fin du formulaire
btnSubmit.onclick = Confirm();
}
} else {
// L'utilisateur n'a pas accès aux prestations, c'est la fin du formulaire
btnSubmit.onclick = Confirm();
}
}
if (cbAutre.checked && textAutre.value != "") {
if (nbPers.value >= 20 && d1.getTime() > d2.getTime()) {
// Si il y a plus de 20 participants venant du personnel et que c'est le matin, on affiche les prestas
// Le premier janvier ne signifie rien, il est là que pour la comparaison utilisant la classe "Date"
CH_presta.hidden = false;
CB_presta.hidden = false;
if (
CbCafe.checked ||
CbTea.checked ||
CbEau.checked ||
CbBuffet.checked ||
CbRien.checked
) {
// Prestations(s) choisie(s), fin du formulaire
btnSubmit.onclick = Confirm();
}
} else {
// L'utilisateur n'a pas accès aux prestations, c'est la fin du formulaire
btnSubmit.onclick = Confirm();
}
}
}
if (radioOuiEcran.checked && textAnnonce.value != "") {
CH_logistique.hidden = false;
CB_logistique.hidden = false;
if (
cbConf.checked ||
cbCarre.checked ||
cbRonde.checked ||
cbBuffetDispo.checked
) {
if (nbPers.value >= 20 && d1.getTime() > d2.getTime()) {
// Si il y a plus de 20 participants venant du personnel et que c'est le matin, on affiche les prestas
// Le premier janvier ne signifie rien, il est là que pour la comparaison utilisant la classe "Date"
CH_presta.hidden = false;
CB_presta.hidden = false;
if (
CbCafe.checked ||
CbTea.checked ||
CbEau.checked ||
CbBuffet.checked ||
CbRien.checked
) {
// Prestations(s) choisie(s), fin du formulaire
btnSubmit.onclick = Confirm();
}
} else {
// L'utilisateur n'a pas accès aux prestations, c'est la fin du formulaire
btnSubmit.onclick = Confirm();
}
}
if (cbAutre.checked && textAutre.value != "") {
if (nbPers.value >= 20 && d1.getTime() > d2.getTime()) {
// Si il y a plus de 20 participants venant du personnel et que c'est le matin, on affiche les prestas
// Le premier janvier ne signifie rien, il est là que pour la comparaison utilisant la classe "Date"
CH_presta.hidden = false;
CB_presta.hidden = false;
if (
CbCafe.checked ||
CbTea.checked ||
CbEau.checked ||
CbBuffet.checked ||
CbRien.checked
) {
// Prestations(s) choisie(s), fin du formulaire
btnSubmit.onclick = Confirm();
}
} else {
// L'utilisateur n'a pas accès aux prestations, c'est la fin du formulaire
btnSubmit.onclick = Confirm();
}
}
}
}
}
}
}
}
|
const divisas = require('./divisas.json');
const express = require('express');
const app = express();
app.use(express.json());
app.get('/', function (request, response) {
response.end('Hello BEDU');
});
app.get('/divisas', function (request, response) {
const catalogo = divisas.map(divisa => divisa.moneda);
response.json(catalogo);
});
console.log(divisas)
app.get('/divisas/:moneda', function (request, response) {
const { moneda } = request.params;
const valores = divisas.filter(divisa => divisa.moneda == moneda);
if (valores.length) {
response.json(valores[0].tipoCambio);
} else {
response.send('No existe esa moneda');
}
});
app.get('/divisas/:monedaA/:monedaB', function (request, response) {
const { monedaA, monedaB } = request.params;
const valores = divisas.filter(divisa => divisa.moneda == monedaA);
if (valores.length) {
const cambio = valores[0].tipoCambio.filter(divisa => divisa.moneda == monedaB);
if (cambio.length) {
response.send(`1 ${monedaA} vale ${cambio[0].valor}`);
} else {
response.send(`No existe el cambio de ${monedaA} a ${monedaB}`);
}
} else {
response.send(`No existe el cambio de ${monedaA}`);
}
});
app.listen(8080, function () {
console.log('> Servidor escuchando el puerto 8080');
}); |
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var cors = require('cors');
var methodOverride = require('method-override');
var database = require('./config/database');
var auth = require('.//controllers/authCtrl');
var routerAuth = require('./routes/auth');
var routers = require('./routes');
var app = express();
var db = database();
// var apiCors = {
// origin : 'http://localhost:4001',
// allowedHeaders : ['Origin', 'X-Requested-With', 'Content-Type', 'Accept'],
// credentials : true,
// preflightContinue : true
// };
// var authCors = {
// origin : 'http://localhost:4001',
// allowedHeaders : ['Origin', 'X-Requested-With', 'Content-Type', 'Accept']
// };
app.disable('x-powered-by');
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(methodOverride());
// app.options('*', cors({
// origin : 'http://localhost:4001',
// methods: "GET,HEAD,PUT,PATCH,POST,DELETE",
// preflightContinue: false
// }));
// app.post('/signIn', cors(authCors), routerAuth);
// app.use('/api', cors(apiCors), routers);
app.post('/signIn', routerAuth);
app.use('/api', routers);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
res.status(err.status || 500);
res.json({'error' : res.locals.message});
});
module.exports = app;
|
"use strict";
require([__dirname + "/../low.js", __dirname + "/tools.js"], function (low, tools)
{
exports.Box = function Box()
{
var m_item = $(
low.tag("div")
.html()
);
this.get = function ()
{
return m_item;
};
this.add = function (child)
{
m_item.append(child.get());
};
tools.initAs(this, tools.VISUAL);
};
});
|
function mapToObject (map) {
let obj = {};
for (let [k, v] of map) {
if (v instanceof Map) {
obj[k] = mapToObject(v);
} else {
obj[k] = v;
}
}
return obj;
};
export { mapToObject };
|
class Response {
constructor() {
this.cookies = {};
}
cookie(name, payload) {
this.cookies[name] = payload;
}
clearCookie(name) {
delete this.cookies[name];
}
}
module.exports = Response;
|
let express = require('express');
let router = express.Router();
let Users = require('../models').User;
let middleware = require('../auth/middleware');
/* path /auth/ */
/**
* @swagger
* /auth/login:
* post:
* summary: User authentication
* description: 'to log in the user. NOTICE that cookies must be accepted and stored.'
* tags:
* - Authorizaion
* produces:
* - application/json
* requestBody:
* description: User credentials
* required: true
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/UserCredentials'
* responses:
* 200:
* description: Successfully logged in
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/UserWithoutPassword'
* 400:
* description: Invalid required parameters
* 401:
* description: Request accepted, but these credentials are invalid
* 500:
* description: Server fails on some operation, try later
*/
router.post('/login', (req, res) => {
const login = req.body.login;
const password = req.body.password;
if (!login || !password || login.length > 16 || password.length > 32) {
return res.status(400).send({ message: 'Parameters validation failed' });
}
Users.findOne({ where: { login: login }})
.then(async user => {
if (!!user && await middleware.validateUser(user, password)) {
let proxy_user = JSON.parse(JSON.stringify(user));
proxy_user.password = undefined; // remove password's hash from the response
req.session.user = proxy_user;
res.json(proxy_user);
} else {
res.status(400).send({ message: 'Login or Password is incorrect'});
}
})
.catch(err => {
console.error(err);
res.status(500).send();
});
});
/**
* @swagger
* /auth/logout:
* get:
* summary: Log out user
* description: to log out the user
* tags:
* - Authorizaion
* security:
* - BearerAuth:
* - token
* - OAuth2:
* - default
* produces:
* - application/json
* responses:
* 200:
* description: Successfully logged out
* 401:
* description: Unauthorized
*/
router.get('/logout', middleware.allowFor('default'), (req, res) => {
if (req.session.user) {
req.session.destroy();
res.clearCookie('user_sid');
res.status(200).send({ message: 'logged out successfully' })
} else {
res.status(401).send();
}
});
/**
* @swagger
* /auth/me:
* get:
* summary: Returns currently logged in user's information
* description: Current user information
* tags:
* - Authorizaion
* security:
* - BearerAuth:
* - token
* - OAuth2:
* - user
* produces:
* - application/json
* responses:
* 200:
* description: Successfully logged out
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/UserWithoutPassword'
* 401:
* description: Unauthorized
*/
router.get('/me', middleware.allowFor('user'), (req, res) => {
res.status(200).send(req.session.user);
});
module.exports = router;
|
(function () {
var app = angular.module('myApp');
app.controller('CustomersController', ['$scope','CustomersService', function ($scope,customersService) {
$scope.customers = customersService.getCustomers();
}]);
})(); |
import { MapLayer } from "react-leaflet";
import L from "leaflet";
import "leaflet-routing-machine";
import { withLeaflet } from "react-leaflet";
import React from 'react';
class Routing extends MapLayer {
constructor(props) {
super(props);
}
createLeafletElement() {
//console.log("ele-leaf create");
const { map ,pointM} = this.props;
//console.log(pointM);
//console.log(this.props.pointM);
let leafletElement = L.Routing.control({
waypoints: this.props.pointM,show:true
}).addTo(map.leafletElement);
this.routing = leafletElement;
return leafletElement.getPlan();
}
updateLeafletElement(fromProps, toProps) {
//console.log('leafletUPDATE')
//console.log(fromProps)
//console.log(toProps)
if(fromProps.pointM != toProps.pointM && (toProps.routingFlag == false)){
const { map ,pointM,routing} = toProps;
function generatePermutations(Arr){
var permutations = [];
var A = Arr.slice();
function swap(a,b){
var tmp = A[a];
A[a] = A[b];
A[b] = tmp;
}
function generate(n, A){
if (n == 1){
permutations.push(A.slice());
} else {
for(var i = 0; i <= n-1; i++) {
generate(n-1, A);
swap(n % 2 == 0 ? i : 0 ,n-1);
}
}
}
generate(A.length, A);
return permutations;
}
var Points =[];
toProps.pointM.forEach(e=>{
Points.push([e.lat,e.lng]);
});
var x = generatePermutations(Points);
var l = [];
if(x.length <2){
//console.log("no dist");
//console.log(this.routing);
this.routing.setWaypoints([]);
}
else{
var myLocation = [toProps.pointM[0].lat,toProps.pointM[0].lng]
const Undef = 1000000;
x.forEach(e=>{
if(e[0][0] == myLocation[0] && e[0][1] == myLocation[1])
{
var sum=0;
for(var i=0; i < e.length-1 ; i++){
sum+=distance(e[i][0], e[i][1], e[i+1][0], e[i+1][1], 'K');
}
l.push(sum);
}else{
l.push(Undef)
}
});
var route = l.indexOf(Math.min.apply(null,l));
this.routing.setWaypoints(x[route]);
//console.log(x[route]);
}
function distance(lat1, lon1, lat2, lon2, unit) {
var radlat1 = Math.PI * lat1/180
var radlat2 = Math.PI * lat2/180
var radlon1 = Math.PI * lon1/180
var radlon2 = Math.PI * lon2/180
var theta = lon1-lon2
var radtheta = Math.PI * theta/180
var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);
dist = Math.acos(dist)
dist = dist * 180/Math.PI
dist = dist * 60 * 1.1515
if (unit=="K") { dist = dist * 1.609344 }
if (unit=="N") { dist = dist * 0.8684 }
return dist
}
}
}
componentDidMount() {
super.componentDidMount()
//console.log("update")
}
}
export default withLeaflet(Routing);
// this.routing = null;
// const { markers } = this.state.markers;
//console.log(markers);
/* let leafletElement = L.Routing.control({
waypoints: [L.latLng(31.0461, 34.8516), L.latLng(31.046331, 34.8533416), L.latLng(32.046331, 33.8533416)]
}).addTo(map.leafletElement);*/
// console.log('shawarma')
//console.log(this.props.pointM)
//console.log('e' + e )
//console.log('lat ' + e[0].lat)
//console.log('lng ' + e[0].lng)
//console.log(Points);
// let leafletElement = L.Routing.control({
// waypoints: []
// }).addTo(map.leafletElement);
// this.routing = leafletElement;
// return leafletElement.getPlan();
// console.log(l);
// // console.log(Math.min.apply(null,l));
// console.log(x[route])
// return(x[route]);
// let leafletElement = L.Routing.control({
// waypoints: x[route]
// }).addTo(map.leafletElement);
// this.routing = leafletElement;
// return leafletElement.getPlan();
/*
shouldComponentUpdate(nextProps, nextState) {
//console.log("State")
//console.log(nextProps);
return true;
//return (nextProps.routingFlag == false);
}
componentWillUnmount() {
console.log("unmount");
if (this.props.map) {
this.props.map.leafletElement.removeControl(this.routing);
//L.DomEvent.off(this.props.map.leafletElement, 'click', this.createPopupsHandler);
}
}
componentDidUpdate({ markers }) {
const { map ,pointM,routing} = this.props;
//console.log("###");
//console.log(this.routing==null);
// if (this.routing != null) {
// // this.props.map.leafletElement
// this.props.map.leafletElement.removeControl(this.routing);
// this.routing = null;
// //L.DomEvent.off(this.props.map.leafletElement, 'click', this.createPopupsHandler);
// }
//console.log("update2")
//console.log(this.routing);
//
//console.log(pointM);
//console.log(this.props.pointM);
function generatePermutations(Arr){
var permutations = [];
var A = Arr.slice();
function swap(a,b){
var tmp = A[a];
A[a] = A[b];
A[b] = tmp;
}
function generate(n, A){
if (n == 1){
permutations.push(A.slice());
} else {
for(var i = 0; i <= n-1; i++) {
generate(n-1, A);
swap(n % 2 == 0 ? i : 0 ,n-1);
}
}
}
generate(A.length, A);
return permutations;
}
console.log('shawarma')
//console.log(this.props.pointM)
var Points =[];
this.props.pointM.forEach(e=>{
//console.log('e' + e )
//console.log('lat ' + e[0].lat)
//console.log('lng ' + e[0].lng)
Points.push([e.lat,e.lng]);
});
//console.log(Points);
var x = generatePermutations(Points);
var l = [];
if(x.length <2){
console.log("no dist");
console.log(this.routing);
this.routing.setWaypoints([]);
// let leafletElement = L.Routing.control({
// waypoints: []
// }).addTo(map.leafletElement);
// this.routing = leafletElement;
// return leafletElement.getPlan();
}
else{
var myLocation = [this.props.pointM[0].lat,this.props.pointM[0].lng]
const Undef = 1000000;
x.forEach(e=>{
if(e[0][0] == myLocation[0] && e[0][1] == myLocation[1])
{
var sum=0;
for(var i=0; i < e.length-1 ; i++){
sum+=distance(e[i][0], e[i][1], e[i+1][0], e[i+1][1], 'K');
}
l.push(sum);
}else{
l.push(Undef)
}
});
// console.log(l);
// // console.log(Math.min.apply(null,l));
var route = l.indexOf(Math.min.apply(null,l));
// console.log(x[route])
// return(x[route]);
this.routing.setWaypoints(x[route]);
console.log(x[route]);
// let leafletElement = L.Routing.control({
// waypoints: x[route]
// }).addTo(map.leafletElement);
// this.routing = leafletElement;
// return leafletElement.getPlan();
}
function distance(lat1, lon1, lat2, lon2, unit) {
var radlat1 = Math.PI * lat1/180
var radlat2 = Math.PI * lat2/180
var radlon1 = Math.PI * lon1/180
var radlon2 = Math.PI * lon2/180
var theta = lon1-lon2
var radtheta = Math.PI * theta/180
var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);
dist = Math.acos(dist)
dist = dist * 180/Math.PI
dist = dist * 60 * 1.1515
if (unit=="K") { dist = dist * 1.609344 }
if (unit=="N") { dist = dist * 0.8684 }
return dist
}
}
render(){
return <div></div>;
}*/
//console.log("###");
//console.log(this.routing==null);
// if (this.routing != null) {
// // this.props.map.leafletElement
// this.props.map.leafletElement.removeControl(this.routing);
// this.routing = null;
// //L.DomEvent.off(this.props.map.leafletElement, 'click', this.createPopupsHandler);
// }
//console.log("update2")
//console.log(this.routing);
//
//console.log(pointM);
//console.log(this.props.pointM);
|
var musicVolume = 0.5;
var soundVolume = 0.5;
(function(){
try {
if(localStorage.getItem("musicVolume") != null) {
musicVolume = parseFloat(localStorage.getItem("musicVolume"));
soundVolume = parseFloat(localStorage.getItem("soundVolume"));
}
} catch (error) {
console.error("Can't find savedSound", error);
}
})();
var keyCodes = {
"w": 87,
"s": 83,
"a": 65,
"d": 68,
"q": 81,
"e": 69,
"r": 82,
"f": 70,
"space": 32,
"enter": 13,
"lctrl": 17,
"lalt": 18,
"lshift": 16
}
var ship = null;
var shipPNG = null;
var meteorites = [];
var bullets = [];
var bulletsShot = 0;
var bulletHits = 0;
var invaders = [];
var invaderPNG = null;
var invaderBullets = [];
var bonusItems = [];
var collectedbonusItems = 0;
var collectedbonusStars = 0;
var backgroundImage = null;
var score = 0;
var damage = 0;
var bonusFromTime = 0.0;
var bonusFromAccuaracy = 0.0;
var gameMode = "classic";
var gameOver = false;
var timer = 0;
var startTime = getTime();
function getTime() {
var currentDate = new Date();
return currentDate.getTime();
}
var shipColor = sessionStorage.getItem("shipColor") || "blue";
var shipModel = sessionStorage.getItem("shipModel") || "./assets/art/PNG/playerShip1_";
var name = sessionStorage.getItem("name");
var shipImage = shipModel + shipColor + ".png";
function preload() {
/**
* Load Assets: images, sounds, gifs
*/
shipPNG = loadImage(shipImage);
shipShieldActivePNG = loadImage("./assets/art/PNG/Effects/shield1.png");
shipDistroyedPNG = loadImage("./assets/art/PNG/Damage/playerShip1_damage3.png");
laserPNG = loadImage("./assets/art/PNG/Lasers/laser_" + shipColor + "02.png");
invaderPNG = loadImage("./assets/art/PNG/Enemies/enemyBlue2.png");
stars2PNG = loadImage("./assets/stars2.jpg");
starPNG = loadImage("./assets/art/PNG/Power-ups/star_gold.png");
shieldPNG = loadImage("./assets/art/PNG/Power-ups/shield_silver.png");
meteorPNG = loadImage("./assets/art/PNG/Meteors/meteorBrown_big2.png");
spaceFont = loadFont('./assets/art/Bonus/kenvector_future.ttf');
spaceFontThin = loadFont('./assets/art/Bonus/kenvector_future_thin.ttf');
explosionGIF = loadImage("./assets/effects/explosion.gif");
soundFormats('mp3', 'ogg');
explosionSound = loadSound('./assets/sounds/explosion.mp3');
explosionSound.setVolume(soundVolume - 0.2);
laserSound2 = loadSound('./assets/art/Bonus/sfx_laser1.ogg');
laserSound2.setVolume(soundVolume);
collectedSound = loadSound('./assets/art/Bonus/sfx_twoTone.ogg');
collectedSound.setVolume(soundVolume);
shieldUpSound = loadSound('./assets/art/Bonus/sfx_shieldUp.ogg');
shieldUpSound.setVolume(soundVolume);
shieldDownSound = loadSound('./assets/art/Bonus/sfx_shieldDown.ogg');
shieldDownSound.setVolume(soundVolume);
music = loadSound('./assets/sounds/music.mp3');
music.setVolume(musicVolume);
imageY = displayHeight / 2;
}
function setup() {
imageMode(CENTER);
createCanvas(windowWidth, windowHeight);
music.play();
ship = new Ship();
for(let i = 0; i < Math.round((displayWidth / ship.shipWidth) / 2); i++) {
invaders.push(new Invader(i * 175 + 80, 63, random(0, 100)));
invaders.push(new Invader(i * 175 + 80, 60 * 3, random(0, 100)));
if(i % 5 == 0) {
meteorites.push(new Meteor(random(0, width), 100) );
}
}
//EVENTS
var playerWinEvent = new Event("playerWin");
window.addEventListener("playerWin", function(event) {
score = score + bonusFromTime + bonusFromAccuaracy;
setTimeout(noLoop, 200);
}, false);
}
function draw() {
//background
image(stars2PNG, displayWidth / 2, imageY);
imageY += 0.5;
if(imageY > stars2PNG.height / 2) {
imageY = displayHeight / 2;
}
//Star from the menu
image(starPNG, 30, 30);
/**
* Show the score info
* on top left of the screen
*/
textFont(spaceFontThin);
textSize(16);
fill(255);
text(name + "'s Score: " + score, 100, 40);
text(collectedbonusStars, 50, 50);
text("damage: " + damage, 10, height - 30);
/**
* Appplying the show method from the ship class
* will allow the ship to be displayed on canvas
*/
ship.show();
ship.move();
timer++;
for(let meteor of meteorites) {
meteor.show();
meteor.fall();
meteor.wiggle();
if(meteor.hits(ship)) {
damage += 10;
}
if(meteor.y > height) {
meteor.y = 0;
}
if(timer > 100000) {
timer = 0;
}
}
for(let item of bonusItems) {
item.show();
item.move();
if(item.collected(ship)) {
if(item.name == "star") {
collectedbonusStars++;
} else if(item.name == "shield") {
ship.activateShield();
collectedbonusItems++;
} else {
collectedbonusItems++;
}
item.removeIt();
}
//item missed or not collected
if(item.y > height) {
item.removeIt();
}
}
//Activate Ship Shield
if(ship.shieldActive == true && ship.shield > 0) {
imageMode(CENTER);
image(shipShieldActivePNG, ship.x, ship.y);
}
/**
* Shooting bullets whenever the user is
* pressing the spacebar
*/
for(let b = 0; b < bullets.length; b++) {
bullets[b].show();
bullets[b].move();
/**
* Bullets hits invaders and kills them
*/
for(let i = 0; i < invaders.length; i++) {
if(bullets[b].hits(invaders[i])) {
bullets[b].removeIt();
invaders[i].removeIt();
invaders[i].explode();
if(invaders[i].dropRate > 50.00) {
bonusItems.push( new Bonus(invaders[i].x, invaders[i].y, "star", starPNG) );
}
score++;
bulletHits++;
}
}
/**
* Bullets hits meteorites and destroy them
*/
for(let i = 0; i < meteorites.length; i++) {
if(bullets[b].hits(meteorites[i])) {
bullets[b].removeIt();
meteorites[i].shield--;
if(meteorites[i].shield <= 0) {
meteorites[i].removeIt();
meteorites[i].explode();
if(parseInt(meteorites[i].dropRate) % 3 == 0) {
bonusItems.push( new Bonus(meteorites[i].x, meteorites[i].y, "shield", shieldPNG) );
}
score += 100;
bulletHits++;
}
}
}
}
for(let b = bullets.length - 1; b >= 0; b--) {
if(bullets[b].toRemove) {
bullets.splice(b, 1);
}
}
for(let m = meteorites.length - 1; m >= 0; m--) {
if(meteorites[m].toRemove) {
meteorites.splice(m, 1);
}
}
for(let b = invaderBullets.length - 1; b >= 0; b-- ) {
if(invaderBullets[b].toRemove) {
invaderBullets.splice(b, 1);
if(ship.shieldActive == true && ship.shield > 0) {
ship.shield--;
} else {
damage += 150;
}
}
}
for(let i = invaders.length - 1; i >= 0; i--) {
if(invaders[i].toRemove) {
invaders.splice(i, 1);
}
}
/**
* Remove the Bonus Stars if the status is set to remove
* This should happen when the stars are collected by ship
*/
for(let s = bonusItems.length - 1; s >= 0; s--) {
if(bonusItems[s].toRemove) {
bonusItems.splice(s, 1);
}
}
for(let i = 0; i < invaders.length; i++) {
if(ship.hits(invaders[i])) {
damage++;
}
}
if(damage >= 450) {
/**
* Game Over
*/
invaders = [];
image(stars2PNG, displayWidth/2, displayHeight/2);
var damagedShip = new DamagedShip(ship.x, ship.y);
damagedShip.show();
//Stop the draw function
noLoop();
}
if(invaders.length < 1) {
if(bonusItems.length < 1) {
//Player wins!
var endTime = getTime();
/**
* bonusFromTime in Minutes * 10
* 1 millisecond = 0.0000166667;
*
* bonusFromTime adds to score
* should be less if the
* time to clear the level is bigger
*
* bonusFromAccuaracy adds to score
* should be bigger if the accuaracy
* is closer to 0
*/
var timeDiff = ((endTime - startTime) * 0.0000166667).toFixed(2);
bonusFromTime = Math.round((1 / timeDiff) * 100);
var accuaracy = bulletsShot / bulletHits;
bonusFromAccuaracy = Math.round((1 / accuaracy) * 1000);
window.dispatchEvent(new CustomEvent("playerWin"));
}
}
/**
* Show the invaders on the canvas
*/
var edge = false;
for(let i = 0; i < invaders.length; i++) {
invaders[i].show();
invaders[i].move();
if(invaders[i].x > width || invaders[i].x < 0) {
edge = true;
}
}
for(let b = 0; b < invaderBullets.length; b++) {
invaderBullets[b].show();
invaderBullets[b].attack();
if(invaderBullets[b].hits(ship)) {
invaderBullets[b].removeIt();
}
}
if(edge) {
for(let i = 0; i < invaders.length; i++) {
invaders[i].shiftDown();
if(i % 3 == 0) {
invaderBullets.push(new Bullet(invaders[i].x, invaders[i].y));
}
}
}
}
/**
* Events
*/
function keyPressed() {
if(keyCode == keyCodes.d) {
ship.setDirection(1);
} else if(keyCode == keyCodes.a) {
ship.setDirection(-1);
}
if(keyCode == keyCodes.space) {
bullets.push( new Bullet(ship.x, height - ship.shipHeight * 2) );
laserSound2.play();
bulletsShot++;
}
}
function keyReleased() {
if(keyCode != keyCodes.space) {
ship.setDirection(0);
}
}
|
const express = require('express');
const app = express();
const path = require('path');
const csv = require('fast-csv');
app.set('view engine', 'ejs');
app.use(express.static(path.join(__dirname, 'public')));
app.get('/', function (req, res) {
res.render('pages/index');
});
app.get('/about', function (req, res) {
var presidents = []
csv.fromPath(path.join(__dirname, 'presidents.csv'))
.on('data', function(data) {
presidents = presidents.concat([data]);
})
.on('end', function() {
res.render('pages/about', {presidents: presidents});
});
});
app.get('/membership', function (req, res) {
res.render('pages/membership');
});
app.get('/news', function (req, res) {
res.render('pages/news');
});
app.get('/contact', function (req, res) {
res.render('pages/contact');
});
app.get('/conference', function (req, res) {
res.render('pages/conference');
})
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
}); |
const config = require('../../config');
const {
DocScanClient,
} = require('yoti');
module.exports = async (req, res) => {
const docScanClient = new DocScanClient(
config.YOTI_CLIENT_SDK_ID,
config.YOTI_PEM
);
try {
const media = await docScanClient.getMediaContent(
req.session.DOC_SCAN_SESSION_ID,
req.query.mediaId
);
const { buffer } = media.getContent();
if (buffer.length === 0) {
res.status(204).end(buffer);
} else {
res.set('Content-Type', media.getMimeType());
res.status(200).end(buffer);
}
} catch (error) {
res.render('pages/error', { error });
}
};
|
import {
basicAfterEach,
basicBeforeEach,
FR_EMOJI,
ALL_EMOJI,
mockFrenchDataSource,
tick
} from '../shared'
import Picker from '../../../src/picker/PickerElement.js'
import { getByRole } from '@testing-library/dom'
import { DEFAULT_DATA_SOURCE, DEFAULT_LOCALE } from '../../../src/database/constants'
import enI18n from '../../../src/picker/i18n/en.js'
import { DEFAULT_CATEGORY_SORTING, DEFAULT_SKIN_TONE_EMOJI } from '../../../src/picker/constants'
describe('attributes tests', () => {
beforeEach(async () => {
basicBeforeEach()
mockFrenchDataSource()
})
afterEach(basicAfterEach)
test('setting initial locale/dataSource issues only one GET', async () => {
const picker = new Picker()
picker.setAttribute('locale', 'fr')
picker.setAttribute('data-source', FR_EMOJI)
document.body.appendChild(picker)
await tick(20)
expect(fetch).toHaveBeenCalledTimes(1)
expect(fetch).toHaveBeenLastCalledWith(FR_EMOJI, undefined)
expect(picker.locale).toEqual('fr')
expect(picker.dataSource).toEqual(FR_EMOJI)
expect(picker.getAttribute('locale')).toEqual('fr')
expect(picker.getAttribute('data-source')).toEqual(FR_EMOJI)
document.body.removeChild(picker)
await tick(20)
})
test('can set skintone emoji using an attribute', async () => {
const picker = new Picker()
picker.setAttribute('data-source', ALL_EMOJI)
picker.setAttribute('skin-tone-emoji', '✌')
document.body.appendChild(picker)
await tick(20)
expect(getByRole(picker.shadowRoot, 'button', { name: /Choose a skin tone/ }).innerHTML)
.toContain('✌')
expect(picker.skinToneEmoji).toEqual('✌')
expect(picker.getAttribute('skin-tone-emoji')).toEqual('✌')
expect(picker.locale).toEqual('en')
picker.setAttribute('skin-tone-emoji', '🏃')
await tick(20)
expect(getByRole(picker.shadowRoot, 'button', { name: /Choose a skin tone/ }).innerHTML)
.toContain('🏃')
expect(picker.skinToneEmoji).toEqual('🏃')
document.body.removeChild(picker)
await tick(20)
})
test('change property while disconnected from DOM', async () => {
const picker = new Picker()
picker.setAttribute('data-source', ALL_EMOJI)
document.body.appendChild(picker)
await tick(20)
document.body.removeChild(picker)
await tick(20)
picker.skinToneEmoji = '✌'
expect(picker.skinToneEmoji).toEqual('✌')
document.body.appendChild(picker)
await tick(20)
expect(getByRole(picker.shadowRoot, 'button', { name: /Choose a skin tone/ }).innerHTML)
.toContain('✌')
expect(picker.skinToneEmoji).toEqual('✌')
document.body.removeChild(picker)
await tick(20)
})
test('change property while disconnected from DOM', async () => {
const picker = new Picker()
picker.setAttribute('data-source', ALL_EMOJI)
document.body.appendChild(picker)
await tick(20)
document.body.removeChild(picker)
await tick(20)
picker.setAttribute('skin-tone-emoji', '✌')
expect(picker.skinToneEmoji).toEqual('✌')
document.body.appendChild(picker)
await tick(20)
expect(getByRole(picker.shadowRoot, 'button', { name: /Choose a skin tone/ }).innerHTML)
.toContain('✌')
expect(picker.skinToneEmoji).toEqual('✌')
expect(picker.getAttribute('skin-tone-emoji')).toEqual('✌')
document.body.removeChild(picker)
await tick(20)
})
function testDefaultProps (picker) {
expect(picker.customCategorySorting).toEqual(DEFAULT_CATEGORY_SORTING)
expect(picker.customEmoji).toEqual(null)
expect(picker.dataSource).toEqual(DEFAULT_DATA_SOURCE)
expect(picker.i18n).toEqual(enI18n)
expect(picker.locale).toEqual(DEFAULT_LOCALE)
expect(picker.skinToneEmoji).toEqual(DEFAULT_SKIN_TONE_EMOJI)
}
function expectTruthyDatabase (picker) {
expect(typeof picker.database).toEqual('object')
expect(picker.database).toBeTruthy()
}
test('default properties - connected', async () => {
const picker = new Picker()
document.body.appendChild(picker)
await tick(20)
testDefaultProps(picker)
expectTruthyDatabase(picker)
document.body.removeChild(picker)
await tick(20)
})
test('default properties - disconnected', async () => {
const picker = new Picker()
document.body.appendChild(picker)
await tick(20)
document.body.removeChild(picker)
await tick(20)
testDefaultProps(picker)
expectTruthyDatabase(picker)
})
test('default properties - never connected', async () => {
const picker = new Picker()
testDefaultProps(picker)
expectTruthyDatabase(picker)
document.body.appendChild(picker)
await tick(20)
document.body.removeChild(picker)
await tick(20)
})
test('attributes present on element at creation time', async () => {
const div = document.createElement('div')
document.body.appendChild(div)
div.innerHTML = `<emoji-picker locale="fr" data-source="${ALL_EMOJI}" skin-tone-emoji="✌"></emoji-picker>`
const picker = div.querySelector('emoji-picker')
await tick(20)
expect(picker.locale).toEqual('fr')
expect(picker.dataSource).toEqual(ALL_EMOJI)
expect(picker.skinToneEmoji).toEqual('✌')
expect(getByRole(picker.shadowRoot, 'button', { name: /Choose a skin tone/ }).innerHTML)
.toContain('✌')
expect(fetch).toHaveBeenCalledTimes(1)
expect(fetch).toHaveBeenLastCalledWith(ALL_EMOJI, undefined)
document.body.removeChild(div)
await tick(20)
})
})
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.