repo_name
stringlengths 4
116
| path
stringlengths 3
942
| size
stringlengths 1
7
| content
stringlengths 3
1.05M
| license
stringclasses 15
values |
|---|---|---|---|---|
Rafiot/MISP
|
app/Model/Galaxy.php
|
20693
|
<?php
App::uses('AppModel', 'Model');
class Galaxy extends AppModel
{
public $useTable = 'galaxies';
public $recursive = -1;
public $actsAs = array(
'Containable',
);
public $validate = array(
);
public $hasMany = array(
'GalaxyCluster' => array('dependent' => true)
);
public function beforeValidate($options = array())
{
parent::beforeValidate();
return true;
}
public function beforeDelete($cascade = true)
{
$this->GalaxyCluster->deleteAll(array('GalaxyCluster.galaxy_id' => $this->id));
}
private function __load_galaxies($force = false)
{
$dir = new Folder(APP . 'files' . DS . 'misp-galaxy' . DS . 'galaxies');
$files = $dir->find('.*\.json');
$galaxies = array();
foreach ($files as $file) {
$file = new File($dir->pwd() . DS . $file);
$galaxies[] = json_decode($file->read(), true);
$file->close();
}
$galaxyTypes = array();
foreach ($galaxies as $galaxy) {
$galaxyTypes[$galaxy['type']] = $galaxy['type'];
}
$temp = $this->find('all', array(
'fields' => array('uuid', 'version', 'id', 'icon'),
'recursive' => -1
));
$existingGalaxies = array();
foreach ($temp as $k => $v) {
$existingGalaxies[$v['Galaxy']['uuid']] = $v['Galaxy'];
}
foreach ($galaxies as $k => $galaxy) {
if (isset($existingGalaxies[$galaxy['uuid']])) {
if (
$force ||
$existingGalaxies[$galaxy['uuid']]['version'] < $galaxy['version'] ||
(!empty($galaxy['icon']) && ($existingGalaxies[$galaxy['uuid']]['icon'] != $galaxy['icon']))
) {
$galaxy['id'] = $existingGalaxies[$galaxy['uuid']]['id'];
$this->save($galaxy);
}
} else {
$this->create();
$this->save($galaxy);
}
}
return $this->find('list', array('recursive' => -1, 'fields' => array('type', 'id')));
}
public function update($force = false)
{
$galaxies = $this->__load_galaxies($force);
$dir = new Folder(APP . 'files' . DS . 'misp-galaxy' . DS . 'clusters');
$files = $dir->find('.*\.json');
$cluster_packages = array();
foreach ($files as $file) {
$file = new File($dir->pwd() . DS . $file);
$cluster_package = json_decode($file->read(), true);
$file->close();
if (!isset($galaxies[$cluster_package['type']])) {
continue;
}
$template = array(
'source' => isset($cluster_package['source']) ? $cluster_package['source'] : '',
'authors' => json_encode(isset($cluster_package['authors']) ? $cluster_package['authors'] : array(), true),
'collection_uuid' => isset($cluster_package['uuid']) ? $cluster_package['uuid'] : '',
'galaxy_id' => $galaxies[$cluster_package['type']],
'type' => $cluster_package['type'],
'tag_name' => 'misp-galaxy:' . $cluster_package['type'] . '="'
);
$elements = array();
$temp = $this->GalaxyCluster->find('all', array(
'conditions' => array(
'GalaxyCluster.galaxy_id' => $galaxies[$cluster_package['type']]
),
'recursive' => -1,
'fields' => array('version', 'id', 'value', 'uuid')
));
$existingClusters = array();
foreach ($temp as $k => $v) {
$existingClusters[$v['GalaxyCluster']['value']] = $v;
}
$clusters_to_delete = array();
// Delete all existing outdated clusters
foreach ($cluster_package['values'] as $k => $cluster) {
if (empty($cluster['value'])) {
continue;
}
if (isset($cluster['version'])) {
} elseif (!empty($cluster_package['version'])) {
$cluster_package['values'][$k]['version'] = $cluster_package['version'];
} else {
$cluster_package['values'][$k]['version'] = 0;
}
if (!empty($existingClusters[$cluster['value']])) {
if ($force || $existingClusters[$cluster['value']]['GalaxyCluster']['version'] < $cluster_package['values'][$k]['version']) {
$clusters_to_delete[] = $existingClusters[$cluster['value']]['GalaxyCluster']['id'];
} else {
unset($cluster_package['values'][$k]);
}
}
}
if (!empty($clusters_to_delete)) {
$this->GalaxyCluster->GalaxyElement->deleteAll(array('GalaxyElement.galaxy_cluster_id' => $clusters_to_delete), false, false);
$this->GalaxyCluster->delete($clusters_to_delete, false, false);
}
// create all clusters
foreach ($cluster_package['values'] as $cluster) {
if (empty($cluster['version'])) {
$cluster['version'] = 1;
}
$template['version'] = $cluster['version'];
$this->GalaxyCluster->create();
$cluster_to_save = $template;
if (isset($cluster['description'])) {
$cluster_to_save['description'] = $cluster['description'];
unset($cluster['description']);
}
$cluster_to_save['value'] = $cluster['value'];
$cluster_to_save['tag_name'] = $cluster_to_save['tag_name'] . $cluster['value'] . '"';
if (!empty($cluster['uuid'])) {
$cluster_to_save['uuid'] = $cluster['uuid'];
}
unset($cluster['value']);
if (empty($cluster_to_save['description'])) {
$cluster_to_save['description'] = '';
}
$result = $this->GalaxyCluster->save($cluster_to_save, false);
$galaxyClusterId = $this->GalaxyCluster->id;
if (isset($cluster['meta'])) {
foreach ($cluster['meta'] as $key => $value) {
if (is_array($value)) {
foreach ($value as $v) {
$elements[] = array(
$galaxyClusterId,
$key,
$v
);
}
} else {
$elements[] = array(
$this->GalaxyCluster->id,
$key,
$value
);
}
}
}
}
$db = $this->getDataSource();
$fields = array('galaxy_cluster_id', 'key', 'value');
if (!empty($elements)) {
$db->insertMulti('galaxy_elements', $fields, $elements);
}
}
return true;
}
private function __attachClusterToEvent($user, $target_id, $cluster_id) {
}
public function attachCluster($user, $target_type, $target_id, $cluster_id)
{
$connectorModel = Inflector::camelize($target_type) . 'Tag';
$cluster = $this->GalaxyCluster->find('first', array('recursive' => -1, 'conditions' => array('id' => $cluster_id), 'fields' => array('tag_name', 'id', 'value')));
$this->Tag = ClassRegistry::init('Tag');
if ($target_type === 'event') {
$target = $this->Tag->EventTag->Event->fetchEvent($user, array('eventid' => $target_id, 'metadata' => 1));
} elseif ($target_type === 'attribute') {
$target = $this->Tag->AttributeTag->Attribute->fetchAttributes($user, array('conditions' => array('Attribute.id' => $target_id), 'flatten' => 1));
} elseif ($target_type === 'tag_collection') {
$target = $this->Tag->TagCollectionTag->TagCollection->fetchTagCollection($user, array('conditions' => array('TagCollection.id' => $target_id)));
}
if (empty($target)) {
throw new NotFoundException(__('Invalid %s.', $target_type));
}
$target = $target[0];
$tag_id = $this->Tag->captureTag(array('name' => $cluster['GalaxyCluster']['tag_name'], 'colour' => '#0088cc', 'exportable' => 1), $user);
$existingTag = $this->Tag->$connectorModel->find('first', array('conditions' => array($target_type . '_id' => $target_id, 'tag_id' => $tag_id)));
if (!empty($existingTag)) {
return 'Cluster already attached.';
}
$this->Tag->$connectorModel->create();
$toSave = array($target_type . '_id' => $target_id, 'tag_id' => $tag_id);
if ($target_type === 'attribute') {
$event = $this->Tag->EventTag->Event->find('first', array(
'conditions' => array(
'Event.id' => $target['Attribute']['event_id']
),
'recursive' => -1
));
$toSave['event_id'] = $target['Attribute']['event_id'];
}
$result = $this->Tag->$connectorModel->save($toSave);
if ($result) {
if ($target_type !== 'tag_collection') {
if ($target_type === 'event') {
$event = $target;
}
$this->Tag->EventTag->Event->insertLock($user, $event['Event']['id']);
$event['Event']['published'] = 0;
$date = new DateTime();
$event['Event']['timestamp'] = $date->getTimestamp();
$this->Tag->EventTag->Event->save($event);
}
$this->Log = ClassRegistry::init('Log');
$this->Log->create();
$this->Log->save(array(
'org' => $user['Organisation']['name'],
'model' => ucfirst($target_type),
'model_id' => $target_id,
'email' => $user['email'],
'action' => 'galaxy',
'title' => 'Attached ' . $cluster['GalaxyCluster']['value'] . ' (' . $cluster['GalaxyCluster']['id'] . ') to ' . $target_type . ' (' . $target_id . ')',
'change' => ''
));
return 'Cluster attached.';
}
return 'Could not attach the cluster';
}
public function detachCluster($user, $target_type, $target_id, $cluster_id) {
$cluster = $this->GalaxyCluster->find('first', array(
'recursive' => -1,
'conditions' => array('id' => $cluster_id),
'fields' => array('tag_name', 'id', 'value')
));
$this->Tag = ClassRegistry::init('Tag');
if ($target_type === 'event') {
$target = $this->Tag->EventTag->Event->fetchEvent($user, array('eventid' => $target_id, 'metadata' => 1));
if (empty($target)) {
throw new NotFoundException(__('Invalid %s.', $target_type));
}
$target = $target[0];
$event = $target;
$event_id = $target['Event']['id'];
$org_id = $event['Event']['org_id'];
$orgc_id = $event['Event']['orgc_id'];
} elseif ($target_type === 'attribute') {
$target = $this->Tag->AttributeTag->Attribute->fetchAttributes($user, array('conditions' => array('Attribute.id' => $target_id), 'flatten' => 1));
if (empty($target)) {
throw new NotFoundException(__('Invalid %s.', $target_type));
}
$target = $target[0];
$event_id = $target['Attribute']['event_id'];
$event = $this->Tag->EventTag->Event->fetchEvent($user, array('eventid' => $event_id, 'metadata' => 1));
if (empty($event)) {
throw new NotFoundException(__('Invalid event'));
}
$event = $event[0];
$org_id = $event['Event']['org_id'];
$orgc_id = $event['Event']['org_id'];
} elseif ($target_type === 'tag_collection') {
$target = $this->Tag->TagCollectionTag->TagCollection->fetchTagCollection($user, array('conditions' => array('TagCollection.id' => $target_id)));
if (empty($target)) {
throw new NotFoundException(__('Invalid %s.', $target_type));
}
$target = $target[0];
$org_id = $target['org_id'];
$orgc_id = $org_id;
}
if (!$user['Role']['perm_site_admin'] && !$user['Role']['perm_sync']) {
if (
($scope === 'tag_collection' && !$user['Role']['perm_tag_editor']) ||
($scope !== 'tag_collection' && !$user['Role']['perm_tagger']) ||
($user['org_id'] !== $org_id && $user['org_id'] !== $orgc_id)
) {
throw new MethodNotAllowedException('Invalid ' . Inflector::humanize($targe_type) . '.');
}
}
$tag_id = $this->Tag->captureTag(array('name' => $cluster['GalaxyCluster']['tag_name'], 'colour' => '#0088cc', 'exportable' => 1), $user);
if ($target_type == 'attribute') {
$existingTargetTag = $this->Tag->AttributeTag->find('first', array(
'conditions' => array('AttributeTag.tag_id' => $tag_id, 'AttributeTag.attribute_id' => $target_id),
'recursive' => -1,
'contain' => array('Tag')
));
} elseif ($target_type == 'event') {
$existingTargetTag = $this->Tag->EventTag->find('first', array(
'conditions' => array('EventTag.tag_id' => $tag_id, 'EventTag.event_id' => $target_id),
'recursive' => -1,
'contain' => array('Tag')
));
} elseif ($target_type == 'tag_collection') {
$existingTargetTag = $this->Tag->TagCollectionTag->TagCollection->find('first', array(
'conditions' => array('tag_id' => $tag_id, 'tag_collection_id' => $target_id),
'recursive' => -1,
'contain' => array('Tag')
));
}
if (empty($existingTargetTag)) {
return 'Cluster not attached.';
} else {
if ($target_type == 'event') {
$result = $this->Tag->EventTag->delete($existingTargetTag['EventTag']['id']);
} elseif ($target_type == 'attribute') {
$result = $this->Tag->AttributeTag->delete($existingTargetTag['AttributeTag']['id']);
} elseif ($target_type == 'tag_collection') {
$result = $this->Tag->TagCollectionTag->delete($existingTargetTag['TagCollectionTag']['id']);
}
if ($result) {
if ($target_type !== 'tag_collection') {
$this->Tag->EventTag->Event->insertLock($user, $event['Event']['id']);
$event['Event']['published'] = 0;
$date = new DateTime();
$event['Event']['timestamp'] = $date->getTimestamp();
$this->Tag->EventTag->Event->save($event);
}
$this->Log = ClassRegistry::init('Log');
$this->Log->create();
$this->Log->save(array(
'org' => $user['Organisation']['name'],
'model' => ucfirst($target_type),
'model_id' => $target_id,
'email' => $user['email'],
'action' => 'galaxy',
'title' => 'Detached ' . $cluster['GalaxyCluster']['value'] . ' (' . $cluster['GalaxyCluster']['id'] . ') to ' . $target_type . ' (' . $target_id . ')',
'change' => ''
));
return 'Cluster detached';
} else {
return 'Could not detach cluster';
}
}
}
public function getMitreAttackGalaxyId($type="mitre-enterprise-attack-attack-pattern")
{
$galaxy = $this->find('first', array(
'recursive' => -1,
'fields' => 'id',
'conditions' => array('Galaxy.type' => $type),
));
return empty($galaxy) ? 0 : $galaxy['Galaxy']['id'];
}
public function getMitreAttackMatrix()
{
$killChainOrderEnterprise = array(
'initial-access',
'execution',
'persistence',
'privilege-escalation',
'defense-evasion',
'credential-access',
'discovery',
'lateral-movement',
'collection',
'exfiltration',
'command-and-control'
);
$killChainOrderMobile = array(
'persistence',
'privilege-escalation',
'defense-evasion',
'credential-access',
'discovery',
'lateral-movement',
'effects', 'collection',
'exfiltration',
'command-and-control',
'general-network-based',
'cellular-network-based',
'could-based'
);
$killChainOrderPre = array(
'priority-definition-planning',
'priority-definition-direction',
'target-selection',
'technical-information-gathering',
'people-information-gathering',
'organizational-information-gathering',
'technical-weakness-identification',
'people-weakness-identification',
'organizational-weakness-identification',
'adversary-opsec',
'establish-&-maintain-infrastructure',
'persona-development',
'build-capabilities',
'test-capabilities',
'stage-capabilities',
'app-delivery-via-authorized-app-store',
'app-delivery-via-other-means',
'exploit-via-cellular-network',
'exploit-via-internet',
);
$killChainOrders = array(
'mitre-enterprise-attack-attack-pattern' => $killChainOrderEnterprise,
'mitre-mobile-attack-attack-pattern' => $killChainOrderMobile,
'mitre-pre-attack-attack-pattern' => $killChainOrderPre,
);
$expectedDescription = 'ATT&CK Tactic';
$expectedNamespace = 'mitre-attack';
$conditions = array('Galaxy.description' => $expectedDescription, 'Galaxy.namespace' => $expectedNamespace);
$contains = array(
'GalaxyCluster' => array('GalaxyElement'),
);
$galaxies = $this->find('all', array(
'recursive' => -1,
'contain' => $contains,
'conditions' => $conditions,
));
$mispUUID = Configure::read('MISP')['uuid'];
$attackTactic = array(
'killChain' => $killChainOrders,
'attackTactic' => array(),
'attackTags' => array(),
'instance-uuid' => $mispUUID
);
foreach ($galaxies as $galaxy) {
$galaxyType = $galaxy['Galaxy']['type'];
$clusters = $galaxy['GalaxyCluster'];
$attackClusters = array();
// add cluster if kill_chain is present
foreach ($clusters as $cluster) {
if (empty($cluster['GalaxyElement'])) {
continue;
}
$toBeAdded = false;
$clusterType = $cluster['type'];
$galaxyElements = $cluster['GalaxyElement'];
foreach ($galaxyElements as $element) {
if ($element['key'] == 'kill_chain') {
$kc = explode(":", $element['value'])[2];
$attackClusters[$kc][] = $cluster;
$toBeAdded = true;
}
if ($element['key'] == 'external_id') {
$cluster['external_id'] = $element['value'];
}
}
if ($toBeAdded) {
array_push($attackTactic['attackTags'], $cluster['tag_name']);
}
}
$attackTactic['attackTactic'][$galaxyType] = array(
'clusters' => $attackClusters,
'galaxy' => $galaxy['Galaxy'],
);
}
return $attackTactic;
}
}
|
agpl-3.0
|
elimence/edx-platform
|
lms/djangoapps/staticbook/views.py
|
5555
|
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.core.urlresolvers import reverse
from mitxmako.shortcuts import render_to_response
from courseware.access import has_access
from courseware.courses import get_course_with_access
from notes.utils import notes_enabled_for_course
from static_replace import replace_static_urls
@login_required
def index(request, course_id, book_index, page=None):
course = get_course_with_access(request.user, course_id, 'load')
staff_access = has_access(request.user, course, 'staff')
book_index = int(book_index)
if book_index < 0 or book_index >= len(course.textbooks):
raise Http404("Invalid book index value: {0}".format(book_index))
textbook = course.textbooks[book_index]
table_of_contents = textbook.table_of_contents
if page is None:
page = textbook.start_page
return render_to_response('staticbook.html',
{'book_index': book_index, 'page': int(page),
'course': course,
'book_url': textbook.book_url,
'table_of_contents': table_of_contents,
'start_page': textbook.start_page,
'end_page': textbook.end_page,
'staff_access': staff_access})
def index_shifted(request, course_id, page):
return index(request, course_id=course_id, page=int(page) + 24)
@login_required
def pdf_index(request, course_id, book_index, chapter=None, page=None):
"""
Display a PDF textbook.
course_id: course for which to display text. The course should have
"pdf_textbooks" property defined.
book index: zero-based index of which PDF textbook to display.
chapter: (optional) one-based index into the chapter array of textbook PDFs to display.
Defaults to first chapter. Specifying this assumes that there are separate PDFs for
each chapter in a textbook.
page: (optional) one-based page number to display within the PDF. Defaults to first page.
"""
course = get_course_with_access(request.user, course_id, 'load')
staff_access = has_access(request.user, course, 'staff')
book_index = int(book_index)
if book_index < 0 or book_index >= len(course.pdf_textbooks):
raise Http404("Invalid book index value: {0}".format(book_index))
textbook = course.pdf_textbooks[book_index]
def remap_static_url(original_url, course):
input_url = "'" + original_url + "'"
output_url = replace_static_urls(
input_url,
getattr(course, 'data_dir', None),
course_namespace=course.location
)
# strip off the quotes again...
return output_url[1:-1]
if 'url' in textbook:
textbook['url'] = remap_static_url(textbook['url'], course)
# then remap all the chapter URLs as well, if they are provided.
if 'chapters' in textbook:
for entry in textbook['chapters']:
entry['url'] = remap_static_url(entry['url'], course)
return render_to_response('static_pdfbook.html',
{'book_index': book_index,
'course': course,
'textbook': textbook,
'chapter': chapter,
'page': page,
'staff_access': staff_access})
@login_required
def html_index(request, course_id, book_index, chapter=None):
"""
Display an HTML textbook.
course_id: course for which to display text. The course should have
"html_textbooks" property defined.
book index: zero-based index of which HTML textbook to display.
chapter: (optional) one-based index into the chapter array of textbook HTML files to display.
Defaults to first chapter. Specifying this assumes that there are separate HTML files for
each chapter in a textbook.
"""
course = get_course_with_access(request.user, course_id, 'load')
staff_access = has_access(request.user, course, 'staff')
notes_enabled = notes_enabled_for_course(course)
book_index = int(book_index)
if book_index < 0 or book_index >= len(course.html_textbooks):
raise Http404("Invalid book index value: {0}".format(book_index))
textbook = course.html_textbooks[book_index]
def remap_static_url(original_url, course):
input_url = "'" + original_url + "'"
output_url = replace_static_urls(
input_url,
getattr(course, 'data_dir', None),
course_namespace=course.location
)
# strip off the quotes again...
return output_url[1:-1]
if 'url' in textbook:
textbook['url'] = remap_static_url(textbook['url'], course)
# then remap all the chapter URLs as well, if they are provided.
if 'chapters' in textbook:
for entry in textbook['chapters']:
entry['url'] = remap_static_url(entry['url'], course)
return render_to_response('static_htmlbook.html',
{'book_index': book_index,
'course': course,
'textbook': textbook,
'chapter': chapter,
'staff_access': staff_access,
'notes_enabled': notes_enabled})
|
agpl-3.0
|
rockneurotiko/wirecloud
|
src/wirecloud/catalogue/management/commands/addtocatalogue.py
|
5256
|
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2015 CoNWeT Lab., Universidad Politécnica de Madrid
# This file is part of Wirecloud.
# Wirecloud is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Wirecloud is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License
# along with Wirecloud. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import locale
from optparse import make_option
from django.contrib.auth.models import User, Group
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import override, ugettext as _
from wirecloud.catalogue.views import add_packaged_resource
from wirecloud.commons.utils.template import TemplateParser
from wirecloud.commons.utils.wgt import WgtFile
from wirecloud.platform.localcatalogue.utils import install_resource_to_user, install_resource_to_group, install_resource_to_all_users
class Command(BaseCommand):
args = '<file.wgt>...'
help = 'Adds one or more packaged mashable application components into the catalogue'
option_list = BaseCommand.option_list + (
make_option('--redeploy',
action='store_true',
dest='redeploy',
help='Replace mashable application components files with the new ones.',
default=False),
make_option('-u', '--users',
action='store',
type='string',
dest='users',
help='Comma separated list of users that will obtain access to the uploaded mashable application components',
default=''),
make_option('-g', '--groups',
action='store',
type='string',
dest='groups',
help='Comma separated list of groups that will obtain access rights to the uploaded mashable application components',
default=''),
make_option('-p', '--public',
action='store_true',
dest='public',
help='Allow any user to access the mashable application components.',
default=False),
)
def _handle(self, *args, **options):
if len(args) < 1:
raise CommandError(_('Wrong number of arguments'))
self.verbosity = int(options.get('verbosity', 1))
users = []
groups = []
redeploy = options['redeploy']
public = options['public']
users_string = options['users'].strip()
groups_string = options['groups'].strip()
if redeploy is False and public is False and users_string == '' and groups_string == '':
raise CommandError(_('You must use at least one of the following flags: --redeploy, --users, --groups or --public '))
if not options['redeploy']:
if users_string != '':
for username in users_string.split(','):
users.append(User.objects.get(username=username))
if groups_string != '':
for groupname in groups_string.split(','):
groups.append(Group.objects.get(name=groupname))
for file_name in args:
try:
f = open(file_name, 'rb')
wgt_file = WgtFile(f)
except:
self.log(_('Failed to read from %(file_name)s') % {'file_name': file_name}, level=1)
continue
try:
template_contents = wgt_file.get_template()
template = TemplateParser(template_contents)
if options['redeploy']:
add_packaged_resource(f, None, wgt_file=wgt_file, template=template, deploy_only=True)
else:
for user in users:
install_resource_to_user(user, file_contents=wgt_file)
for group in groups:
install_resource_to_group(group, file_contents=wgt_file)
if public:
install_resource_to_all_users(file_contents=wgt_file)
wgt_file.close()
f.close()
self.log(_('Successfully imported \"%(name)s\" from \"%(file_name)s\"') % {'name': template.get_resource_processed_info()['title'], 'file_name': file_name}, level=1)
except:
self.log(_('Failed to import the mashable application component from %(file_name)s') % {'file_name': file_name}, level=1)
def handle(self, *args, **options):
try:
default_locale = locale.getdefaultlocale()[0][:2]
except TypeError:
default_locale = None
with override(default_locale):
return self._handle(*args, **options)
def log(self, msg, level=2):
"""
Small log helper
"""
if self.verbosity >= level:
self.stdout.write(msg)
|
agpl-3.0
|
miing/mci_migo
|
acceptance/tests/emails/doubled_email.py
|
1736
|
from sst.actions import (
assert_title,
fails,
wait_for,
)
from u1testutils import mail
from u1testutils.sst import config
from acceptance import helpers
config.set_base_url_from_env()
PASSWORD = 'Admin007'
# 2) Create 2 accounts (A & B). In Account A add email address C and do not
# verify. In Account B add email address C and do not verify.
email_a_id = mail.make_unique_test_email_address()
email_b_id = mail.make_unique_test_email_address()
email_c_id = mail.make_unique_test_email_address()
helpers.register_account(email_a_id, password=PASSWORD)
vcode_x = helpers.add_email(email_c_id)
helpers.logout()
helpers.register_account(email_b_id, password=PASSWORD)
vcode_y = helpers.add_email(email_c_id)
# try x from a, should fail
helpers.logout()
helpers.login(email_a_id, PASSWORD)
# Trying and failing to use token X completely invalidates token X, even for
# account B (which now owns the token) later in this test.
# helpers.try_to_validate_email(email_c_id, vcode_x)
# fails(assert_title, 'Complete email address validation')
# try y from a, should fail
helpers.try_to_validate_email(email_c_id, vcode_y, finish_validation=False)
fails(assert_title, 'Complete email address validation')
# both x & y should work for b, but using one should kill the other.
# try x from b, should work
helpers.logout()
helpers.login(email_b_id, PASSWORD)
helpers.try_to_validate_email(email_c_id, vcode_x, finish_validation=False)
wait_for(assert_title, 'Complete email address validation')
# now, y from b should fail, because address C was already verified (but would
# normally work)
helpers.try_to_validate_email(email_c_id, vcode_y, finish_validation=False)
fails(assert_title, 'Complete email address validation')
|
agpl-3.0
|
flysonic10/cloudbrain
|
.vagrant/osx/vagrant-build-popy.sh
|
281
|
# copy cloudbrain to vagrant home
vagrant scp ../../../cloudbrain :/Users/vagrant/.
# Build popy in VM
vagrant ssh -c "cd /Users/vagrant/cloudbrain/scripts/osx && ./build-popy.sh"
# Copy popy.tar.gz
rm popy.tar.gz
vagrant scp :/Users/vagrant/cloudbrain/scripts/osx/popy.tar.gz .
|
agpl-3.0
|
irontec/Mintzatu
|
public/karma/modules/tablon/scripts/tiny_mce/plugins/advimage/ajax_gallery.php
|
2902
|
<?php
if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
define("SERVER_NAME",$_SERVER['HTTP_X_FORWARDED_HOST']);
} else {
define("SERVER_NAME",$_SERVER['HTTP_HOST']);
//.(($_SERVER['SERVER_PORT']!="80")? ":".$_SERVER['SERVER_PORT']:""));
}
require_once(dirname(__FILE__)."/../../../../../../clases/class.i.php");
require_once(dirname(__FILE__)."/../../../../../../clases/class.i_image.php");
$ret = array();
$ret['error'] = false;
$cats = array();
$imgs = array();
//$cache = dirname(__FILE__)."/../../../../../../../cache/tinyCache/";
$legacyPath = '/../../../../../../../tinyCache/';
if (is_dir($legacyPath)) {
$cache = $legacyPath;
} else {
$cache = '/../../../../../../../cache/tinyCache/';
}
$cache = dirname(__FILE__).$cache;
$aPasa = array('.','..');
$imgok= array('image/jpg','image/gif','image/png');
$value = i::clean($_GET['val']);
switch($_GET['w']){
case "all":
if ($gestor = opendir($cache)) {
while (false !== ($a= readdir($gestor))) {
if(in_array($a,$aPasa)) continue;
if (!is_dir($cache.$a)) continue;
$cats[] = $a;
}
closedir($gestor);
if (sizeof($cats)<=0){
mkdir($cache."general", 0777);
chmod($cache."general", 0777);
$cats[] = "general";
}
}else{
$ret['error'] = "imposible abrir el directorio ".$cache;
}
case "images":
if (!isset($_GET['c'])) $c = $cats[0]; else $c = $_GET['c'];
if ($gestor = opendir($cache.$c)) {
while (false !== ($a= readdir($gestor))) {
if(in_array($a,$aPasa)) continue;
if (!is_file($cache.$c.'/'.$a)||!in_array(i::mime_content_type($cache.$c.'/'.$a),$imgok)) continue;
$imgs[] = $a;
}
closedir($gestor);
}
break;
case "newCat":
if (trim($value)!=""){
if ($gestor = opendir($cache)) {
while (false !== ($a= readdir($gestor))) {
if(in_array($a,$aPasa)) continue;
if (!is_dir($cache.$a)) continue;
$cats[] = $a;
}
closedir($gestor);
if (!in_array($value,$cats)){
mkdir($cache.$value, 0777);
chmod($cache.$value, 0777);
$ret['result'] = "Categoría insertada con éxito.";
}else{
$ret['error'] = "Entrada repetida";
}
}else{
$ret['error'] = "imposible abrir el directorio ".$cache;
}
}else{
$ret['error'] = 'Debes introducir un nombre';
}
break;
case "delCat":
if (is_dir($cache.$value)){
i::rmrf($cache . $value);
$ret['result'] = "Categoría borrada con éxito.";
}else{
$ret['error'] = 'Error';
}
break;
}
$ret['categories'] = $cats;
$ret['images'] = $imgs;
$ret['path'] = i::base_url()."../../../../../../../cache/tinyCache/".$c."/";
// $ret['svname'] = "http://".SERVER_NAME;
$ret['svname'] = "";
echo json_encode($ret);
exit();
?>
|
agpl-3.0
|
Libs1/Libs1.github.io
|
Documents/Drone Software/Website/error2.html
|
888
|
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>CENG Caged Micro Drone</title>
<link rel="stylesheet" href="css/reset.css">
<link rel='stylesheet prefetch' href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900|RobotoDraft:400,100,300,500,700,900'>
<link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!-- Mixins-->
<!-- Pen Title-->
<div class="pen-title"><h1>Caged Micro Drone</h1></div>
<div class="container"><div class="card"></div>
<div class="card">
<h1 class="title">Passwords Do Not Match!</h1>
</div>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src="js/index.js"></script>
</body>
</html>
|
agpl-3.0
|
ACEmulator/ACE-World
|
Database/3-Core/6 LandBlockExtendedData/SQL/9B27.sql
|
33525
|
DELETE FROM `landblock_instance` WHERE `landblock` = 0x9B27;
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27000, 412, 0x9B270103, 32.3916, 37.645, 176.082, -0.707107, 0, 0, 0.707107, False, '2019-02-10 00:00:00'); /* Door */
/* @teleloc 0x9B270103 [32.391600 37.645000 176.082000] -0.707107 0.000000 0.000000 0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27001, 412, 0x9B270104, 42.5832, 34.1594, 176.082, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Door */
/* @teleloc 0x9B270104 [42.583200 34.159400 176.082000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27002, 412, 0x9B270105, 26.6748, 45.6678, 176.082, 0.939692, 0, 0, 0.342021, False, '2019-02-10 00:00:00'); /* Door */
/* @teleloc 0x9B270105 [26.674800 45.667800 176.082000] 0.939692 0.000000 0.000000 0.342021 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27003, 9686, 0x9B270106, 38.9697, 39.9787, 183.6, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270106 [38.969700 39.978700 183.600000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27004, 9686, 0x9B270106, 33.1947, 40.2537, 183.6, -0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270106 [33.194700 40.253700 183.600000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27005, 11697, 0x9B270106, 34.1344, 45.4834, 180.9, -0.92321, 0, 0, -0.384295, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B270106 [34.134400 45.483400 180.900000] -0.923210 0.000000 0.000000 -0.384295 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27006, 9686, 0x9B270106, 34.9923, 33.9109, 183.6, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270106 [34.992300 33.910900 183.600000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27007, 9686, 0x9B270108, 34.69, 42.5802, 179.45, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270108 [34.690000 42.580200 179.450000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27008, 9686, 0x9B270108, 34.7394, 33.9049, 178.875, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270108 [34.739400 33.904900 178.875000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27009, 9686, 0x9B270109, 37.9903, 33.9253, 179.6, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270109 [37.990300 33.925300 179.600000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2700A, 11697, 0x9B27010A, 36, 46.1659, 176.1, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B27010A [36.000000 46.165900 176.100000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2700B, 9686, 0x9B27010A, 36.2101, 47.0626, 179.6, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010A [36.210100 47.062600 179.600000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2700C, 9686, 0x9B27010D, 42.575, 33.325, 179.55, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010D [42.575000 33.325000 179.550000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2700D, 11697, 0x9B27010D, 45.6, 29.375, 176.1, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B27010D [45.600000 29.375000 176.100000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2700E, 11697, 0x9B27010D, 37.475, 27.525, 176.1, -0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B27010D [37.475000 27.525000 176.100000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2700F, 9686, 0x9B27010F, 34.528, 33.3358, 184.365, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010F [34.528000 33.335800 184.365000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27010, 11697, 0x9B27010F, 26.9825, 28.3858, 180.9, -0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B27010F [26.982500 28.385800 180.900000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27011, 11697, 0x9B27010F, 31.8265, 26.2592, 180.9, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B27010F [31.826500 26.259200 180.900000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27012, 11698, 0x9B27010F, 37.9071, 29.4885, 187.15, -0.999998, 0, 0, 0.001745, False, '2019-02-10 00:00:00'); /* Ceiling Hook */
/* @teleloc 0x9B27010F [37.907100 29.488500 187.150000] -0.999998 0.000000 0.000000 0.001745 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27013, 412, 0x9B270112, 33.285, 29.0458, 176.082, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Door */
/* @teleloc 0x9B270112 [33.285000 29.045800 176.082000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27014, 9686, 0x9B270112, 30.1562, 28.9326, 178.3, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270112 [30.156200 28.932600 178.300000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27015, 412, 0x9B270116, 36.7014, 30.3593, 171.282, 0.707107, 0, 0, -0.707106, False, '2019-02-10 00:00:00'); /* Door */
/* @teleloc 0x9B270116 [36.701400 30.359300 171.282000] 0.707107 0.000000 0.000000 -0.707106 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27017, 9686, 0x9B27011B, 24.5546, 41.8854, 174, -0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27011B [24.554600 41.885400 174.000000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27018, 9686, 0x9B270118, 32.3284, 32.5012, 174, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270118 [32.328400 32.501200 174.000000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27019, 11698, 0x9B270118, 30.8629, 36.5042, 175.5, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Ceiling Hook */
/* @teleloc 0x9B270118 [30.862900 36.504200 175.500000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2701A, 10661, 0x9B270108, 34.6086, 38.3169, 175.9995, 0.8326, 0, 0, -0.553875, False, '2019-02-10 00:00:00'); /* Villa */
/* @teleloc 0x9B270108 [34.608600 38.316900 175.999500] 0.832600 0.000000 0.000000 -0.553875 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2701B, 11730, 0x9B270118, 26.4724, 36.2113, 171.137, -0.715555, 0, 0, -0.698557, False, '2019-02-10 00:00:00'); /* House Portal */
/* @teleloc 0x9B270118 [26.472400 36.211300 171.137000] -0.715555 0.000000 0.000000 -0.698557 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2701C, 11980, 0x9B27000A, 29.7758, 47.7585, 176, 0.001424, 0, 0, -0.999999, False, '2019-02-10 00:00:00'); /* Eightycorvette's Villa */
/* @teleloc 0x9B27000A [29.775800 47.758500 176.000000] 0.001424 0.000000 0.000000 -0.999999 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2701E, 9686, 0x9B270106, 36.0797, 46.569, 184.37, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270106 [36.079700 46.569000 184.370000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2701F, 11698, 0x9B270106, 36.0443, 42.5581, 187.3, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Ceiling Hook */
/* @teleloc 0x9B270106 [36.044300 42.558100 187.300000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27020, 11697, 0x9B270106, 33.6586, 37.2647, 180.9, -0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B270106 [33.658600 37.264700 180.900000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27021, 11697, 0x9B270108, 35.86, 34.4659, 176.1, -0.338738, 0, 0, 0.940881, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B270108 [35.860000 34.465900 176.100000] -0.338738 0.000000 0.000000 0.940881 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27022, 9686, 0x9B270109, 39.1893, 39.3901, 179.57, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270109 [39.189300 39.390100 179.570000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27023, 11697, 0x9B270109, 37.9805, 41.7029, 176.1, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B270109 [37.980500 41.702900 176.100000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27024, 9686, 0x9B27010A, 34.6434, 43.1021, 179.65, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010A [34.643400 43.102100 179.650000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27025, 9686, 0x9B27010D, 40.3323, 25.6258, 179.57, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010D [40.332300 25.625800 179.570000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27026, 9686, 0x9B27010D, 42.8723, 25.6258, 179.57, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010D [42.872300 25.625800 179.570000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27027, 9686, 0x9B27010D, 46.3563, 29.4966, 179.55, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010D [46.356300 29.496600 179.550000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27028, 11698, 0x9B27010D, 41.5343, 29.5081, 180.19, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Ceiling Hook */
/* @teleloc 0x9B27010D [41.534300 29.508100 180.190000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27029, 11697, 0x9B27010D, 44.04, 29.355, 176.1, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B27010D [44.040000 29.355000 176.100000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2702A, 9686, 0x9B27010F, 39.5985, 33.3358, 184.365, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010F [39.598500 33.335800 184.365000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2702B, 9686, 0x9B27010F, 29.771, 33.3358, 184.365, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010F [29.771000 33.335800 184.365000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2702C, 9686, 0x9B27010F, 30.5112, 25.7368, 184.365, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010F [30.511200 25.736800 184.365000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2702D, 9686, 0x9B27010F, 36.1939, 25.7368, 184.365, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010F [36.193900 25.736800 184.365000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2702E, 9686, 0x9B27010F, 41.8388, 25.7368, 184.365, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010F [41.838800 25.736800 184.365000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2702F, 9686, 0x9B27010F, 26.2751, 29.4892, 184.365, -0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010F [26.275100 29.489200 184.365000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27030, 9686, 0x9B27010F, 45.7951, 29.5232, 184.365, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27010F [45.795100 29.523200 184.365000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27031, 11698, 0x9B27010F, 34.3351, 29.5592, 187.15, -0.999998, 0, 0, 0.001745, False, '2019-02-10 00:00:00'); /* Ceiling Hook */
/* @teleloc 0x9B27010F [34.335100 29.559200 187.150000] -0.999998 0.000000 0.000000 0.001745 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27032, 11697, 0x9B27010F, 42.7525, 32.6858, 180.9, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B27010F [42.752500 32.685800 180.900000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27033, 11697, 0x9B27010F, 45.0925, 29.3058, 180.9, -0.707107, 0, 0, 0.707107, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B27010F [45.092500 29.305800 180.900000] -0.707107 0.000000 0.000000 0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27034, 11697, 0x9B27010F, 41.0625, 26.1658, 180.9, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B27010F [41.062500 26.165800 180.900000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27035, 9686, 0x9B270111, 36.2712, 31.4145, 179.41, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270111 [36.271200 31.414500 179.410000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27036, 9686, 0x9B270111, 25.82, 31.78, 179.66, -0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270111 [25.820000 31.780000 179.660000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27037, 9686, 0x9B270111, 33.36, 29.49, 179.66, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270111 [33.360000 29.490000 179.660000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27038, 9686, 0x9B270112, 36.2712, 27.2724, 179.41, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270112 [36.271200 27.272400 179.410000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27039, 9686, 0x9B270116, 33.3284, 27.1812, 174.23, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270116 [33.328400 27.181200 174.230000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2703A, 9686, 0x9B270116, 36.5884, 30.3312, 174.23, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270116 [36.588400 30.331200 174.230000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2703B, 9686, 0x9B270117, 37.15, 36.3512, 174.59, -0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270117 [37.150000 36.351200 174.590000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2703C, 9686, 0x9B270118, 24.5546, 37.7454, 174, -0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270118 [24.554600 37.745400 174.000000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2703D, 9686, 0x9B270118, 28.3584, 32.5012, 174, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B270118 [28.358400 32.501200 174.000000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2703E, 11697, 0x9B270118, 25.3897, 33.3235, 171.34, -0.372988, 0, 0, -0.927836, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B270118 [25.389700 33.323500 171.340000] -0.372988 0.000000 0.000000 -0.927836 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2703F, 9686, 0x9B27011B, 24.5546, 41.8854, 174, -0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27011B [24.554600 41.885400 174.000000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27040, 9686, 0x9B27011B, 32.77, 41.4669, 174, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27011B [32.770000 41.466900 174.000000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27041, 11698, 0x9B27011B, 28.8887, 41.6489, 175.5, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Ceiling Hook */
/* @teleloc 0x9B27011B [28.888700 41.648900 175.500000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27042, 11697, 0x9B27011B, 25.8297, 43.6735, 171.34, -0.941176, 0, 0, -0.337917, False, '2019-02-10 00:00:00'); /* Floor Hook */
/* @teleloc 0x9B27011B [25.829700 43.673500 171.340000] -0.941176 0.000000 0.000000 -0.337917 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27043, 9686, 0x9B27000A, 26.45, 45.99, 179.25, 0.357553, 0, 0, -0.933893, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27000A [26.450000 45.990000 179.250000] 0.357553 0.000000 0.000000 -0.933893 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27044, 9686, 0x9B27000A, 30.32, 47.22, 178.32, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27000A [30.320000 47.220000 178.320000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27045, 9686, 0x9B27000A, 24.97, 41.46, 178.32, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27000A [24.970000 41.460000 178.320000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27046, 9686, 0x9B27000A, 32.3844, 37.5888, 179.39, 0.707107, 0, 0, -0.707107, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27000A [32.384400 37.588800 179.390000] 0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27047, 9686, 0x9B27000A, 42.845, 46.355, 178.28, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27000A [42.845000 46.355000 178.280000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27048, 9686, 0x9B27000A, 42.555, 34.215, 179.53, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Wall Hook */
/* @teleloc 0x9B27000A [42.555000 34.215000 179.530000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27049, 12679, 0x9B27000A, 31.2551, 35.1692, 176.1, 0.368125, 0, 0, -0.929776, False, '2019-02-10 00:00:00'); /* Yard Hook */
/* @teleloc 0x9B27000A [31.255100 35.169200 176.100000] 0.368125 0.000000 0.000000 -0.929776 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2704A, 12679, 0x9B27000A, 26.4851, 35.3292, 176.1, -0.474856, 0, 0, -0.880063, False, '2019-02-10 00:00:00'); /* Yard Hook */
/* @teleloc 0x9B27000A [26.485100 35.329200 176.100000] -0.474856 0.000000 0.000000 -0.880063 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2704B, 12679, 0x9B27000A, 30.4651, 45.8492, 176.1, -0.991783, 0, 0, 0.12793, False, '2019-02-10 00:00:00'); /* Yard Hook */
/* @teleloc 0x9B27000A [30.465100 45.849200 176.100000] -0.991783 0.000000 0.000000 0.127930 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2704C, 12679, 0x9B27000A, 44.8751, 45.3992, 176.1, -0.927184, 0, 0, 0.374606, False, '2019-02-10 00:00:00'); /* Yard Hook */
/* @teleloc 0x9B27000A [44.875100 45.399200 176.100000] -0.927184 0.000000 0.000000 0.374606 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2704D, 12679, 0x9B27000A, 45.4751, 35.2692, 176.1, -0.351025, 0, 0, 0.936366, False, '2019-02-10 00:00:00'); /* Yard Hook */
/* @teleloc 0x9B27000A [45.475100 35.269200 176.100000] -0.351025 0.000000 0.000000 0.936366 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2704E, 12679, 0x9B27000A, 40.9651, 45.3892, 176.1, 0.95656, 0, 0, 0.291537, False, '2019-02-10 00:00:00'); /* Yard Hook */
/* @teleloc 0x9B27000A [40.965100 45.389200 176.100000] 0.956560 0.000000 0.000000 0.291537 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B2704F, 12678, 0x9B27000A, 36.1198, 45.4735, 189.42, 0, 0, 0, -1, False, '2019-02-10 00:00:00'); /* Roof Hook */
/* @teleloc 0x9B27000A [36.119800 45.473500 189.420000] 0.000000 0.000000 0.000000 -1.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x79B27050, 12678, 0x9B27000A, 36.1198, 29.4735, 189.42, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Roof Hook */
/* @teleloc 0x9B27000A [36.119800 29.473500 189.420000] -1.000000 0.000000 0.000000 0.000000 */
|
agpl-3.0
|
AydinSakar/sql-layer
|
src/main/java/com/foundationdb/server/store/statistics/IndexStatisticsVisitor.java
|
4030
|
/**
* Copyright (C) 2009-2013 FoundationDB, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.foundationdb.server.store.statistics;
import com.foundationdb.ais.model.Index;
import com.foundationdb.ais.model.IndexColumn;
import com.foundationdb.server.service.session.Session;
import com.foundationdb.server.service.tree.KeyCreator;
import com.foundationdb.server.store.IndexVisitor;
import com.foundationdb.server.store.Store;
import java.util.ArrayList;
import java.util.List;
public class IndexStatisticsVisitor<K extends Comparable<? super K>, V> extends IndexVisitor<K,V>
{
public interface VisitorCreator<K extends Comparable<? super K>, V> {
IndexStatisticsGenerator<K,V> multiColumnVisitor(Index index);
IndexStatisticsGenerator<K,V> singleColumnVisitor(Session session, IndexColumn indexColumn);
}
public IndexStatisticsVisitor(Session session,
Index index,
long indexRowCount,
long expectedSampleCount,
VisitorCreator<K,V> creator)
{
this.index = index;
this.indexRowCount = indexRowCount;
this.expectedSampleCount = expectedSampleCount;
this.multiColumnVisitor = creator.multiColumnVisitor(index);
this.nIndexColumns = index.getKeyColumns().size();
this.singleColumnVisitors = new ArrayList<>(nIndexColumns-1);
// Single column 0 is handled as leading column of multi-column.
for (int f = 1; f < nIndexColumns; f++) {
singleColumnVisitors.add(
creator.singleColumnVisitor(session, index.getKeyColumns().get(f))
);
}
}
public void init(int bucketCount)
{
multiColumnVisitor.init(bucketCount, expectedSampleCount);
for (int c = 1; c < nIndexColumns; c++) {
singleColumnVisitors.get(c-1).init(bucketCount, expectedSampleCount);
}
}
public void finish(int bucketCount)
{
multiColumnVisitor.finish(bucketCount);
for (int c = 1; c < nIndexColumns; c++) {
singleColumnVisitors.get(c-1).finish(bucketCount);
}
}
protected void visit(K key, V value)
{
multiColumnVisitor.visit(key, value);
for (int c = 1; c < nIndexColumns; c++) {
singleColumnVisitors.get(c-1).visit(key, value);
}
}
public IndexStatistics getIndexStatistics()
{
IndexStatistics indexStatistics = new IndexStatistics(index);
// The multi-column visitor has the sampled row count. The single-column visitors
// have the count of distinct sampled keys for that column.
int sampledCount = multiColumnVisitor.rowCount();
indexStatistics.setRowCount(indexRowCount);
indexStatistics.setSampledCount(sampledCount);
multiColumnVisitor.getIndexStatistics(indexStatistics);
for (int c = 1; c < nIndexColumns; c++) {
singleColumnVisitors.get(c-1).getIndexStatistics(indexStatistics);
}
return indexStatistics;
}
private final Index index;
private final long indexRowCount, expectedSampleCount;
private final IndexStatisticsGenerator<K,V> multiColumnVisitor;
private final List<IndexStatisticsGenerator<K,V>> singleColumnVisitors;
private final int nIndexColumns;
}
|
agpl-3.0
|
kobronson/cs-voltdb
|
src/frontend/org/voltcore/messaging/VoltMessageFactory.java
|
3216
|
/* This file is part of VoltDB.
* Copyright (C) 2008-2013 VoltDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with VoltDB. If not, see <http://www.gnu.org/licenses/>.
*/
package org.voltcore.messaging;
import java.io.IOException;
import java.nio.ByteBuffer;
public class VoltMessageFactory {
// Identify each message
final public static byte AGREEMENT_TASK_ID = 1;
final public static byte BINARY_PAYLOAD_ID = 2;
final public static byte FAILURE_SITE_UPDATE_ID = 3;
final public static byte HEARTBEAT_ID = 4;
final public static byte HEARTBEAT_RESPONSE_ID = 5;
final public static byte RECOVERY_ID = 6;
// DON'T JUST ADD A MESSAGE TYPE WITHOUT READING THIS!
// VoltDbMessageFactory is going to use this to generate non-core message IDs.
// Update the max value if you add a new message type above, or you
// will be sad, and I will have no sympathy. --izzy
final public static byte VOLTCORE_MESSAGE_ID_MAX = 6;
public VoltMessage createMessageFromBuffer(ByteBuffer buffer, long sourceHSId)
throws IOException
{
byte type = buffer.get();
// instantiate a new message instance according to the id
VoltMessage message = instantiate_local(type);
if (message == null)
{
message = instantiate(type);
}
message.m_sourceHSId = sourceHSId;
message.initFromBuffer(buffer.slice().asReadOnlyBuffer());
return message;
}
/**
* Overridden by subclasses to create message types unknown by voltcore
* @param messageType
* @return
*/
protected VoltMessage instantiate_local(byte messageType)
{
return null;
}
private VoltMessage instantiate(byte messageType) {
// instantiate a new message instance according to the id
VoltMessage message = null;
switch (messageType) {
case HEARTBEAT_ID:
message = new HeartbeatMessage();
break;
case HEARTBEAT_RESPONSE_ID:
message = new HeartbeatResponseMessage();
break;
case FAILURE_SITE_UPDATE_ID:
message = new FailureSiteUpdateMessage();
break;
case RECOVERY_ID:
message = new RecoveryMessage();
break;
case AGREEMENT_TASK_ID:
message = new AgreementTaskMessage();
break;
case BINARY_PAYLOAD_ID:
message = new BinaryPayloadMessage();
break;
default:
org.voltdb.VoltDB.crashLocalVoltDB("Unrecognized message type " + messageType, true, null);
}
return message;
}
}
|
agpl-3.0
|
mkresin/miniflux
|
locales/cs_CZ/translations.php
|
14023
|
<?php
return array(
'plural' => function($n) { return (($n==1) ? 0 : (($n>=2 && $n<=4) ? 1 : 2)); },
'attachment' => 'příloha',
'When there is nothing to read, redirect me to this page' => 'Když není nic ke čtení, přesměruj mě na tuto stránku',
'There is nothing new to read, enjoy your favorites articles!' => 'Není tu nic nového ke čtení, užijte si vaše oblíbené články!',
'There is nothing new to read, enjoy your previous readings!' => 'Není tu nic nového ke čtení, užijte si vaše starší články!',
'Immediately' => 'Hned',
'(error occurred during the last check)' => '(během poslední kontroly nastala chyba)',
'The feed id is required' => 'Id zdroje je vyžadováno',
'The title is required' => 'Název je vyžadován',
'The site url is required' => 'URL stránky je vyžadováno',
'The feed url is required' => 'URL zdroje je vyžadováno',
'or' => 'nebo',
'edit' => 'upravit',
'cancel' => 'zrušit',
'Feed URL' => 'URL zdroje',
'Website URL' => 'URL stránky',
'Title' => 'Název',
'Edit subscription' => 'Upravit odběr',
'Unable to edit your subscription.' => 'Nelze upravit váš odběr.',
'Your subscription has been updated.' => 'Váš odběr byl aktualizován',
'Older items first' => 'Nejdřív starší články',
'Most recent first' => 'Nejdřív nejnovější',
'Default sorting order for items' => 'Výchozí pořadí článků',
'This subscription is empty, %sgo back to unread items%s' => 'Tento odběr je prázdný %svrátit se na nepřečtené články%s',
'sort by date %s(%s)%s' => 'řadit podle data %s(%s)%s',
'most recent first' => 'nejdříve nejnovější',
'older first' => 'nejdříve starší',
'Show only this subscription' => 'Zobrazovat pouze tento odběr',
'Go to unread' => 'Jít na nepřečtené',
'Go to bookmarks' => 'Jít na záložky',
'Go to history' => 'Jít na historii',
'Go to subscriptions' => 'Jít na odběry',
'Go to preferences' => 'Jít na nastavení',
'Bookmarklet' => 'Bookmarklet',
'Subscribe with Miniflux' => 'Odebírat Minifluxem',
'Drag and drop this link to your bookmarks' => 'Přetáhněte si tento odkaz mezi záložky',
'Download full content' => 'Stahovat celý obsah',
'Downloading full content is slower because Miniflux grab the content from the original website. You should use that for subscriptions that display only a summary. This feature doesn\'t work with all websites.' => 'Stahování celého obsahu je pomalejší, protože Miniflux získává obsah z původní webové stránky. Měli byste to používat jen pro odběry které zobrazují pouze shrnutí. Tato funkce nefunguje se všemi stránkami.',
'No message' => 'Žádné zprávy',
'flush messages' => 'smazat zprávy',
'API endpoint:' => 'Koncový bod:',
'API username:' => 'Uživatelské jméno:',
'API token:' => 'Heslo:',
'Generate new tokens' => 'Generovat nové heslo',
'Bookmark RSS Feed' => 'RSS záložek',
'updated just now' => 'aktualizováno právě teď',
'checked at' => 'zkontrolováno',
'never updated after creation' => 'nikdy neaktualizováno po vytvoření',
'Subscription disabled' => 'Odběr zakázán',
'content downloaded' => 'obsah stažen',
'in progress...' => 'probíhá…',
'unable to fetch content' => 'nelze stáhnout obsah',
'Download content' => 'Stáhnout obsah',
'download content' => 'stáhnout obsah',
'Help' => 'Nápověda',
'Theme' => 'Vzhled',
'Items per page' => 'Článků na stránku',
'Previous page' => 'Předchozí stránka',
'Next page' => 'Další stránka',
'Do not fetch the content of articles' => 'Nestahovat obsah článků',
'Remove automatically read items' => 'Automaticky odstraňovat přečtené články',
'Never' => 'Nikdy',
'After %d day' => array('Po %d dni', 'Po %d dnech', 'Po %d dnech'),
'unread' => 'nepřečtené',
'Unread' => 'Nepřečtené',
'bookmark' => 'přidat do záložek',
'remove bookmark' => 'odstranit záložku',
'bookmarks' => 'záložky',
'Bookmarks' => 'Záložky',
'Bookmark item' => 'Přidat článek do záložek',
'No bookmark' => 'Žádné záložky',
'history' => 'historie',
'subscriptions' => 'odběry',
'Subscriptions' => 'Odběry',
'preferences' => 'nastavení',
'Preferences' => 'Nastavení',
'logout' => 'odhlásit',
'Username' => 'Přihlašovací jméno',
'Password' => 'Heslo',
'Confirmation' => 'Potvrzení',
'Language' => 'Jazyk',
'Save' => 'Uložit',
'Database size:' => 'Velikost databáze:',
'Optimize the database' => 'Optimalizovat databázi',
'(VACUUM command)' => '(příkaz VACUUM)',
'Download the entire database' => 'Stáhnout celou databázi',
'(Gzip compressed Sqlite file)' => '(Gzipem komprimovaný SQLite soubor)',
'Keyboard shortcuts' => 'Klávesové zkratky',
'Previous item' => 'Předchozí článek',
'Next item' => 'Další článek',
'Mark as read or unread' => 'Označit jako (ne)přečtené',
'Open original link' => 'Otevřít původní odkaz',
'Open item' => 'Otevřít článek',
'About' => 'O aplikaci',
'Miniflux version:' => 'Verze Miniflux:',
'Nothing to read' => 'Nic ke čtení',
'mark all as read' => 'označit vše jako přečtené',
'original link' => 'původní odkaz',
'mark as read' => 'označit jako přečtené',
'No history' => 'Žádná historie',
'mark as unread' => 'označit jako nepřečtené',
'History' => 'Historie',
'flush all items' => 'zahodit všechny články',
'Item not found' => 'Článek nenalezen',
'Next' => 'Další',
'Previous' => 'Předchozí',
'Sign in' => 'Přihlásit',
'feeds' => 'zdroje',
'add' => 'přidat',
'import' => 'importovat',
'export' => 'exportovat',
'OPML Import' => 'Importovat OPML',
'OPML file' => 'OPML soubor',
'Import' => 'Importovat',
'refresh all' => 'aktualizovat vše',
'No subscription' => 'Žádné zdroje',
'remove' => 'odstranit',
'Remove' => 'Odstranit',
'refresh' => 'aktualizovat',
'New subscription' => 'Nový odběr',
'Website or Feed URL' => 'URL stránky nebo zdroje',
'Add' => 'Přidat',
'http://website/' => 'http://webova-stranka/',
'Official website:' => 'Oficiální stránka:',
'Bad username or password' => 'Špatné přihlašovací jméno nebo heslo',
'Unable to update your preferences.' => 'Nelze aktualizovat nastavení.',
'Your preferences are updated.' => 'Nastavení aktualizována.',
'Unable to import your OPML file.' => 'Nelze importovat OPML soubor.',
'Your feeds have been imported.' => 'Zdroje byly importovány.',
'Unable to find a subscription.' => 'Nelze nalézt odběry.',
'Subscription added successfully.' => 'Odběr úspěšně přidán.',
'Your subscriptions are updated' => 'Odběry aktualizovány',
'Unable to remove this subscription.' => 'Nelze odstranit tento odběr.',
'This subscription has been removed successfully.' => 'Tento odběr byl úspěšně odstraněn.',
'The user name is required' => 'Přihlašovací jméno je vyžadováno',
'The maximum length is 50 characters' => 'Maximální délka je 50 znaků',
'The password is required' => 'Heslo je vyžadováno',
'The minimum length is 6 characters' => 'Minimální délka je 6 znaků',
'The confirmation is required' => 'Potvrzení je vyžadováno',
'Passwords don\'t match' => 'Hesla se neshodují',
'Do you really want to remove these items from your history?' => 'Opravdu chcete odstranit tyto články z historie?',
'Do you really want to remove this subscription: "%s"?' => 'Opravdu chcete odstranit tento odběr: "%s"?',
'Nothing to read, do you want to %supdate your subscriptions%s?' => 'Nic ke čtení, chcete %saktualizovat vaše odběry%s?',
'Show help' => 'Zobrazit nápovědu',
'Close help' => 'Zavřít nápovědu',
'%d second ago' => array('před sekundou', 'před %d sekundami', 'před %d sekundami'),
'%d minute ago' => array('před minutou', 'před %d minutami', 'před %d minutami'),
'%d hour ago' => array('před hodinou', 'před %d hodinami', 'před %d hodinami'),
'%d day ago' => array('včera', 'před %d dny', 'před %d dny'),
'%d week ago' => array('minulý týden', 'před %d týdny', 'před %d týdny'),
'%d month ago' => array('před měsícem', 'před %d měsíci', 'před %d měsíci'),
'Timezone' => 'Časová zóna',
'Update all subscriptions' => 'Aktualizovat všechny odběry',
'Auto-Update URL' => 'URL automatické aktualizace',
'Update Miniflux' => 'Aktualizovat Miniflux',
'Miniflux is updated!' => 'Miniflux je aktualizovaný!',
'Unable to update Miniflux, check the console for errors.' => 'Nelze aktualizovat Miniflux, zkontrolujte konzoli na chyby.',
'Don\'t forget to backup your database' => 'Nezapomeňte zálohovat vaši databázi',
'The name must have only alpha-numeric characters' => 'Jméno smí obsahovat pouze písmena a číslice',
'New database' => 'Nová databáze',
'Database name' => 'Jméno databáze',
'Default database' => 'Výchozí databáze',
'Select another database' => 'Vyberte jinou databázi',
'The database name is required' => 'Jméno databáze je vyžadováno',
'Database created successfully.' => 'Databáze úspěšně vytvořena.',
'Unable to create the new database.' => 'Nelze vytvořit novou databázi.',
'Add a new database (new user)' => 'Přidat novou databázi (nového uživatele)',
'Create' => 'Vytvořit',
'Unknown' => 'Neznámý',
'Remember Me' => 'Zapamatovat si mě',
'Display items on lists' => 'Zobrazovat články na seznamech',
'Summaries' => 'Shrnutí',
'Full contents' => 'Celý obsah',
'Force RTL mode (Right-to-left language)' => 'Vynutit režim zprava doleva',
'Activated' => 'Aktivováno',
'Remove this feed' => 'Odstranit tento zdroj',
'Miniflux' => 'Miniflux',
'mini%sflux%s' => 'mini%sflux%s',
'All' => 'Vše',
'Advanced' => 'Pokročilé',
'Documentation' => 'dokumentace',
'Installation instructions' => 'Instalační instrukce',
'Upgrade to a new version' => 'Aktualizovat na novou verzi',
'Cronjob' => 'Cronjob',
'Advanced configuration' => 'Pokročilá nastavení',
'Full article download' => 'stahování celého článku',
'Multiple users' => 'Více uživatelů',
'Themes' => 'Témata',
'Json-RPC API' => 'Json-RPC API',
'Fever API' => 'Fever API',
'Translations' => 'Překlady',
'Run Miniflux with Docker' => 'Spouštět Miniflux s Dockerem',
'FAQ' => 'ČKD',
'settings' => 'nastavení',
'help' => 'nápověda',
'api' => 'api',
'about' => 'o',
'This action will update Miniflux with the last development version, are you sure?' => 'Tato akce aktualizuje Miniflux na poslední vývojovou verzi. Jste si jistí?',
'database' => 'databáze',
'Console' => 'konzole',
'Miniflux API' => 'Miniflux API',
'menu' => 'nabídka',
'Default' => 'Výchozí',
'Value required' => 'Hodnota vyžadována',
'Must be an integer' => 'Musí být celé číslo',
'Remove automatically unread items' => 'Automaticky odstraňovat nepřečtené články',
'Toggle RTL mode' => 'Přepnout režim zprava doleva',
'external services' => 'externí služby',
'Send bookmarks to Pinboard' => 'Posílat záložky na Pinboard',
'Pinboard API token' => 'Pinboard API token',
'Pinboard tags' => 'Pinboard štítky',
'Instapaper username' => 'Instapaper uživatelské jméno',
'Instapaper password' => 'Instapaper heslo',
'Instapaper' => 'Instapaper',
'Pinboard' => 'Pinboard',
'Send bookmarks to Instapaper' => 'Posílat záložky na Instapaper',
'Authentication' => 'Autentikace',
'Reading' => 'Čtení',
'Application' => 'Aplikace',
'Enable image proxy' => 'Povolit proxy obrázků',
'Avoid mixed content warnings with HTTPS' => 'Vyhne se varování o pomíchaném obsahu s HTTPS',
'Download favicons' => 'Stahovat favicony',
'general' => 'základní',
'An error occurred during the last check. Refresh the feed manually and check the %sconsole%s for errors afterwards!' => 'Nastala chyba při poslední kontrole. Obnovte zdroj ručně a poté zkontrolujte %skonzoli%s na chyby!',
'Refresh interval in minutes for unread counter' => 'Obnovovací interval v minutách pro počítadlo nepřečtených',
'Nothing to show. Enable the debug mode to see log messages.' => 'Není co ukázat. Povolte ladící režim pro zobrazení záznamů.',
'Enable debug mode' => 'Povolit ladící režim',
'Original link marks article as read' => 'Původní odkaz označí článek za přečtený',
'Cloak the image referrer' => 'Zamaskovat původce obrázků',
'This subscription already exists.' => 'Tento odběr již existuje.',
'Connection timeout.' => 'Vypršel časový limit spojení.',
'Error occured.' => 'Nastala chyba.',
'Feed is malformed.' => 'Odběr má špatný formát.',
'Invalid SSL certificate.' => 'Neplatný SSL certifikát.',
'Maximum number of HTTP redirections exceeded.' => 'Maximální počet HTTP přesměrování překročen.',
'The content size exceeds to maximum allowed size.' => 'Velikost obsahu překročila maximální povolenou velikost.',
'Unable to detect the feed format.' => 'Nelze detekovat formát odběru.',
'add a new group' => 'přidat novou skupinu',
'Groups' => 'Skupiny',
'Back to the group' => 'Zpět do skupiny',
'view' => 'zobrazit',
'Item title links to' => 'Titulek článku odkazuje na',
'Original' => 'Originál',
'Last login:' => 'Poslední přihlášení:',
'Search' => 'Hledat',
'There are no results for your search' => 'Žádné výsledky vašeho hledání',
);
|
agpl-3.0
|
Tatwi/legend-of-hondo
|
MMOCoreORB/bin/scripts/mobile/dathomir/rhoa_kwi_pack_leader.lua
|
967
|
rhoa_kwi_pack_leader = Creature:new {
objectName = "@mob/creature_names:rhoa_kwi_pack_leader",
socialGroup = "kwi",
faction = "",
level = 50,
chanceHit = 0.47,
damageMin = 380,
damageMax = 470,
baseXp = 4916,
baseHAM = 9900,
baseHAMmax = 12100,
armor = 1,
resists = {135,165,0,160,0,0,0,0,-1},
meatType = "meat_carnivore",
meatAmount = 120,
hideType = "hide_leathery",
hideAmount = 86,
boneType = "bone_mammal",
boneAmount = 76,
milk = 0,
tamingChance = 0.1,
ferocity = 6,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK + KILLER + STALKER,
optionsBitmask = AIENABLED,
diet = CARNIVORE,
templates = {"object/mobile/kwi_hue.iff"},
controlDeviceTemplate = "object/intangible/pet/kwi_hue.iff",
scale = 1.3,
lootGroups = {},
weapons = {},
conversationTemplate = "",
attacks = {
{"posturedownattack",""},
{"dizzyattack",""}
}
}
CreatureTemplates:addCreatureTemplate(rhoa_kwi_pack_leader, "rhoa_kwi_pack_leader")
|
agpl-3.0
|
overview/overview-server
|
web/app/models/archive/ZipArchive.scala
|
9260
|
package models.archive
import akka.stream.scaladsl.{Sink,Source}
import akka.stream.Materializer
import akka.util.ByteString
import java.nio.{ByteBuffer,ByteOrder}
import java.util.HashSet
import java.util.zip.CRC32
import scala.collection.immutable
import scala.collection.mutable
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.{Future,Promise}
import models.ArchiveEntry
import controllers.backend.ArchiveEntryBackend // TODO rename controllers.backend => models.backend
/** All the information you need to produce a zipfile.
*/
class ZipArchive(
documentSetId: Long,
archiveEntriesWithDuplicates: Seq[ArchiveEntry],
backend: ArchiveEntryBackend
) {
// Constants and format from https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
private val CentralDirectoryHeaderSize: Int = 46
private val EndOfCentralDirectorySize: Int = 22
private val LocalFileHeaderSize: Int = 30
private val NoCompression: Short = 0
private val LocalFileEntrySignature: Int = 0x04034b50
private val CentralFileHeaderSignature: Int = 0x02014b50
private val EndOfCentralDirectoryRecordSignature: Int = 0x06054b50
private val VersionMadeByUnix: Short = 3
private val VersionNeededToExtract: Short = 45 // 4.5 ... we use no encryption/compression, but we haven't tested on old zip versions
private val Flags: Short = 0x0800 // "use UTF-8"
private val ExternalFileAttributes: Int = 0x81800000 // unix: "-rw-------"
/** Uniquely-named archive entries.
*
* We don't have a use case for duplicate-named entries. The simplest
* (fastest) implementation removes duplicates: that way we don't need to
* rename files, so we know how many bytes each filename will contain, so we
* can calculate the entire size of the output zipfile with minimal math.
*/
val archiveEntries: immutable.Seq[ArchiveEntry] = {
// Use WrappedArray[Byte] instead of Array[Byte] so hashCode() will work.
// Use Java HashSet because it lets us set initial capacity. 0.75 is the HashMap default load factor.
val usedFilenamesUtf8 = new HashSet[mutable.WrappedArray[Byte]](
(archiveEntriesWithDuplicates.length.toFloat / 0.75).toInt,
1
)
archiveEntriesWithDuplicates
.filter(e => usedFilenamesUtf8.add(e.filenameUtf8)) // clever: Set.add() returns false on dup
.to[immutable.Seq]
}
val size: Long = {
var ret: Long = EndOfCentralDirectorySize + archiveEntries.length * (CentralDirectoryHeaderSize + LocalFileHeaderSize)
for (entry <- archiveEntries) {
ret += 2 * entry.filenameUtf8.length + entry.nBytes
}
ret
}
/** CRCs of all files we've streamed.
*
* We calculate CRCs as we stream files individual files. Then we emit the
* Central Directory, which includes them all a second time.
*/
private val crcs = new mutable.ArrayBuffer[Int](archiveEntries.length)
// https://github.com/akka/akka/issues/18683
// https://github.com/akka/akka/issues/23044
// streamCentralDirectory() depends on crcs being full. And by the time
// we're streaming the central directory into our output, they are. But
// Akka's "Stream.concat" erroneously fetches the first element before
// realizing it's supposed to wait -- even with Source.lazily().
//
// Our workaround: use a Stream.future() to block the first fetch until after
// the CRCs are all calculated.
private val crcsAllCalculated = Promise[Unit]()
private val timestamp = DosDate.now
def stream()(implicit mat: Materializer): Source[ByteString, akka.NotUsed] = {
streamLocalFiles
.concat(streamCentralDirectory)
.concat(endOfCentralDirectory)
}
private def streamLocalFiles()(implicit mat: Materializer): Source[ByteString, akka.NotUsed] = {
Source(archiveEntries)
.flatMapConcat(streamLocalFile _)
}
/** Stream an ArchiveEntry, and set this.crcs(archiveEntry.documentId) as a
* side-effect.
*/
private def streamLocalFile(archiveEntry: ArchiveEntry)(implicit mat: Materializer): Source[ByteString, akka.NotUsed] = {
val future = for {
crc <- computeCrc(archiveEntry)
} yield {
crcs.+=(crc)
if (crcs.length == archiveEntries.length) {
crcsAllCalculated.success(())
}
val headerBytes = ByteString(localFileHeader(archiveEntry, crc))
Source.single(headerBytes)
.concat(backend.streamBytes(documentSetId, archiveEntry.documentId))
}
Source.futureSource(future).mapMaterializedValue( _ => akka.NotUsed)
}
private def localFileHeader(archiveEntry: ArchiveEntry, crc: Int): Array[Byte] = {
val buf = ByteBuffer
.allocate(LocalFileHeaderSize + archiveEntry.filenameUtf8.length)
.order(ByteOrder.LITTLE_ENDIAN)
assert(archiveEntry.nBytes.toInt.toLong == archiveEntry.nBytes) // TODO use Zip64
// 4.3.7 Local file header
buf
.putInt(LocalFileEntrySignature)
.putShort(VersionNeededToExtract)
.putShort(Flags)
.putShort(NoCompression)
.putShort(timestamp.time)
.putShort(timestamp.date)
.putInt(crc)
.putInt(archiveEntry.nBytes.toInt) // compressed size
.putInt(archiveEntry.nBytes.toInt) // uncompressed size
.putShort(archiveEntry.filenameUtf8.length.toShort)
.putShort(0)
.put(archiveEntry.filenameUtf8)
assert(buf.position == buf.limit)
buf.array
}
private def streamCentralDirectory: Source[ByteString, akka.NotUsed] = {
val futureSource = crcsAllCalculated.future.map(_ => streamCentralDirectoryFileHeaders)
Source.futureSource(futureSource).mapMaterializedValue(_ => akka.NotUsed)
}
private def streamCentralDirectoryFileHeaders: Source[ByteString, akka.NotUsed] = {
// Iterate in the same order as we streamed the files, so we can write all
// the offsets.
val startIterator = archiveEntries.iterator
Source.unfold((startIterator, 0, 0)) { case (iterator: Iterator[ArchiveEntry], curOffset: Int, entryIndex: Int) =>
if (iterator.hasNext) {
val archiveEntry = iterator.next
val localFileSize = LocalFileHeaderSize + archiveEntry.filenameUtf8.length + archiveEntry.nBytes
val bytes = ByteString(centralDirectoryFileHeader(archiveEntry, curOffset, entryIndex))
Some(((iterator, curOffset + localFileSize.toInt, entryIndex + 1), bytes))
} else {
None
}
}
}
private def centralDirectoryFileHeader(archiveEntry: ArchiveEntry, localFileOffset: Int, entryIndex: Int): Array[Byte] = {
val buf = ByteBuffer
.allocate(CentralDirectoryHeaderSize + archiveEntry.filenameUtf8.length)
.order(ByteOrder.LITTLE_ENDIAN)
// 4.3.12 Central directory structure
buf
.putInt(CentralFileHeaderSignature)
.putShort(VersionMadeByUnix)
.putShort(VersionNeededToExtract)
.putShort(Flags)
.putShort(NoCompression)
.putShort(timestamp.time)
.putShort(timestamp.date)
.putInt(crcs(entryIndex))
.putInt(archiveEntry.nBytes.toInt) // compressed size
.putInt(archiveEntry.nBytes.toInt) // uncompressed size
.putShort(archiveEntry.filenameUtf8.length.toShort)
.putShort(0) // extra field length
.putShort(0) // file comment length
.putShort(0) // disk number
.putShort(0) // internal file attributes
.putInt(ExternalFileAttributes)
.putInt(localFileOffset)
.put(archiveEntry.filenameUtf8)
assert(buf.position == buf.limit)
buf.array
}
private def endOfCentralDirectory: Source[ByteString, akka.NotUsed] = {
val buf = ByteBuffer.allocate(EndOfCentralDirectorySize).order(ByteOrder.LITTLE_ENDIAN)
var centralDirectoryStart: Int = archiveEntries.length * LocalFileHeaderSize
var centralDirectorySize: Int = archiveEntries.length * CentralDirectoryHeaderSize
for (entry <- archiveEntries) {
centralDirectoryStart += entry.filenameUtf8.length + entry.nBytes.toInt
centralDirectorySize += entry.filenameUtf8.length
}
// 4.3.16 End of central directory record
buf
.putInt(EndOfCentralDirectoryRecordSignature)
.putShort(0) // disk number
.putShort(0) // disk number of start of central directory
.putShort(archiveEntries.length.toShort) // number of entries in central directory on this disk
.putShort(archiveEntries.length.toShort) // number of entries in central directory
.putInt(centralDirectorySize)
.putInt(centralDirectoryStart)
.putShort(0) // comment size
assert(buf.position == buf.limit)
Source.single(ByteString(buf.array))
}
/** Compute the CRC of an ArchiveEntry.
*
* TODO cache smaller documents, so we don't stream them twice. (We already
* know the size from archiveEntry.) Or find some other way to avoid writing
* the CRC32 before the file contents (cross-platform).
*/
private def computeCrc(archiveEntry: ArchiveEntry)(implicit mat: Materializer): Future[Int] = {
val crc32 = new CRC32()
val source: Source[ByteString, _] = backend.streamBytes(documentSetId, archiveEntry.documentId)
val sink = Sink.foreach { (bytes: ByteString) => crc32.update(bytes.toArray) }
for {
_ <- source.runWith(sink)(mat)
} yield crc32.getValue.toInt
}
}
|
agpl-3.0
|
Ramkavanan/SHCRM
|
app/protected/modules/approvalProcess/views/ApprovalProcessForMixedModelsSearchListView.php
|
4693
|
<?php
/*********************************************************************************
* Zurmo is a customer relationship management program developed by
* Zurmo, Inc. Copyright (C) 2015 Zurmo Inc.
*
* Zurmo is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY ZURMO, ZURMO DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* Zurmo is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact Zurmo, Inc. with a mailing address at 27 North Wacker Drive
* Suite 370 Chicago, IL 60606. or at email address contact@zurmo.com.
*
* The interactive user interfaces in original and modified versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the Zurmo
* logo and Zurmo copyright notice. If the display of the logo is not reasonably
* feasible for technical reasons, the Appropriate Legal Notices must display the words
* "Copyright Zurmo Inc. 2015. All rights reserved".
********************************************************************************/
class ApprovalProcessForMixedModelsSearchListView extends SecuredListView
{
public static function getDefaultMetadata()
{
$metadata = array(
'global' => array(
'panels' => array(
array(
'rows' => array(
array('cells' =>
array(
array(
'elements' => array(
array('attributeName' => 'name', 'type' => 'Text', 'isLink' => true),
),
),
)
),
array('cells' =>
array(
array(
'elements' => array(
array('attributeName' => 'opportunity', 'type' => 'Opportunity', 'isLink' => true),
),
),
)
),
array('cells' =>
array(
array(
'elements' => array(
array('attributeName' => 'assignedto', 'type' => 'User', 'isLink' => true ),
),
),
)
),
array('cells' =>
array(
array(
'elements' => array(
array('attributeName' => 'comments', 'type' => 'TextArea'),
),
),
)
),
),
),
),
),
);
return $metadata;
}
public static function getDesignerRulesType()
{
return 'ForMixedModelsSearchListView';
}
}
?>
|
agpl-3.0
|
alishahpakneeds/akbarsugarcrm
|
cache/smarty/templates_c/%%95^955^955CF478%%header.tpl.php
|
6701
|
<?php /* Smarty version 2.6.11, created on 2014-09-27 03:20:43
compiled from include/EditView/header.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'sugar_button', 'include/EditView/header.tpl', 81, false),array('function', 'sugar_action_menu', 'include/EditView/header.tpl', 91, false),)), $this); ?>
{*
/*********************************************************************************
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
*}
<script>
{literal}
$(document).ready(function(){
$("ul.clickMenu").each(function(index, node){
$(node).sugarActionMenu();
});
});
{/literal}
</script>
<div class="clear"></div>
<form action="index.php" method="POST" name="{$form_name}" id="{$form_id}" {$enctype}>
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dcQuickEdit">
<tr>
<td class="buttons">
<input type="hidden" name="module" value="{$module}">
{if isset($smarty.request.isDuplicate) && $smarty.request.isDuplicate eq "true"}
<input type="hidden" name="record" value="">
<input type="hidden" name="duplicateSave" value="true">
<input type="hidden" name="duplicateId" value="{$fields.id.value}">
{else}
<input type="hidden" name="record" value="{$fields.id.value}">
{/if}
<input type="hidden" name="isDuplicate" value="false">
<input type="hidden" name="action">
<input type="hidden" name="return_module" value="{$smarty.request.return_module}">
<input type="hidden" name="return_action" value="{$smarty.request.return_action}">
<input type="hidden" name="return_id" value="{$smarty.request.return_id}">
<input type="hidden" name="module_tab">
<input type="hidden" name="contact_role">
{if (!empty($smarty.request.return_module) || !empty($smarty.request.relate_to)) && !(isset($smarty.request.isDuplicate) && $smarty.request.isDuplicate eq "true")}
<input type="hidden" name="relate_to" value="{if $smarty.request.return_relationship}{$smarty.request.return_relationship}{elseif $smarty.request.relate_to && empty($smarty.request.from_dcmenu)}{$smarty.request.relate_to}{elseif empty($isDCForm) && empty($smarty.request.from_dcmenu)}{$smarty.request.return_module}{/if}">
<input type="hidden" name="relate_id" value="{$smarty.request.return_id}">
{/if}
<input type="hidden" name="offset" value="{$offset}">
{assign var='place' value="_HEADER"} <!-- to be used for id for buttons with custom code in def files-->
<?php if (isset ( $this->_tpl_vars['form']['hidden'] )): $_from = $this->_tpl_vars['form']['hidden']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
foreach ($_from as $this->_tpl_vars['field']):
echo $this->_tpl_vars['field']; ?>
<?php endforeach; endif; unset($_from); endif; if (empty ( $this->_tpl_vars['form']['button_location'] ) || $this->_tpl_vars['form']['button_location'] == 'top'): if (! empty ( $this->_tpl_vars['form'] ) && ! empty ( $this->_tpl_vars['form']['buttons'] )): ?>
<?php $_from = $this->_tpl_vars['form']['buttons']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
foreach ($_from as $this->_tpl_vars['val'] => $this->_tpl_vars['button']):
?>
<?php echo smarty_function_sugar_button(array('module' => ($this->_tpl_vars['module']),'id' => ($this->_tpl_vars['button']),'form_id' => ($this->_tpl_vars['form_id']),'view' => ($this->_tpl_vars['view']),'appendTo' => 'header_buttons','location' => 'HEADER'), $this);?>
<?php endforeach; endif; unset($_from); else: echo smarty_function_sugar_button(array('module' => ($this->_tpl_vars['module']),'id' => 'SAVE','view' => ($this->_tpl_vars['view']),'form_id' => ($this->_tpl_vars['form_id']),'location' => 'HEADER','appendTo' => 'header_buttons'), $this);?>
<?php echo smarty_function_sugar_button(array('module' => ($this->_tpl_vars['module']),'id' => 'CANCEL','view' => ($this->_tpl_vars['view']),'form_id' => ($this->_tpl_vars['form_id']),'location' => 'HEADER','appendTo' => 'header_buttons'), $this);?>
<?php endif; if (empty ( $this->_tpl_vars['form']['hideAudit'] ) || ! $this->_tpl_vars['form']['hideAudit']): echo smarty_function_sugar_button(array('module' => ($this->_tpl_vars['module']),'id' => 'Audit','view' => ($this->_tpl_vars['view']),'form_id' => ($this->_tpl_vars['form_id']),'appendTo' => 'header_buttons'), $this);?>
<?php endif; endif; echo smarty_function_sugar_action_menu(array('buttons' => $this->_tpl_vars['header_buttons'],'class' => 'fancymenu','flat' => true), $this);?>
</td>
<td align='right'><?php echo $this->_tpl_vars['ADMIN_EDIT']; ?>
<?php if ($this->_tpl_vars['panelCount'] == 0): ?>
<?php if ($this->_tpl_vars['SHOW_VCR_CONTROL']): ?>
{$PAGINATION}
<?php endif; endif; ?>
</td>
</tr>
</table>
|
agpl-3.0
|
nextframework/next
|
Validation/HTTP/Headers/Raw.php
|
1530
|
<?php
/**
* HTTP Raw Header Field Validator Class | Validation\HTTP\Headers\Raw.php
*
* @author Bruno Augusto
*
* @copyright Copyright (c) 2017 Next Studios
* @license http://www.gnu.org/licenses/agpl-3.0.txt GNU Affero General Public License 3.0
*/
namespace Next\Validation\HTTP\Headers;
use Next\Components\Object; # Object Class
/**
* The Raw Header Validator checks if input string if valid to be used as
* unfiltered — thus "raw" — Header Field
*
* Because they must be manually — and carefully — set, the only concerns
* we take care of is for the value not to be NULL, otherwise this would
* result in an empty string when being used and for the string to not
* have a colon (:) which is what usually separates a Header Field name
* from its value
*
* If a Raw Header must be sent with a Name, then it's not Raw, it's Generic ;)
*
* @package Next\Validation
*
* @uses Next\Components\Object
* Next\Validation\HTTP\Headers\Header
*/
class Raw extends Object implements Header {
/**
* Parameter Options Definition
*
* @var array $parameters
*/
protected $parameters = [
'value' => [ 'required' => TRUE ]
];
/**
* Validates Generic Header Field
*
* @return boolean
* TRUE if valid and FALSE otherwise
*/
public function validate() : bool {
return ( $this -> options -> value !== NULL &&
strpos( $this -> options -> value, ':' ) === FALSE );
}
}
|
agpl-3.0
|
SoftNext/secondp
|
cache/smarty/templates_c/%%E2^E2E^E2EE98C0%%SearchFormHeader.tpl.php
|
2421
|
<?php /* Smarty version 2.6.11, created on 2014-11-06 21:16:36
compiled from cache/modules/Leads/SearchFormHeader.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('function', 'sugar_getjspath', 'cache/modules/Leads/SearchFormHeader.tpl', 4, false),)), $this); ?>
<div class="clear"></div>
<div class='listViewBody'>
<script type="text/javascript" src="<?php echo smarty_function_sugar_getjspath(array('file' => 'include/javascript/popup_parent_helper.js'), $this);?>
"></script>
<?php echo $this->_tpl_vars['TABS']; ?>
<?php echo '
<script>
function submitOnEnter(e)
{
var characterCode = (e && e.which) ? e.which : event.keyCode;
if (characterCode == 13) {
document.getElementById(\'search_form\').submit();
return false;
} else {
return true;
}
}
</script>
'; ?>
<form name='search_form' id='search_form' class='search_form' method='post' action='index.php?module=<?php echo $this->_tpl_vars['module']; ?>
&action=<?php echo $this->_tpl_vars['action']; ?>
' onkeydown='submitOnEnter(event);'>
<input type='hidden' name='searchFormTab' value='<?php echo $this->_tpl_vars['displayView']; ?>
'/>
<input type='hidden' name='module' value='<?php echo $this->_tpl_vars['module']; ?>
'/>
<input type='hidden' name='action' value='<?php echo $this->_tpl_vars['action']; ?>
'/>
<input type='hidden' name='query' value='true'/>
<?php $_from = $this->_tpl_vars['TAB_ARRAY']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['tabIteration'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['tabIteration']['total'] > 0):
foreach ($_from as $this->_tpl_vars['tabkey'] => $this->_tpl_vars['tabData']):
$this->_foreach['tabIteration']['iteration']++;
?>
<div id='<?php echo $this->_tpl_vars['module']; echo $this->_tpl_vars['tabData']['name']; ?>
_searchSearchForm' style='<?php echo $this->_tpl_vars['tabData']['displayDiv']; ?>
' class="edit view search <?php echo $this->_tpl_vars['tabData']['name']; ?>
"><?php if ($this->_tpl_vars['tabData']['displayDiv']): else: echo $this->_tpl_vars['return_txt']; endif; ?></div>
<?php endforeach; endif; unset($_from); ?>
<div id='<?php echo $this->_tpl_vars['module']; ?>
saved_viewsSearchForm' style='display: none;'><?php echo $this->_tpl_vars['saved_views_txt']; ?>
</div>
|
agpl-3.0
|
LtRipley36706/ACE-World
|
Database/3-Core/9 WeenieDefaults/SQL/House/Cottage/12957 Cottage.sql
|
2089
|
DELETE FROM `weenie` WHERE `class_Id` = 12957;
INSERT INTO `weenie` (`class_Id`, `class_Name`, `type`, `last_Modified`)
VALUES (12957, 'housecottage1333', 53, '2019-02-10 00:00:00') /* House */;
INSERT INTO `weenie_properties_int` (`object_Id`, `type`, `value`)
VALUES (12957, 1, 128) /* ItemType - Misc */
, (12957, 5, 10) /* EncumbranceVal */
, (12957, 16, 1) /* ItemUseable - No */
, (12957, 93, 52) /* PhysicsState - Ethereal, IgnoreCollisions, NoDraw */
, (12957, 155, 1) /* HouseType - Cottage */
, (12957, 8041, 101) /* PCAPRecordedPlacement - Resting */;
INSERT INTO `weenie_properties_bool` (`object_Id`, `type`, `value`)
VALUES (12957, 1, True ) /* Stuck */
, (12957, 24, True ) /* UiHidden */;
INSERT INTO `weenie_properties_float` (`object_Id`, `type`, `value`)
VALUES (12957, 39, 0.1) /* DefaultScale */;
INSERT INTO `weenie_properties_string` (`object_Id`, `type`, `value`)
VALUES (12957, 1, 'Cottage') /* Name */;
INSERT INTO `weenie_properties_d_i_d` (`object_Id`, `type`, `value`)
VALUES (12957, 1, 33557058) /* Setup */
, (12957, 8, 100671873) /* Icon */
, (12957, 30, 152) /* PhysicsScript - RestrictionEffectBlue */
, (12957, 8001, 203423760) /* PCAPRecordedWeenieHeader - Usable, Burden, HouseRestrictions, PScript */
, (12957, 8003, 148) /* PCAPRecordedObjectDesc - Stuck, Attackable, UiHidden */
, (12957, 8005, 163969) /* PCAPRecordedPhysicsDesc - CSetup, ObjScale, Position, AnimationFrame */;
INSERT INTO `weenie_properties_position` (`object_Id`, `position_Type`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`)
VALUES (12957, 8040, 3664445700, 38.3152, 32.1644, 29.9995, -0.9201798, 0, 0, -0.3914959) /* PCAPRecordedLocation */
/* @teleloc 0xDA6B0104 [38.315200 32.164400 29.999500] -0.920180 0.000000 0.000000 -0.391496 */;
INSERT INTO `weenie_properties_i_i_d` (`object_Id`, `type`, `value`)
VALUES (12957, 8000, 2108076448) /* PCAPRecordedObjectIID */;
|
agpl-3.0
|
lavenliu/linuxc
|
my/cdk-5.0-20160131/Makefile
|
15905
|
# $Id: Makefile.in,v 1.123 2015/09/28 23:37:35 tom Exp $
#
# Copyright 2001-2014,2015 Thomas E. Dickey
# Copyright 1999, Mike Glover
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgment:
# This product includes software developed by Mike Glover
# and contributors.
# 4. Neither the name of Mike Glover, nor the names of contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY MIKE GLOVER AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL MIKE GLOVER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
SHELL = /bin/sh
MAKE_RECUR = prefix=$(prefix)
PACKAGE = cdk
CFG_ROOTNAME = cdk
HDR_ROOTNAME = cdk
LIB_ROOTNAME = cdk
LIB_PREFIX = lib
LIB_SUFFIX = .a
VERSION_MAJOR = 5
VERSION_MINOR = 0
VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
REL_VERSION = 5.0
ABI_VERSION = 6.0.4
RESULTING_SYMS =
VERSIONED_SYMS =
# begin CF__DEFINE_SHLIB_VARS
LIB_BASENAME = ${LIB_PREFIX}${LIB_ROOTNAME}${LIB_SUFFIX}
LIB_REL_NAME = ${LIB_BASENAME}.${REL_VERSION}
LIB_ABI_NAME = ${LIB_BASENAME}.${ABI_VERSION}
LIB_TARGET = ${LIB_BASENAME}
RM_SHARED_OPTS =
# end CF__DEFINE_SHLIB_VARS
CDKLIB = ${LIB_BASENAME}
IMPORT_LIB = lib$(LIB_ROOTNAME).dll.a
OLD_SHLIB_LINK = lib$(LIB_ROOTNAME).so
OLD_SONAME = $(OLD_SHLIB_LINK).$(VERSION_MAJOR)
OLD_SHLIB_FILE = $(OLD_SONAME).$(VERSION_MINOR)
prefix = /usr/local
exec_prefix = ${prefix}
top_srcdir = .
srcdir = .
x =
o = .o
a = $(LIB_SUFFIX)
DESTDIR =
bindir = ${exec_prefix}/bin
includedir = ${prefix}/include
libdir = ${exec_prefix}/lib
shlibdir = ${exec_prefix}/lib
datarootdir = ${prefix}/share
datadir = ${datarootdir}
mandir = ${datarootdir}/man
DOCUMENT_DIR = $(DESTDIR)$(datadir)/doc/$(PACKAGE)
BIN_DIR = $(DESTDIR)$(bindir)
INCLUDE_DIR = $(DESTDIR)$(includedir)
INCLUDE_SUBDIR = $(DESTDIR)$(includedir)/$(HDR_ROOTNAME)
SHLIB_DIR = $(DESTDIR)$(shlibdir)
LIB_DIR = $(DESTDIR)$(libdir)
MAN_DIR = $(DESTDIR)$(mandir)/man3
MANSECT = 3
CC = gcc
CPP = gcc -E
AR = ar
RANLIB = ranlib
RM = rm -f
LN_S = ln -s -f
CTAGS = ctags
ETAGS = etags
LINT =
LINT_OPTS =
LIBS = -lncurses
CFLAGS = -g -O2
CPPFLAGS = -DHAVE_CONFIG_H -I./include -I$(srcdir)/include -D_GNU_SOURCE
LDFLAGS = -L/lib64
RPATH_LIST =
LIBTOOL =
LIBTOOL_OPTS =
LIBTOOL_CLEAN =
LIBTOOL_COMPILE =
LIBTOOL_CREATE = ${AR} -cr $@ $(EXTRA_LDFLAGS)
LIBTOOL_LINK = ${CC}
LIBTOOL_INSTALL =
LIBTOOL_UNINSTALL =
LIBTOOL_VERSION = -version-number
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = $(LIBTOOL_INSTALL) ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_LIB = $(LIBTOOL_INSTALL) $(INSTALL_DATA)
UNINSTALL_LIB = $(LIBTOOL_UNINSTALL) $(RM)
.SUFFIXES: .c .o .lo .os .i
default :: $(CDKLIB)
#
# Create the file lists.
#
AUTO_HDR = \
include/dscale.h \
include/fscale.h \
include/fslider.h \
include/scale.h \
include/slider.h \
include/uscale.h \
include/uslider.h
AUTO_SRC = \
dscale.c \
fscale.c \
fslider.c \
scale.c \
slider.c \
uscale.c \
uslider.c
AUTO_MAN = \
man/cdk_dscale.3 \
man/cdk_fscale.3 \
man/cdk_fslider.3 \
man/cdk_scale.3 \
man/cdk_slider.3 \
man/cdk_uscale.3 \
man/cdk_uslider.3
MY_HDR = \
include/cdk_config.h \
$(AUTO_HDR)
CDKHDR = \
alphalist.h \
binding.h \
button.h \
buttonbox.h \
calendar.h \
cdk.h \
cdk_compat.h \
cdk_objs.h \
cdk_params.h \
cdk_test.h \
cdk_util.h \
cdk_version.h \
cdkscreen.h \
curdefs.h \
dialog.h \
draw.h \
entry.h \
fselect.h \
graph.h \
histogram.h \
itemlist.h \
label.h \
marquee.h \
matrix.h \
mentry.h \
menu.h \
radio.h \
scroll.h \
scroller.h \
selection.h \
swindow.h \
template.h \
traverse.h \
viewer.h
CDKSRC = \
$(AUTO_SRC) \
alphalist.c \
binding.c \
button.c \
buttonbox.c \
calendar.c \
cdk.c \
cdk_compat.c \
cdk_display.c \
cdk_objs.c \
cdk_params.c \
cdkscreen.c \
debug.c \
dialog.c \
draw.c \
entry.c \
fselect.c \
get_index.c \
get_string.c \
graph.c \
histogram.c \
itemlist.c \
label.c \
marquee.c \
matrix.c \
mentry.c \
menu.c \
popup_dialog.c \
popup_label.c \
position.c \
radio.c \
scroll.c \
scroller.c \
selection.c \
swindow.c \
select_file.c \
template.c \
traverse.c \
version.c \
view_file.c \
view_info.c \
viewer.c
CDKMAN = \
cdk.3 \
cdk_alphalist.3 \
cdk_binding.3 \
cdk_button.3 \
cdk_buttonbox.3 \
cdk_calendar.3 \
cdk_compat.3 \
cdk_dialog.3 \
cdk_display.3 \
cdk_draw.3 \
cdk_entry.3 \
cdk_fscale.3 \
cdk_fselect.3 \
cdk_graph.3 \
cdk_histogram.3 \
cdk_itemlist.3 \
cdk_label.3 \
cdk_marquee.3 \
cdk_matrix.3 \
cdk_mentry.3 \
cdk_menu.3 \
cdk_misc.3 \
cdk_objs.3 \
cdk_params.3 \
cdk_position.3 \
cdk_process.3 \
cdk_radio.3 \
cdk_scale.3 \
cdk_screen.3 \
cdk_scroll.3 \
cdk_selection.3 \
cdk_swindow.3 \
cdk_template.3 \
cdk_traverse.3 \
cdk_util.3 \
cdk_viewer.3
CDKREADME = EXPANDING NOTES TODO COPYING INSTALL README
OBJECTS = $(CDKSRC:.c=.o)
CDKSHOBJS = $(CDKSRC:.c=.os)
LIB_OBJECT = ${OBJECTS}
all sources :: $(AUTO_SRC)
$(OBJECTS) : include/cdk_config.h
#
# Standard library directive.
#
all cdklib :: $(CDKLIB)
cdkshlib $(OLD_SHLIB_FILE) :: $(CDKSHOBJS)
gcc -shared -Wl,-soname=$(OLD_SONAME) $(LDFLAGS) $(LIBS) -o $(OLD_SHLIB_FILE) $(CDKSHOBJS)
#
# Make the examples directory.
#
all examples ::
cd examples && $(MAKE) $(MAKE_RECUR)
#
# Make the demos directory.
#
all demos ::
cd demos && $(MAKE) $(MAKE_RECUR)
#
# Make the cli directory.
#
all cli ::
cd cli && $(MAKE) $(MAKE_RECUR)
#
# Make the generated manpages.
#
all manpages :: $(AUTO_MAN)
# Order of install-targets should match the order of uninstalls. Put the
# documentation first, then the headers, and finally the library:
# (un)installCDKReadme
# (un)installCDKManPages
# (un)installCDKHeaderFiles
# (un)installCDKLibrary
#
# This installs the informational readme files.
#
install \
installCDKReadme :: $(DOCUMENT_DIR)
@echo "Installing CDK Readme files in $(DOCUMENT_DIR)..."
@for i in $(CDKREADME); do \
echo " ... $$i"; \
$(INSTALL_DATA) $(srcdir)/$$i $(DOCUMENT_DIR)/$$i; \
done
uninstall \
uninstallCDKReadme ::
@echo "Uninstalling CDK Readme files from $(DOCUMENT_DIR)..."
@- for i in $(CDKREADME); do \
$(RM) $(DOCUMENT_DIR)/$$i; \
done
#
# This installs the CDK man pages.
#
install \
installCDKManPages :: headers.sed $(MAN_DIR) manpage.sed $(AUTO_MAN)
@echo "Installing the CDK man pages in $(MAN_DIR) ..."
@for i in $(AUTO_MAN); do \
$(SHELL) $(srcdir)/headers.sh \
-x "$(INSTALL_DATA)" \
-d $(MAN_DIR) \
-s . \
-t $(MANSECT) \
-e manpage.sed $$i; \
$(SHELL) $(srcdir)/manlinks.sh installing $(srcdir) $(MAN_DIR) $(MANSECT) $$i; \
done
@for i in $(CDKMAN); do \
$(SHELL) $(srcdir)/headers.sh \
-x "$(INSTALL_DATA)" \
-d $(MAN_DIR) \
-s . \
-t $(MANSECT) \
-e manpage.sed $(srcdir)/man/$$i; \
$(SHELL) $(srcdir)/manlinks.sh installing $(srcdir) $(MAN_DIR) $(MANSECT) $(srcdir)/man/$$i; \
done
uninstall \
uninstallCDKManPages ::
@echo "Uninstalling the CDK man pages from $(MAN_DIR) ..."
@- for i in $(AUTO_MAN); do \
$(SHELL) $(srcdir)/manlinks.sh removing $(srcdir) $(MAN_DIR) $(MANSECT) $(srcdir)/$$i; \
done
@- for i in $(CDKMAN); do \
$(SHELL) $(srcdir)/manlinks.sh removing $(srcdir) $(MAN_DIR) $(MANSECT) $(srcdir)/man/$$i; \
done
#
# This installs the header files.
#
HDR_SUBDIR = -h cdk.h
HEADERS_SH = $(SHELL) $(srcdir)/headers.sh $(HDR_SUBDIR) -x "$(INSTALL_DATA)" -d $(INCLUDE_SUBDIR) -s $(srcdir)
install \
installCDKHeaderFiles :: \
$(INCLUDE_DIR) \
$(INCLUDE_SUBDIR) \
headers.sed \
$(MY_HDR)
@echo "Installing CDK header files in $(INCLUDE_SUBDIR)..."
$(HEADERS_SH) $(MY_HDR)
@for i in $(CDKHDR); do \
$(HEADERS_SH) include/$$i; \
done
rm -f $(INCLUDE_DIR)/cdk.h && mv $(INCLUDE_SUBDIR)/cdk.h $(INCLUDE_DIR)/$(PACKAGE).h
uninstall \
uninstallCDKHeaderFiles ::
@echo "Uninstalling CDK header files from $(INCLUDE_SUBDIR)..."
@- for i in $(MY_HDR); do \
$(RM) $(INCLUDE_SUBDIR)/`basename $$i`; \
done
@- for i in $(CDKHDR); do \
$(RM) $(INCLUDE_SUBDIR)/$$i; \
done
rm -f $(INCLUDE_DIR)/cdk.h
#
# This installs the CDK library.
#
install \
installCDKLibrary :: $(SHLIB_DIR) $(CDKLIB)
@echo "Installing CDK library"
@$(INSTALL_LIB) $(CDKLIB) $(SHLIB_DIR)/$(CDKLIB)
uninstall \
uninstallCDKLibrary ::
@echo "Uninstalling CDK library"
@- $(UNINSTALL_LIB) $(SHLIB_DIR)/$(CDKLIB)
#install \
#installImportLibrary :: $(LIB_DIR) $(IMPORT_LIB)
# @echo "Installing Import library"
# @$(INSTALL_LIB) $(IMPORT_LIB) $(LIB_DIR)/$(IMPORT_LIB)
#uninstall \
#uninstallImportLibrary ::
# @echo "Uninstalling Import library"
# @- $(UNINSTALL_LIB) $(LIB_DIR)/$(IMPORT_LIB)
#
# This installs the CDK package-config script.
#
install \
installCDKHeaderFiles \
installCDKLibrary :: $(BIN_DIR) cdk-config
@echo "Installing script $(CFG_ROOTNAME)$(VERSION_MAJOR)-config"
@$(INSTALL) cdk-config $(BIN_DIR)/$(CFG_ROOTNAME)$(VERSION_MAJOR)-config
uninstall \
uninstallCDKHeaderFiles \
uninstallCDKLibrary :: cdk-config
@echo "Uninstalling script $(CFG_ROOTNAME)$(VERSION_MAJOR)-config"
@$(RM) $(BIN_DIR)/$(CFG_ROOTNAME)$(VERSION_MAJOR)-config
#
# This installs the CDK shared library. The rules are for an RPM spec, and
# not of general interest.
#
installCDKSHLibrary :: $(SHLIB_DIR) $(OLD_SHLIB_FILE)
@echo "Installing CDK library"
$(INSTALL_DATA) $(OLD_SHLIB_FILE) $(SHLIB_DIR)
$(SHELL) -c "cd $(SHLIB_DIR) && $(LN_S) $(OLD_SHLIB_FILE) $(OLD_SONAME)"
$(SHELL) -c "cd $(SHLIB_DIR) && $(LN_S) $(OLD_SHLIB_FILE) $(OLD_SHLIB_LINK)"
uninstall \
uninstallCDKSHLibrary ::
- $(RM) $(SHLIB_DIR)/$(LIB_BASENAME)
- $(RM) $(SHLIB_DIR)/$(OLD_SONAME)
- $(RM) $(SHLIB_DIR)/$(OLD_SHLIB_FILE)
headers.sed : $(srcdir)/headers.sh
$(SHELL) $(srcdir)/headers.sh -p CDK $(HDR_SUBDIR) -c include/cdk_config.h -d $(INCLUDE_SUBDIR) -s $(srcdir)/include -i -s include -i
manpage.sed :
@echo "creating $@"
@echo "s/(3)/($(MANSECT))/g" >$@
@echo "/^\.TH/s/\<3\>/$(MANSECT)/" >>$@
tags :
$(CTAGS) *.[ch] */*.[ch]
TAGS :
$(ETAGS) *.[ch] */*.[ch]
lint: $(AUTO_HDR) $(AUTO_SRC) $(CDKSRC)
$(LINT) $(LINT_OPTS) $(CPPFLAGS) $(AUTO_SRC) $(CDKSRC)
all-lint: lint
cd examples && $(MAKE) $(MAKE_RECUR) lint
cd demos && $(MAKE) $(MAKE_RECUR) lint
cd cli && $(MAKE) $(MAKE_RECUR) lint
#
# Clean up after ourselves...
#
clean ::
@- $(RM) -r autom4te.cache
- $(LIBTOOL_CLEAN) $(RM) $(LIB_OBJECT) $(CDKLIB) $(RM_SHARED_OPTS)
- $(RM) *.os $(OLD_SHLIB_FILE)
- $(RM) headers.sed manpage.sed core tags *.i *~
$(RM) $(AUTO_HDR)
$(RM) $(AUTO_SRC)
$(RM) $(AUTO_MAN)
realclean :: clean
cd examples && $(MAKE) $(MAKE_RECUR) clean
cd demos && $(MAKE) $(MAKE_RECUR) clean
cd cli && $(MAKE) $(MAKE_RECUR) clean
#
# Use this to clean the distribution.
#
distclean :: realclean
$(RM) config.cache config.log config.status
cd examples && $(RM) Makefile
cd demos && $(RM) Makefile
cd cli && $(RM) Makefile
$(RM) include/cdk_config.h
$(RM) include/cdk_version.h
$(RM) Makefile
$(RM) cdk-config
$(RM) mk_shared_lib.sh
@- $(SHELL) -c 'if test "$(srcdir)" != . ; then \
rmdir examples; \
rmdir demos; \
rmdir cli; \
rmdir include; \
fi'
#
# Standard .c to .o compile line.
#
.c.o:
$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
.c.lo:
$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
.c.i:
$(CPP) $(CPPFLAGS) -E -C $< >$@
.c.os:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -fPIC $< -o $@
man \
$(BIN_DIR) \
$(DOCUMENT_DIR) \
$(INCLUDE_DIR) \
$(INCLUDE_SUBDIR) \
$(LIB_DIR) \
$(MAN_DIR) : ; mkdir -p $@
#
# Files generated from templates:
#
GEN_SCALE = $(SHELL) $(srcdir)/gen-scale.sh
SCALE_H = $(srcdir)/include/gen-scale.h
SCALE_C = $(srcdir)/gen-scale.c
SCALE_M = $(srcdir)/man/gen-scale.3
MKDIR_MAN = test -d man || mkdir man
include/dscale.h : $(SCALE_H)
$(GEN_SCALE) DSCALE DScale Double double $(SCALE_H) >$@
dscale.c : $(SCALE_C) $(AUTO_HDR)
$(GEN_SCALE) DSCALE DScale Double double $(SCALE_C) >$@
man/cdk_dscale.3 : $(SCALE_M) man
-$(MKDIR_MAN)
$(GEN_SCALE) DSCALE DScale Double double $(SCALE_M) >$@
include/fscale.h : $(SCALE_H)
$(GEN_SCALE) FSCALE FScale Float float $(SCALE_H) >$@
fscale.c : $(SCALE_C) $(AUTO_HDR)
$(GEN_SCALE) FSCALE FScale Float float $(SCALE_C) >$@
man/cdk_fscale.3 : $(SCALE_M) man
-$(MKDIR_MAN)
$(GEN_SCALE) FSCALE FScale Float float $(SCALE_M) >$@
include/scale.h : $(SCALE_H)
$(GEN_SCALE) SCALE Scale Int int $(SCALE_H) >$@
scale.c : $(SCALE_C) $(AUTO_HDR)
$(GEN_SCALE) SCALE Scale Int int $(SCALE_C) >$@
man/cdk_scale.3 : $(SCALE_M) man
-$(MKDIR_MAN)
$(GEN_SCALE) SCALE Scale Int int $(SCALE_M) >$@
include/uscale.h : $(SCALE_H)
$(GEN_SCALE) USCALE UScale Unsigned unsigned $(SCALE_H) >$@
uscale.c : $(SCALE_C) $(AUTO_HDR)
$(GEN_SCALE) USCALE UScale Unsigned unsigned $(SCALE_C) >$@
man/cdk_uscale.3 : $(SCALE_M) man
-$(MKDIR_MAN)
$(GEN_SCALE) USCALE UScale Unsigned unsigned $(SCALE_M) >$@
SLIDER_H = $(srcdir)/include/gen-slider.h
SLIDER_C = $(srcdir)/gen-slider.c
SLIDER_M = $(srcdir)/man/gen-slider.3
include/fslider.h : $(SLIDER_H)
$(GEN_SCALE) FSLIDER FSlider Float float $(SLIDER_H) >$@
fslider.c : $(SLIDER_C) $(AUTO_HDR)
$(GEN_SCALE) FSLIDER FSlider Float float $(SLIDER_C) >$@
man/cdk_fslider.3 : $(SLIDER_M) man
-$(MKDIR_MAN)
$(GEN_SCALE) FSLIDER FSlider Float float $(SLIDER_M) >$@
include/slider.h : $(SLIDER_H)
$(GEN_SCALE) SLIDER Slider Int int $(SLIDER_H) >$@
slider.c : $(SLIDER_C) $(AUTO_HDR)
$(GEN_SCALE) SLIDER Slider Int int $(SLIDER_C) >$@
man/cdk_slider.3 : $(SLIDER_M) man
-$(MKDIR_MAN)
$(GEN_SCALE) SLIDER Slider Int int $(SLIDER_M) >$@
include/uslider.h : $(SLIDER_H)
$(GEN_SCALE) USLIDER USlider Unsigned unsigned $(SLIDER_H) >$@
uslider.c : $(SLIDER_C) $(AUTO_HDR)
$(GEN_SCALE) USLIDER USlider Unsigned unsigned $(SLIDER_C) >$@
man/cdk_uslider.3 : $(SLIDER_M) man
-$(MKDIR_MAN)
$(GEN_SCALE) USLIDER USlider Unsigned unsigned $(SLIDER_M) >$@
# generated by CF__ADD_SHLIB_RULES
# libmodel: static
# symlinks:
# shlibver:
${LIB_BASENAME} :: \
${LIB_OBJECT}
@echo linking $@
$(LIBTOOL_CREATE) ${LIB_OBJECT}
install \
install.libs :: $(DESTDIR)$(libdir)/${LIB_BASENAME}
$(DESTDIR)$(libdir)/${LIB_BASENAME} :: \
$(DESTDIR)$(libdir) \
${LIB_OBJECT}
@echo linking $@
$(LIBTOOL_CREATE) ${LIB_OBJECT}
uninstall \
uninstall.libs ::
@echo uninstalling $(DESTDIR)$(libdir)/${LIB_BASENAME}
-rm -f $(DESTDIR)$(libdir)/${LIB_BASENAME}
clean \
clean.libs ::
-rm -f ${LIB_BASENAME}
mostlyclean::
-rm -f ${LIB_OBJECT}
# end generated by CF__ADD_SHLIB_RULES
|
agpl-3.0
|
aluxnimm/outlookcaldavsynchronizer
|
CalDavSynchronizer/Ui/Options/Views/OXInfoDialog.xaml.cs
|
1818
|
// This file is Part of CalDavSynchronizer (http://outlookcaldavsynchronizer.sourceforge.net/)
// Copyright (c) 2015 Gerhard Zehetbauer
// Copyright (c) 2015 Alexander Nimmervoll
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Windows;
using System.Diagnostics;
using System.Windows.Navigation;
using CalDavSynchronizer.Ui.Options.ViewModels;
namespace CalDavSynchronizer.Ui.Options.Views
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class OXInfoDialog : Window
{
public OXInfoDialog()
{
InitializeComponent();
DataContextChanged += OptionsWindow_DataContextChanged;
}
private void OptionsWindow_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
{
var viewModel = e.NewValue as OXInfoDialogViewModel;
if (viewModel != null)
{
viewModel.CloseRequested += ViewModel_CloseRequested;
}
}
private void ViewModel_CloseRequested(object sender, CloseEventArgs e)
{
DialogResult = e.IsAcceptedByUser;
}
}
}
|
agpl-3.0
|
LtRipley36706/ACE-World
|
Database/3-Core/6 LandBlockExtendedData/SQL/B86D.sql
|
1774
|
DELETE FROM `landblock_instance` WHERE `landblock` = 0xB86D;
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x7B86D000, 720, 0xB86D0108, 14.3003, 177.788, 20.505, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Sliding Door */
/* @teleloc 0xB86D0108 [14.300300 177.788000 20.505000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x7B86D001, 720, 0xB86D010B, 14.3003, 183.888, 20.505, -1, 0, 0, 0, False, '2019-02-10 00:00:00'); /* Sliding Door */
/* @teleloc 0xB86D010B [14.300300 183.888000 20.505000] -1.000000 0.000000 0.000000 0.000000 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x7B86D002, 720, 0xB86D0008, 19.9003, 180.838, 18.005, -0.7071068, 0, 0, -0.7071068, False, '2019-02-10 00:00:00'); /* Sliding Door */
/* @teleloc 0xB86D0008 [19.900300 180.838000 18.005000] -0.707107 0.000000 0.000000 -0.707107 */
INSERT INTO `landblock_instance` (`guid`, `weenie_Class_Id`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`, `is_Link_Child`, `last_Modified`)
VALUES (0x7B86D009, 28261, 0xB86D003E, 175.751, 142.413, -0.9629999, -0.8042411, 0, 0, 0.5943031, False, '2019-02-10 00:00:00'); /* Mossy Cave */
/* @teleloc 0xB86D003E [175.751000 142.413000 -0.963000] -0.804241 0.000000 0.000000 0.594303 */
|
agpl-3.0
|
taigaio/redmine-migrator
|
AUTHORS.md
|
231
|
# Primary authors:
- Mario Garcia <mario.garcia@kaleidos.net>
- Ivan Lopez <ivan.lopez@kaleidos.net>
- Xavi Julian <xavier.julian@kaleidos.net>
Special thanks to Kaleidos Open Source S.L. for provide time for Taiga
development.
|
agpl-3.0
|
LaPingvino/pasportaservo
|
hosting/templates/hosting/snippets/registration.html
|
583
|
{% load i18n bootstrap %}
<div class="col-xs-12 well register">
<h4>{% trans "Registration" %}</h4>
<p class="tip">
{% trans "You must register to see this accomodation." %}
</p>
<form class="form" method="POST" action="{% url 'register' %}?next={{ request.get_full_path|urlencode }}">
<div class="col-md-10 col-md-offset-1">
{% csrf_token %}
{{ form|bootstrap }}
<p>
<button type="submit" class="btn btn-primary">{% trans "Register" %}</button>
</p>
</div>
</form>
</div>
|
agpl-3.0
|
bluecrystalsign/signer-source
|
bluecrystal.deps.domain/src/main/java/bluecrystal/domain/helper/package-info.java
|
82
|
/**
*
*/
/**
* @author sergio
*
*/
package bluecrystal.domain.helper;
|
agpl-3.0
|
NicolasEYSSERIC/Silverpeas-Core
|
ejb-core/versioning/src/test/java/com/stratelia/silverpeas/versioning/AllTests.java
|
1643
|
/**
* Copyright (C) 2000 - 2012 Silverpeas
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* As a special exception to the terms and conditions of version 3.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* Open Source Software ("FLOSS") applications as described in Silverpeas's
* FLOSS exception. You should have received a copy of the text describing
* the FLOSS exception, and it is also available here:
* "http://www.silverpeas.org/docs/core/legal/floss_exception.html"
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.stratelia.silverpeas.versioning;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite(
"Test for com.stratelia.silverpeas.versioning");
//$JUnit-BEGIN$
suite.addTestSuite(com.stratelia.silverpeas.versioning.model.TestDocumentVersion.class);
suite.addTest(com.stratelia.silverpeas.versioning.jcr.impl.AllTests.suite());
//$JUnit-END$
return suite;
}
}
|
agpl-3.0
|
austintimeexchange/oscurrency
|
app/models/feed_post.rb
|
998
|
require 'feed-normalizer'
require 'open-uri'
class FeedPost < ActiveRecord::Base
extend PreferencesHelper
class << self
def update_posts
posts = find(:all, :select => "feedid")
post_ids = posts.map {|p| p.feedid}
begin
feed = FeedNormalizer::FeedNormalizer.parse open(global_prefs.blog_feed_url)
feed_ids = feed.entries.map {|e| e.id}
new_ids = feed_ids - post_ids
feed.entries.each do |entry|
if new_ids.include? entry.id
post = FeedPost.new()
post.feedid = entry.id
post.title = entry.title
post.urls = entry.urls
post.categories = entry.categories
post.content = entry.content
post.authors = entry.authors
post.date_published = entry.date_published
#post.last_updated = entry.last_updated
post.save
end
end
new_ids.length
rescue
nil
end
end
end
end
|
agpl-3.0
|
automenta/narchy
|
util/src/test/java/jcog/pri/bag/BagTest.java
|
10149
|
package jcog.pri.bag;
import jcog.Util;
import jcog.data.list.FasterList;
import jcog.pri.*;
import jcog.pri.bag.impl.ArrayBag;
import jcog.pri.bag.impl.HijackBag;
import jcog.pri.bag.impl.PriReferenceArrayBag;
import jcog.pri.bag.impl.hijack.DefaultHijackBag;
import jcog.random.XoRoShiRo128PlusRandom;
import jcog.signal.Tensor;
import jcog.signal.tensor.ArrayTensor;
import org.apache.commons.math3.random.EmpiricalDistribution;
import org.apache.commons.math3.stat.Frequency;
import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
import org.eclipse.collections.api.block.function.primitive.FloatToFloatFunction;
import org.jetbrains.annotations.NotNull;
import java.util.*;
import java.util.stream.Collectors;
import static jcog.Texts.n4;
import static jcog.pri.bag.ArrayBagTest.assertSorted;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author me
*/
class BagTest {
public static void testBasicInsertionRemoval(Bag<String, PriReference<String>> c) {
assertEquals(1, c.capacity());
if (!(c instanceof DefaultHijackBag)) {
assertEquals(0, c.size());
assertTrue(c.isEmpty());
}
PLink x0 = new PLink("x", 2 * ScalarValue.EPSILON);
PriReference added = c.put(x0);
assertSame(added, x0);
c.commit();
assertEquals(1, c.size());
assertEquals(0, c.priMin(), ScalarValue.EPSILON * 2);
PriReference<String> x = c.get("x");
assertNotNull(x);
assertSame(x, x0);
assertTrue(Util.equals(Prioritized.Zero.priElseNeg1(), x.priElseNeg1(), 0.01f));
}
public static Random rng() {
return new XoRoShiRo128PlusRandom(1);
}
public static void printDist(@NotNull EmpiricalDistribution f) {
System.out.println(f.getSampleStats().toString().replace("\n", " "));
f.getBinStats().forEach(
s -> {
/*if (s.getN() > 0)*/
System.out.println(
n4(s.getMin()) + ".." + n4(s.getMax()) + ":\t" + s.getN());
}
);
}
private static Tensor samplingPriDist(@NotNull Bag<PLink<String>, PLink<String>> b, int batches, int batchSize, int bins) {
assert(bins > 1);
Set<String> hit = new TreeSet();
Frequency hits = new Frequency();
ArrayTensor f = new ArrayTensor(bins);
assertFalse(b.isEmpty());
Random rng = new XoRoShiRo128PlusRandom(1);
float min = b.priMin(), max = b.priMax(), range = max-min;
for (int i = 0; i < batches; i++) {
b.sample(rng, batchSize, x -> {
f.data[Util.bin(b.pri(x), bins)]++;
String s = x.get();
hits.addValue(s);
hit.add(s);
});
}
int total = batches * batchSize;
assertEquals(total, Util.sum(f.data), 0.001f);
if (hits.getUniqueCount() != b.size()) {
System.out.println(hits.getUniqueCount() + " != " + b.size());
Set<String> items = b.stream().map(NLink::get).collect(Collectors.toSet());
items.removeAll(hit);
System.out.println("not hit: " + items);
System.out.println(hits);
fail("all elements must have been sampled at least once");
}
return f.scaled(1f / total);
}
public static void testRemoveByKey(Bag<String, PriReference<String>> a) {
a.put(new PLink("x", 0.1f));
a.commit();
assertEquals(1, a.size());
a.remove("x");
a.commit();
assertEquals(0, a.size());
assertTrue(a.isEmpty());
if (a instanceof ArrayBag) {
assertTrue(((PriReferenceArrayBag) a).listCopy().isEmpty());
//assertTrue(((PLinkArrayBag) a).keySet().isEmpty());
}
}
static void testBagSamplingDistributionLinear(Bag<PLink<String>, PLink<String>> bag, float batchSizeProp) {
fillLinear(bag, bag.capacity());
testBagSamplingDistribution(bag, batchSizeProp);
}
static void testBagSamplingDistributionSquashed(Bag<PLink<String>, PLink<String>> bag, float batchSizeProp) {
fill(bag, bag.capacity(), (x)-> (x/2f) + 0.5f);
testBagSamplingDistribution(bag, batchSizeProp);
}
static void testBagSamplingDistributionCurved(Bag<PLink<String>, PLink<String>> bag, float batchSizeProp) {
fill(bag, bag.capacity(), (x)-> 1-(1-x)*(1-x));
testBagSamplingDistribution(bag, batchSizeProp);
}
static void testBagSamplingDistributionRandom(ArrayBag<PLink<String>, PLink<String>> bag, float batchSizeProp) {
fillRandom(bag);
testBagSamplingDistribution(bag, batchSizeProp);
}
static void testBagSamplingDistribution(Bag<PLink<String>, PLink<String>> bag, float batchSizeProp) {
int cap = bag.capacity();
int batchSize = (int)Math.ceil(batchSizeProp * cap);
int batches = cap * 1000 / batchSize;
if (bag.size() < 3)
return; //histogram tests wont apply
int bins = Math.min(8, Math.max(3, cap/2));
Tensor f1 = samplingPriDist(bag, batches, batchSize, bins);
String h = "cap=" + cap + " total=" + (batches * batchSize);
// System.out.println(h + ":\n\t" + f1.tsv2());
// System.out.println();
float[] ff = f1.snapshot();
float orderThresh = 0.1f;
int n = ff.length;
if (ff[n-1] == 0)
n--; //skip last empty histogram cell HACK
if (ff[n-1] == 0)
n--; //skip last empty histogram cell HACK
for (int j = 0; j < n; j++) {
// assertTrue(ff[j] > 0); //no zero bins
for (int i = j+1; i < n; i++) {
float diff = ff[j] - ff[i];
boolean unordered = diff > orderThresh;
if (unordered) {
fail("sampling distribution not ordered. contents=" + bag);
}
}
}
final float MIN_RATIO = 1.5f;
for (int lows : n > 4 ? new int[] { 0, 1} : new int[] { 0 } ) {
for (int highs : n > 4 ? new int[] { n -1, n -2} : new int[] { n -1 } ) {
if (lows!=highs) {
float maxMinRatio = ff[highs] / ff[lows];
assertTrue(
maxMinRatio > MIN_RATIO,
maxMinRatio + " ratio between max and min"
);
}
}
}
}
private float maxMinRatio(@NotNull EmpiricalDistribution d) {
List<SummaryStatistics> bins = d.getBinStats();
return ((float) bins.get(bins.size() - 1).getN() / (bins.get(0).getN()));
}
public static void testPutMinMaxAndUniqueness(Bag<Integer, PriReference<Integer>> a) {
float pri = 0.5f;
int n = a.capacity() * 16;
for (int i = 0; i < n; i++) {
a.put(new PLink((i), pri));
}
a.commit(null);
assertEquals(a.capacity(), a.size());
if (a instanceof ArrayBag) assertSorted((ArrayBag)a);
List<Integer> keys = new FasterList(a.capacity());
a.forEachKey(keys::add);
assertEquals(a.size(), keys.size());
assertEquals(new HashSet(keys).size(), keys.size());
assertEquals(pri, a.priMin(), 0.01f);
assertEquals(a.priMin(), a.priMax(), 0.08f);
if (a instanceof ArrayBag)
assertTrue(((HijackBag)a).density() > 0.75f);
}
public static void populate(Bag<String, PriReference<String>> b, Random rng, int count, int dimensionality, float minPri, float maxPri, float qua) {
populate(b, rng, count, dimensionality, minPri, maxPri, qua, qua);
}
private static void populate(Bag<String, PriReference<String>> a, Random rng, int count, int dimensionality, float minPri, float maxPri, float minQua, float maxQua) {
float dPri = maxPri - minPri;
for (int i = 0; i < count; i++) {
a.put(new PLink(
"x" + rng.nextInt(dimensionality),
rng.nextFloat() * dPri + minPri)
);
}
a.commit(null);
if (a instanceof ArrayBag) assertSorted((ArrayBag)a);
}
/**
* fill it exactly to capacity
*/
public static void fillLinear(Bag<PLink<String>, PLink<String>> bag, int c) {
fill(bag, c, (x)->x);
assertEquals(1f / (c+1), bag.priMin(), 0.03f);
assertEquals(1 - 1f/(c+1), bag.priMax(), 0.03f);
}
public static void fill(Bag<PLink<String>, PLink<String>> bag, int c, FloatToFloatFunction priCurve) {
assertTrue(bag.isEmpty());
for (int i = c-1; i >= 0; i--) {
float x = (i + 1) / (c+1f); //center of index
PLink inserted = bag.put(new PLink(i + "x", priCurve.valueOf(x)));
assert(inserted!=null);
}
bag.commit(null);
assertEquals(c, bag.size());
if (bag instanceof ArrayBag) assertSorted((ArrayBag)bag);
}
private static void fillRandom(ArrayBag<PLink<String>, PLink<String>> bag) {
assertTrue(bag.isEmpty());
int c = bag.capacity();
Random rng = new XoRoShiRo128PlusRandom(1);
for (int i = c-1; i >= 0; i--) {
PLink inserted = bag.put(new PLink(i + "x", rng.nextFloat()));
assertTrue(inserted!=null);
assertSorted(bag);
}
bag.commit(null);
assertEquals(c, bag.size());
assertSorted(bag);
}
}
|
agpl-3.0
|
ricardoroberto/TesteGrpLTM
|
FrontEnd/Estoque.Front/src/app/app.component.ts
|
470
|
import { Component } from '@angular/core';
import { AuthService } from './login/auth.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app';
mostrarMenu: boolean = false;
constructor(private authService: AuthService){
}
ngOnInit(){
this.authService.mostrarProdutoEmmiter.subscribe(
mostrar => this.mostrarMenu = mostrar
);
}
}
|
agpl-3.0
|
aknight1-uva/jasp-desktop
|
JASP-Desktop/variableswidget.cpp
|
3776
|
#include "variableswidget.h"
#include "ui_variableswidget.h"
#include "desktoputils.h"
#include "variablespage/variablestablemodel.h"
#include <QModelIndexList>
#include <boost/foreach.hpp>
#include <algorithm>
#include <QDebug>
VariablesWidget::VariablesWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::VariablesWidget)
{
ui->setupUi(this);
_dataSet = NULL;
_currentColumn = NULL;
_levelsTableModel = new LevelsTableModel(this);
ui->labelsView->setModel(_levelsTableModel);
ui->columnheader->setText("");
(ui->labelsView->verticalHeader())->hide();
setToolTip("Double-click on a label to change it");
connect(ui->moveUpButton, SIGNAL(clicked()), this, SLOT(moveUpClicked()));
connect(ui->moveDownButton, SIGNAL(clicked()), this, SLOT(moveDownClicked()));
connect(ui->reverseButton, SIGNAL(clicked()), this, SLOT(reverseClicked()));
connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(close()));
connect(_levelsTableModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(labelDataChanged(QModelIndex, QModelIndex)));
}
VariablesWidget::~VariablesWidget()
{
delete ui;
}
void VariablesWidget::setDataSet(DataSet *dataSet)
{
_dataSet = dataSet;
_levelsTableModel->refresh();
}
void VariablesWidget::clearDataSet()
{
_dataSet = NULL;
_currentColumn = NULL;
}
void VariablesWidget::moveUpClicked()
{
QModelIndexList selection = ui->labelsView->selectionModel()->selectedIndexes();
if (selection.length() == 0)
return;
qSort(selection.begin(), selection.end(), qLess<QModelIndex>());
if (selection.at(0).row() == 0) return;
_levelsTableModel->moveUp(selection);
// Reset Selection
ui->labelsView->clearSelection();
ui->labelsView->setSelectionMode(QAbstractItemView::MultiSelection);
BOOST_FOREACH (QModelIndex &index, selection)
{
if (index.column() == 0) {
ui->labelsView->selectRow(index.row() - 1);
}
}
//ui->labelsView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->labelsView->setSelectionMode(QAbstractItemView::ExtendedSelection);
if (_currentColumn != NULL)
emit(columnChanged(toQStr(_currentColumn->name())));
}
void VariablesWidget::moveDownClicked()
{
QModelIndexList selection = ui->labelsView->selectionModel()->selectedIndexes();
if (selection.length() == 0)
return;
qSort(selection.begin(), selection.end(), qGreater<QModelIndex>());
QModelIndex dummy = QModelIndex();
if (selection.at(0).row() >= (_levelsTableModel->rowCount(dummy) - 1)) return;
_levelsTableModel->moveDown(selection);
// Reset Selection
ui->labelsView->clearSelection();
ui->labelsView->setSelectionMode(QAbstractItemView::MultiSelection);
BOOST_FOREACH (QModelIndex &index, selection)
{
if (index.column() == 0) {
ui->labelsView->selectRow(index.row() + 1);
}
}
//ui->labelsView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->labelsView->setSelectionMode(QAbstractItemView::ExtendedSelection);
if (_currentColumn != NULL)
emit(columnChanged(toQStr(_currentColumn->name())));
}
void VariablesWidget::reverseClicked()
{
_levelsTableModel->reverse();
ui->labelsView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->labelsView->setSelectionMode(QAbstractItemView::ExtendedSelection);
if (_currentColumn != NULL)
emit(columnChanged(toQStr(_currentColumn->name())));
}
void VariablesWidget::setCurrentColumn(int columnnumber)
{
_currentColumn = &_dataSet->columns().at(columnnumber);
QString columnheader(_currentColumn->name().c_str());
_levelsTableModel->setColumn(_currentColumn);
ui->columnheader->setText("<b>" + columnheader + "</b>");
}
void VariablesWidget::labelDataChanged(QModelIndex m1, QModelIndex m2)
{
if (_currentColumn != NULL)
emit(columnChanged(toQStr(_currentColumn->name())));
emit(resetTableView());
}
|
agpl-3.0
|
edx/edx-ora2
|
openassessment/templates/openassessmentblock/edit/oa_edit_staff_assessment.html
|
785
|
{% load i18n %}
{% spaceless %}
<li class="openassessment_assessment_module_settings_editor" id="oa_staff_assessment_editor">
<div class="drag-handle action"></div>
<div class="openassessment_inclusion_wrapper">
<input type="checkbox" id="include_staff_assessment"
{% if assessments.staff_assessment.required %} checked="true" {% endif %}>
<label for="include_staff_assessment">{% trans "Step: Staff Assessment" %}</label>
</div>
<div class="openassessment_assessment_module_editor">
<p class="openassessment_description">
{% trans "Staff Assessment gates sets the final grade for students if enabled with other steps, though it can also be used as a standalone step." %}
</p>
</div>
</li>
{% endspaceless %}
|
agpl-3.0
|
cris-iisc/mpc-primitives
|
crislib/libscapi/lib/boost_1_64_0/doc/html/boost/accumulators/as_feature_ta_idp410480112.html
|
4922
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Struct as_feature<tag::rolling_variance(immediate)></title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../accumulators/reference.html#header.boost.accumulators.statistics.rolling_variance_hpp" title="Header <boost/accumulators/statistics/rolling_variance.hpp>">
<link rel="prev" href="as_feature_ta_idp410478000.html" title="Struct as_feature<tag::rolling_variance(lazy)>">
<link rel="next" href="feature_of_ta_idp410482224.html" title="Struct feature_of<tag::lazy_rolling_variance>">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="as_feature_ta_idp410478000.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../accumulators/reference.html#header.boost.accumulators.statistics.rolling_variance_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="feature_of_ta_idp410482224.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.accumulators.as_feature_ta_idp410480112"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Struct as_feature<tag::rolling_variance(immediate)></span></h2>
<p>boost::accumulators::as_feature<tag::rolling_variance(immediate)></p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: <<a class="link" href="../../accumulators/reference.html#header.boost.accumulators.statistics.rolling_variance_hpp" title="Header <boost/accumulators/statistics/rolling_variance.hpp>">boost/accumulators/statistics/rolling_variance.hpp</a>>
</span>
<span class="keyword">struct</span> <a class="link" href="as_feature_ta_idp410480112.html" title="Struct as_feature<tag::rolling_variance(immediate)>">as_feature</a><span class="special"><</span><span class="identifier">tag</span><span class="special">::</span><span class="identifier">rolling_variance</span><span class="special">(</span><span class="identifier">immediate</span><span class="special">)</span><span class="special">></span> <span class="special">{</span>
<span class="comment">// types</span>
<span class="keyword">typedef</span> <a class="link" href="tag/immediate_rolling_variance.html" title="Struct immediate_rolling_variance">tag::immediate_rolling_variance</a> <a name="boost.accumulators.as_feature_ta_idp410480112.type"></a><span class="identifier">type</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2005, 2006 Eric Niebler<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="as_feature_ta_idp410478000.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../accumulators/reference.html#header.boost.accumulators.statistics.rolling_variance_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="feature_of_ta_idp410482224.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
|
agpl-3.0
|
romain-li/edx-platform
|
openedx/core/djangoapps/course_groups/views.py
|
19604
|
"""
Views related to course groups functionality.
"""
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.decorators.http import require_POST
from django.contrib.auth.models import User
from django.core.paginator import Paginator, EmptyPage
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseBadRequest
from django.views.decorators.http import require_http_methods
from util.json_request import expect_json, JsonResponse
from django.db import transaction
from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext
import logging
import re
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from courseware.courses import get_course_with_access
from edxmako.shortcuts import render_to_response
from . import cohorts
from lms.djangoapps.django_comment_client.utils import get_discussion_category_map, get_discussion_categories_ids
from lms.djangoapps.django_comment_client.constants import TYPE_ENTRY
from .models import CourseUserGroup, CourseUserGroupPartitionGroup, CohortMembership
log = logging.getLogger(__name__)
def json_http_response(data):
"""
Return an HttpResponse with the data json-serialized and the right content
type header.
"""
return JsonResponse(data)
def split_by_comma_and_whitespace(cstr):
"""
Split a string both by commas and whitespace. Returns a list.
"""
return re.split(r'[\s,]+', cstr)
def link_cohort_to_partition_group(cohort, partition_id, group_id):
"""
Create cohort to partition_id/group_id link.
"""
CourseUserGroupPartitionGroup(
course_user_group=cohort,
partition_id=partition_id,
group_id=group_id,
).save()
def unlink_cohort_partition_group(cohort):
"""
Remove any existing cohort to partition_id/group_id link.
"""
CourseUserGroupPartitionGroup.objects.filter(course_user_group=cohort).delete()
# pylint: disable=invalid-name
def _get_course_cohort_settings_representation(course, course_cohort_settings):
"""
Returns a JSON representation of a course cohort settings.
"""
cohorted_course_wide_discussions, cohorted_inline_discussions = get_cohorted_discussions(
course, course_cohort_settings
)
return {
'id': course_cohort_settings.id,
'is_cohorted': course_cohort_settings.is_cohorted,
'cohorted_inline_discussions': cohorted_inline_discussions,
'cohorted_course_wide_discussions': cohorted_course_wide_discussions,
'always_cohort_inline_discussions': course_cohort_settings.always_cohort_inline_discussions,
}
def _get_cohort_representation(cohort, course):
"""
Returns a JSON representation of a cohort.
"""
group_id, partition_id = cohorts.get_group_info_for_cohort(cohort)
assignment_type = cohorts.get_assignment_type(cohort)
return {
'name': cohort.name,
'id': cohort.id,
'user_count': cohort.users.filter(courseenrollment__course_id=course.location.course_key,
courseenrollment__is_active=1).count(),
'assignment_type': assignment_type,
'user_partition_id': partition_id,
'group_id': group_id,
}
def get_cohorted_discussions(course, course_settings):
"""
Returns the course-wide and inline cohorted discussion ids separately.
"""
cohorted_course_wide_discussions = []
cohorted_inline_discussions = []
course_wide_discussions = [topic['id'] for __, topic in course.discussion_topics.items()]
all_discussions = get_discussion_categories_ids(course, None, include_all=True)
for cohorted_discussion_id in course_settings.cohorted_discussions:
if cohorted_discussion_id in course_wide_discussions:
cohorted_course_wide_discussions.append(cohorted_discussion_id)
elif cohorted_discussion_id in all_discussions:
cohorted_inline_discussions.append(cohorted_discussion_id)
return cohorted_course_wide_discussions, cohorted_inline_discussions
@require_http_methods(("GET", "PATCH"))
@ensure_csrf_cookie
@expect_json
@login_required
def course_cohort_settings_handler(request, course_key_string):
"""
The restful handler for cohort setting requests. Requires JSON.
This will raise 404 if user is not staff.
GET
Returns the JSON representation of cohort settings for the course.
PATCH
Updates the cohort settings for the course. Returns the JSON representation of updated settings.
"""
course_key = CourseKey.from_string(course_key_string)
course = get_course_with_access(request.user, 'staff', course_key)
cohort_settings = cohorts.get_course_cohort_settings(course_key)
if request.method == 'PATCH':
cohorted_course_wide_discussions, cohorted_inline_discussions = get_cohorted_discussions(
course, cohort_settings
)
settings_to_change = {}
if 'is_cohorted' in request.json:
settings_to_change['is_cohorted'] = request.json.get('is_cohorted')
if 'cohorted_course_wide_discussions' in request.json or 'cohorted_inline_discussions' in request.json:
cohorted_course_wide_discussions = request.json.get(
'cohorted_course_wide_discussions', cohorted_course_wide_discussions
)
cohorted_inline_discussions = request.json.get(
'cohorted_inline_discussions', cohorted_inline_discussions
)
settings_to_change['cohorted_discussions'] = cohorted_course_wide_discussions + cohorted_inline_discussions
if 'always_cohort_inline_discussions' in request.json:
settings_to_change['always_cohort_inline_discussions'] = request.json.get(
'always_cohort_inline_discussions'
)
if not settings_to_change:
return JsonResponse({"error": unicode("Bad Request")}, 400)
try:
cohort_settings = cohorts.set_course_cohort_settings(
course_key, **settings_to_change
)
except ValueError as err:
# Note: error message not translated because it is not exposed to the user (UI prevents this state).
return JsonResponse({"error": unicode(err)}, 400)
return JsonResponse(_get_course_cohort_settings_representation(course, cohort_settings))
@require_http_methods(("GET", "PUT", "POST", "PATCH"))
@ensure_csrf_cookie
@expect_json
@login_required
def cohort_handler(request, course_key_string, cohort_id=None):
"""
The restful handler for cohort requests. Requires JSON.
GET
If a cohort ID is specified, returns a JSON representation of the cohort
(name, id, user_count, assignment_type, user_partition_id, group_id).
If no cohort ID is specified, returns the JSON representation of all cohorts.
This is returned as a dict with the list of cohort information stored under the
key `cohorts`.
PUT or POST or PATCH
If a cohort ID is specified, updates the cohort with the specified ID. Currently the only
properties that can be updated are `name`, `user_partition_id` and `group_id`.
Returns the JSON representation of the updated cohort.
If no cohort ID is specified, creates a new cohort and returns the JSON representation of the updated
cohort.
"""
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
course = get_course_with_access(request.user, 'staff', course_key)
if request.method == 'GET':
if not cohort_id:
all_cohorts = [
_get_cohort_representation(c, course)
for c in cohorts.get_course_cohorts(course)
]
return JsonResponse({'cohorts': all_cohorts})
else:
cohort = cohorts.get_cohort_by_id(course_key, cohort_id)
return JsonResponse(_get_cohort_representation(cohort, course))
else:
name = request.json.get('name')
assignment_type = request.json.get('assignment_type')
if not name:
# Note: error message not translated because it is not exposed to the user (UI prevents this state).
return JsonResponse({"error": "Cohort name must be specified."}, 400)
if not assignment_type:
# Note: error message not translated because it is not exposed to the user (UI prevents this state).
return JsonResponse({"error": "Assignment type must be specified."}, 400)
# If cohort_id is specified, update the existing cohort. Otherwise, create a new cohort.
if cohort_id:
cohort = cohorts.get_cohort_by_id(course_key, cohort_id)
if name != cohort.name:
if cohorts.is_cohort_exists(course_key, name):
err_msg = ugettext("A cohort with the same name already exists.")
return JsonResponse({"error": unicode(err_msg)}, 400)
cohort.name = name
cohort.save()
try:
cohorts.set_assignment_type(cohort, assignment_type)
except ValueError as err:
return JsonResponse({"error": unicode(err)}, 400)
else:
try:
cohort = cohorts.add_cohort(course_key, name, assignment_type)
except ValueError as err:
return JsonResponse({"error": unicode(err)}, 400)
group_id = request.json.get('group_id')
if group_id is not None:
user_partition_id = request.json.get('user_partition_id')
if user_partition_id is None:
# Note: error message not translated because it is not exposed to the user (UI prevents this state).
return JsonResponse(
{"error": "If group_id is specified, user_partition_id must also be specified."}, 400
)
existing_group_id, existing_partition_id = cohorts.get_group_info_for_cohort(cohort)
if group_id != existing_group_id or user_partition_id != existing_partition_id:
unlink_cohort_partition_group(cohort)
link_cohort_to_partition_group(cohort, user_partition_id, group_id)
else:
# If group_id was specified as None, unlink the cohort if it previously was associated with a group.
existing_group_id, _ = cohorts.get_group_info_for_cohort(cohort)
if existing_group_id is not None:
unlink_cohort_partition_group(cohort)
return JsonResponse(_get_cohort_representation(cohort, course))
@ensure_csrf_cookie
def users_in_cohort(request, course_key_string, cohort_id):
"""
Return users in the cohort. Show up to 100 per page, and page
using the 'page' GET attribute in the call. Format:
Returns:
Json dump of dictionary in the following format:
{'success': True,
'page': page,
'num_pages': paginator.num_pages,
'users': [{'username': ..., 'email': ..., 'name': ...}]
}
"""
# this is a string when we get it here
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
get_course_with_access(request.user, 'staff', course_key)
# this will error if called with a non-int cohort_id. That's ok--it
# shouldn't happen for valid clients.
cohort = cohorts.get_cohort_by_id(course_key, int(cohort_id))
paginator = Paginator(cohort.users.all(), 100)
try:
page = int(request.GET.get('page'))
except (TypeError, ValueError):
# These strings aren't user-facing so don't translate them
return HttpResponseBadRequest('Requested page must be numeric')
else:
if page < 0:
return HttpResponseBadRequest('Requested page must be greater than zero')
try:
users = paginator.page(page)
except EmptyPage:
users = [] # When page > number of pages, return a blank page
user_info = [{'username': u.username,
'email': u.email,
'name': '{0} {1}'.format(u.first_name, u.last_name)}
for u in users]
return json_http_response({'success': True,
'page': page,
'num_pages': paginator.num_pages,
'users': user_info})
@transaction.non_atomic_requests
@ensure_csrf_cookie
@require_POST
def add_users_to_cohort(request, course_key_string, cohort_id):
"""
Return json dict of:
{'success': True,
'added': [{'username': ...,
'name': ...,
'email': ...}, ...],
'changed': [{'username': ...,
'name': ...,
'email': ...,
'previous_cohort': ...}, ...],
'present': [str1, str2, ...], # already there
'unknown': [str1, str2, ...]}
Raises Http404 if the cohort cannot be found for the given course.
"""
# this is a string when we get it here
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
get_course_with_access(request.user, 'staff', course_key)
try:
cohort = cohorts.get_cohort_by_id(course_key, cohort_id)
except CourseUserGroup.DoesNotExist:
raise Http404("Cohort (ID {cohort_id}) not found for {course_key_string}".format(
cohort_id=cohort_id,
course_key_string=course_key_string
))
users = request.POST.get('users', '')
added = []
changed = []
present = []
unknown = []
for username_or_email in split_by_comma_and_whitespace(users):
if not username_or_email:
continue
try:
(user, previous_cohort) = cohorts.add_user_to_cohort(cohort, username_or_email)
info = {
'username': user.username,
'email': user.email,
}
if previous_cohort:
info['previous_cohort'] = previous_cohort
changed.append(info)
else:
added.append(info)
except ValueError:
present.append(username_or_email)
except User.DoesNotExist:
unknown.append(username_or_email)
return json_http_response({'success': True,
'added': added,
'changed': changed,
'present': present,
'unknown': unknown})
@ensure_csrf_cookie
@require_POST
def remove_user_from_cohort(request, course_key_string, cohort_id):
"""
Expects 'username': username in POST data.
Return json dict of:
{'success': True} or
{'success': False,
'msg': error_msg}
"""
# this is a string when we get it here
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
get_course_with_access(request.user, 'staff', course_key)
username = request.POST.get('username')
if username is None:
return json_http_response({'success': False,
'msg': 'No username specified'})
try:
user = User.objects.get(username=username)
except User.DoesNotExist:
log.debug('no user')
return json_http_response({'success': False,
'msg': "No user '{0}'".format(username)})
try:
membership = CohortMembership.objects.get(user=user, course_id=course_key)
membership.delete()
except CohortMembership.DoesNotExist:
pass
return json_http_response({'success': True})
def debug_cohort_mgmt(request, course_key_string):
"""
Debugging view for dev.
"""
# this is a string when we get it here
course_key = SlashSeparatedCourseKey.from_deprecated_string(course_key_string)
# add staff check to make sure it's safe if it's accidentally deployed.
get_course_with_access(request.user, 'staff', course_key)
context = {'cohorts_url': reverse(
'cohorts',
kwargs={'course_key': course_key.to_deprecated_string()}
)}
return render_to_response('/course_groups/debug.html', context)
@expect_json
@login_required
def cohort_discussion_topics(request, course_key_string):
"""
The handler for cohort discussion categories requests.
This will raise 404 if user is not staff.
Returns the JSON representation of discussion topics w.r.t categories for the course.
Example:
>>> example = {
>>> "course_wide_discussions": {
>>> "entries": {
>>> "General": {
>>> "sort_key": "General",
>>> "is_cohorted": True,
>>> "id": "i4x-edx-eiorguegnru-course-foobarbaz"
>>> }
>>> }
>>> "children": ["General", "entry"]
>>> },
>>> "inline_discussions" : {
>>> "subcategories": {
>>> "Getting Started": {
>>> "subcategories": {},
>>> "children": [
>>> ["Working with Videos", "entry"],
>>> ["Videos on edX", "entry"]
>>> ],
>>> "entries": {
>>> "Working with Videos": {
>>> "sort_key": None,
>>> "is_cohorted": False,
>>> "id": "d9f970a42067413cbb633f81cfb12604"
>>> },
>>> "Videos on edX": {
>>> "sort_key": None,
>>> "is_cohorted": False,
>>> "id": "98d8feb5971041a085512ae22b398613"
>>> }
>>> }
>>> },
>>> "children": ["Getting Started", "subcategory"]
>>> },
>>> }
>>> }
"""
course_key = CourseKey.from_string(course_key_string)
course = get_course_with_access(request.user, 'staff', course_key)
discussion_topics = {}
discussion_category_map = get_discussion_category_map(
course, request.user, cohorted_if_in_list=True, exclude_unstarted=False
)
# We extract the data for the course wide discussions from the category map.
course_wide_entries = discussion_category_map.pop('entries')
course_wide_children = []
inline_children = []
for name, c_type in discussion_category_map['children']:
if name in course_wide_entries and c_type == TYPE_ENTRY:
course_wide_children.append([name, c_type])
else:
inline_children.append([name, c_type])
discussion_topics['course_wide_discussions'] = {
'entries': course_wide_entries,
'children': course_wide_children
}
discussion_category_map['children'] = inline_children
discussion_topics['inline_discussions'] = discussion_category_map
return JsonResponse(discussion_topics)
|
agpl-3.0
|
Tatwi/legend-of-hondo
|
MMOCoreORB/src/server/zone/objects/building/components/GCWBaseContainerComponent.cpp
|
4046
|
/*
* GCWBaseContainerComponent.cpp
*
* Created on: Jan 24, 2013
* Author: root
*/
#include "GCWBaseContainerComponent.h"
#include "templates/params/creature/CreatureFlag.h"
bool GCWBaseContainerComponent::checkContainerPermission(SceneObject* sceneObject, CreatureObject* creature, uint16 permission) const {
ManagedReference<BuildingObject*> building = cast<BuildingObject*>(sceneObject);
if (building == NULL)
return false;
return checkContainerPermission(building, creature, permission, false);
}
bool GCWBaseContainerComponent::checkContainerPermission(BuildingObject* building, CreatureObject* creature, uint16 permission, bool sendMessage) const {
if (permission == ContainerPermissions::WALKIN) {
if (building == NULL) {
return false;
}
if (creature->isPlayerCreature() && creature->getPlayerObject()->hasGodMode())
return true;
if (building->getPvpStatusBitmask() & CreatureFlag::OVERT) {
return checkPVPPermission( building, creature, permission, sendMessage);
} else {
return checkPVEPermission(building, creature, permission, sendMessage);
}
}
return StructureContainerComponent::checkContainerPermission(building, creature, permission);
}
bool GCWBaseContainerComponent::checkPVPPermission(BuildingObject* building, CreatureObject* creature, uint16 permission, bool sendMessage) const {
PlayerObject* player = creature->getPlayerObject();
if (player == NULL) {
return false;
}
if (creature->getFaction() == 0) {
if (sendMessage)
creature->sendSystemMessage("@faction/faction_hq/faction_hq_response:youre_neutral_excluded"); // This is a restricted access military structure, and you haven't aligned yourself with the military. You are not cleared to enter.
return false;
}
if (player->getFactionStatus() != FactionStatus::OVERT) {
if (sendMessage)
creature->sendSystemMessage("@faction/faction_hq/faction_hq_response:youre_covert_excluded"); // You must be a member of the Special Forces to enter this structure.
return false;
}
if (creature->getFaction() == building->getFaction()) {
return true;
}
DataObjectComponentReference* data = building->getDataObjectComponent();
DestructibleBuildingDataComponent* baseData = NULL;
if (data != NULL) {
baseData = cast<DestructibleBuildingDataComponent*>(data->get());
}
if (baseData == NULL)
return false;
if (!baseData->hasDefense()) {
return true;
} else {
if (sendMessage)
creature->sendSystemMessage("@faction_perk:destroy_turrets"); // You cannot enter this HQ until all Turrets have been destroyed.
return false;
}
}
bool GCWBaseContainerComponent::checkPVEPermission(BuildingObject* building, CreatureObject* creature, uint16 permission, bool sendMessage) const {
PlayerObject* player = creature->getPlayerObject();
if (player == NULL) {
return false;
}
if (creature->getFaction() == 0) {
if (sendMessage)
creature->sendSystemMessage("@faction/faction_hq/faction_hq_response:youre_neutral_excluded"); // This is a restricted access military structure, and you haven't aligned yourself with the military. You are not cleared to enter.
return false;
}
if ((player->getFactionStatus() != FactionStatus::COVERT && player->getFactionStatus() != FactionStatus::OVERT)) {
if (sendMessage)
creature->sendSystemMessage("You must be at least a combatant to enter");
return false;
}
if (creature->getFaction() == building->getFaction()) {
return true;
}
DataObjectComponentReference* data = building->getDataObjectComponent();
DestructibleBuildingDataComponent* baseData = NULL;
if (data != NULL) {
baseData = cast<DestructibleBuildingDataComponent*>(data->get());
}
if (baseData != NULL) {
if (!baseData->hasDefense()) {
return true;
} else {
if (sendMessage)
creature->sendSystemMessage("@faction_perk:destroy_turrets"); // You cannot enter this HQ until all Turrets have been destroyed.
return false;
}
} else {
if (creature->getFaction() != building->getFaction()) {
return false;
}
}
return true;
}
|
agpl-3.0
|
csinitiative/trisano
|
webapp/features/enhanced_step_definitions/event_steps.rb
|
7381
|
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 The Collaborative Software Foundation
#
# This file is part of TriSano.
#
# TriSano is free software: you can redistribute it and/or modify it under the
# terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# TriSano is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with TriSano. If not, see http://www.gnu.org/licenses/agpl-3.0.txt.
When(/^I navigate to the new morbidity event page and start a simple event$/) do
@browser.open "/trisano/cmrs/new"
add_demographic_info(@browser, { :last_name => get_unique_name })
@browser.type('morbidity_event_first_reported_PH_date', Date.today)
end
When(/^I navigate to the new assessment event page and start a simple event$/) do
@browser.open "/trisano/aes/new"
add_demographic_info(@browser, { :last_name => get_unique_name })
@browser.type('assessment_event_first_reported_PH_date', Date.today)
end
When /^I go to the new CMR page$/ do
@browser.open "/trisano/cmrs/new"
@browser.wait_for_page_to_load
end
When(/^I navigate to the morbidity event edit page$/) do
@browser.click "link=EVENTS"
@browser.wait_for_page_to_load $load_time
@browser.click "link=Edit"
@browser.wait_for_page_to_load $load_time
end
When(/^I navigate to the assessment event edit page$/) do
@browser.click "link=EVENTS"
@browser.wait_for_page_to_load $load_time
@browser.click "link=Edit"
@browser.wait_for_page_to_load $load_time
end
When(/^I am on the assessment event edit page$/) do
@browser.open "/trisano/aes/#{(@event).id}/edit"
@browser.wait_for_page_to_load
end
When(/^I am on the morbidity event edit page$/) do
@browser.open "/trisano/cmrs/#{(@event).id}/edit"
@browser.wait_for_page_to_load
end
When(/^I am on the morbidity event show page$/) do
@browser.open "/trisano/cmrs/#{(@event).id}"
@browser.wait_for_page_to_load
end
# Consider refactoring the name of this one -- it really isn't
# navigating, it's more like a "when I am on" -- doesn't 'I am on'
# imply a verification that you are already there?
When(/^I navigate to the morbidity event show page$/) do
@browser.open "/trisano/cmrs/#{(@event).id}"
@browser.wait_for_page_to_load
end
When(/^I navigate to the assessment event show page$/) do
@browser.open "/trisano/aes/#{(@event).id}"
@browser.wait_for_page_to_load
end
When /^I am on the events index page$/ do
@browser.open "/trisano/events"
@browser.wait_for_page_to_load
end
When(/^I am on the contact event edit page$/) do
@browser.open "/trisano/contact_events/#{@contact_event.id}/edit"
@browser.wait_for_page_to_load
end
When /^I navigate to the contact event edit page$/ do
When "I am on the contact event edit page"
end
When /^I navigate to the encounter event edit page$/ do
@browser.open "/trisano/encounter_events/#{(@encounter_event).id}/edit"
@browser.wait_for_page_to_load
end
When /^I am on the encounter event edit page$/ do
When "I navigate to the encounter event edit page"
end
When /^I navigate to the contact named "(.+)"$/ do |last_name|
@contact_event = ContactEvent.first(:include => { :interested_party => { :person_entity => :person } },
:conditions => ['people.last_name = ?', last_name])
@browser.open "/trisano/contact_events/#{@contact_event.id}/edit"
@browser.wait_for_page_to_load
end
When /^I select "([^\"]*)" from the sibling navigator$/ do |option_text|
@browser.select "css=.events_nav", option_text
@browser.wait_for_page_to_load
end
When /^I select "([^\"]*)" from the sibling navigator and Save$/ do |option_text|
@browser.select "css=.events_nav", option_text
@browser.wait_for_element_present "//button/span[contains(text(), 'Save')]"
@browser.click "//button/span[contains(text(), 'Save')]"
@browser.wait_for_page_to_load
end
When /^I select "([^\"]*)" from the sibling navigator and leave without saving$/ do |option_text|
@browser.select "css=.events_nav", option_text
@browser.wait_for_element_present "//button/span[contains(text(), 'Leave')]"
@browser.click "//button/span[contains(text(), 'Leave')]"
@browser.wait_for_page_to_load
end
When /^I select "([^\"]*)" from the sibling navigator but cancel the dialog$/ do |option_text|
@browser.select "css=.events_nav", option_text
@browser.wait_for_element_present "//a/span[contains(text(), 'close')]"
@browser.click "//a/span[contains(text(), 'close')]"
end
Then /^I should be on the contact named "([^\"]*)"$/ do |last_name|
@contact_event = ContactEvent.first(:include => { :interested_party => { :person_entity => :person } },
:conditions => ['people.last_name = ?', last_name])
@browser.get_location.should =~ /trisano\/contact_events\/#{@contact_event.id}\/edit/
end
When /^I enter "([^\"]*)" as the contact\'s first name$/ do |text|
@browser.type("css=#contact_event_interested_party_attributes_person_entity_attributes_person_attributes_first_name",
text)
end
Then /^no value should be selected in the sibling navigator$/ do
script = "selenium.browserbot.getCurrentWindow().$j('.events_nav').val();"
@browser.get_eval(script).should == ""
end
When(/^I am on the place event edit page$/) do
@browser.open "/trisano/place_events/#{(@place_event).id}/edit"
@browser.wait_for_page_to_load
end
When /^I save and continue$/ do
@browser.click("//*[@id='save_and_continue_btn']")
@browser.wait_for_page_to_load
end
When /^I save and exit$/ do
@browser.click("//*[@id='save_and_exit_btn']")
@browser.wait_for_page_to_load
end
Then /^events list should show (\d+) events$/ do |expected_count|
@browser.get_xpath_count("//div[@class='patientname']").should == expected_count
end
Given /^a clean events table$/ do
Address.destroy_all
ParticipationsRiskFactor.destroy_all
Participation.destroy_all
Task.destroy_all
Event.destroy_all
end
After('@clean_events') do
Address.all.each(&:delete)
ParticipationsRiskFactor.destroy_all
Participation.destroy_all
Task.destroy_all
Event.all.each(&:delete)
end
When /^I scroll down a bit$/ do
script = "selenium.browserbot.getCurrentWindow().$j(window).scrollTop(300);"
@browser.get_eval(script).should == "[object Window]" # Just making sure the script ran
end
Then /^I should have been scrolled back to the top of the page$/ do
script = "selenium.browserbot.getCurrentWindow().$j(window).scrollTop();"
@browser.get_eval(script).should == "0"
end
Then /^I should have a note that says "([^\"]*)"$/ do |text|
@browser.get_xpath_count("//div[@id='existing-notes']//p[contains(text(), '#{text}')]").to_i.should >= 1
end
When /^I enter a valid first reported to public health date$/ do
@browser.type('morbidity_event_first_reported_PH_date', Date.today)
end
When /^I enter basic CMR data$/ do
@browser.type 'morbidity_event_interested_party_attributes_person_entity_attributes_person_attributes_last_name', 'Smoker'
When %{I enter a valid first reported to public health date}
end
|
agpl-3.0
|
scylladb/scylla
|
db/read_repair_decision.hh
|
632
|
/*
*/
/*
* Copyright (C) 2015-present ScyllaDB
*
* Modified by ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#pragma once
#include <iostream>
namespace db {
enum class read_repair_decision {
NONE,
GLOBAL,
DC_LOCAL
};
inline std::ostream& operator<<(std::ostream& out, db::read_repair_decision d) {
switch (d) {
case db::read_repair_decision::NONE: out << "NONE"; break;
case db::read_repair_decision::GLOBAL: out << "GLOBAL"; break;
case db::read_repair_decision::DC_LOCAL: out << "DC_LOCAL"; break;
default: out << "ERR"; break;
}
return out;
}
}
|
agpl-3.0
|
neurotechuoft/MindType
|
Meetings/2017-05-28.md
|
2497
|
# May 28, 2017: Meeting Notes
# Preparation:
* EEG Speller Validation Study: (See ./ResearchPapers/Motor Imagery EEG Speller--Validation.docx)
* just skim the papers mentioned here; we'll look at these in detail later
* "Design, implementation and evaluation of a real-time P300-based Brain-Computer Interface system" (See ./ResearchPapers)
* "Comparison of Classification Methods for P300 Brain-Computer Interface on Disabled Subjects" : https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3175727/
# Agenda (5:00--6:00pm)
### Admin
* 3 meetings too many? Too little?
* what days are good for?
### Development process
* Agile approach
* each iteration: 3 weeks
* 2 weeks dev; 1 week integration testing
* increase complexity of product each iteration
### Milestones
* P300 speller
* 2-gesture motor imagery (from WallEEG) + speller
* implementation of 4-gesture motor imagery per hand + speller
* improvements
### Timeline
May 28--June 19: P300 speller
June 19--July 10:
2-gesture motor imagery
July 10--July 31:
4-gesture motor imagery + speller
# Meeting Notes
### Admin
* Meetings: 5--8pm Sundays, 5--7pm Wednesdays
### Development process
(agreed)
### Milestones
(agreed)
### Timeline
(agreed)
### Misc
(agreed)
# Dev Progress (6:00pm--8:00pm)
## Progress:
* init src repo, Conda envs
* reading over ZeroMQ, PyQt
* install: https://github.com/zeromq/pyzmq/wiki/Building-and-Installing-PyZMQ
* docs: http://learning-0mq-with-pyzmq.readthedocs.io/en/latest/pyzmq/basics.html
## Design Considerations
* Languages:
* Python and Android
* OpenBCI only supports Bluetooth to laptop!
* need to rewrite firmware
* https://www.youtube.com/watch?v=H03FZHyrSAI (translated by Abdel)
* ZeroMQ:
* publish subscribe pattern
* UDP socket
* because it's faster (even though TCP is more secure)
## Project 'Skillz'
This will help us assign tasks to each other. We'll use GitHub Issues as main task manager.
* Algs
* (Rustem)
* (Abel)
* (Riley)
* (Sayan)
* Signal processing
* (Abdel)
* (Sayan)
* GUI
* (Riley)
* (Sayan)
* software
* (Rustem)
* (Abdel)
* (Sayan)
* Testing
* (Alisa)
* (Sayan)
# Next Meeting: Wed May 31
* all of us: read through 0MQ
* Riley, Abdel: read about PyQt, and TouchUI
* https://github.com/harbaum/TouchUI
* Rustem: look at new OpenBCI code:
https://github.com/OpenBCI/OpenBCI_Python
* Sayan: port VitReous code over to OpenBCI
* Alisa: find P300 data
|
agpl-3.0
|
pgdurand/BeeDeeM
|
src/bzh/plealog/dbmirror/lucenedico/go/GeneOntologyOBONodeParser.java
|
15713
|
/* Copyright (C) 2007-2017 Patrick G. Durand
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* You may obtain a copy of the License at
*
* https://www.gnu.org/licenses/agpl-3.0.txt
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*/
package bzh.plealog.dbmirror.lucenedico.go;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import bzh.plealog.dbmirror.indexer.ParserMonitor;
import bzh.plealog.dbmirror.lucenedico.DicoParsable;
import bzh.plealog.dbmirror.lucenedico.DicoParserException;
import bzh.plealog.dbmirror.lucenedico.DicoStorageSystem;
import bzh.plealog.dbmirror.lucenedico.DicoUtils;
import bzh.plealog.dbmirror.util.Utils;
import bzh.plealog.dbmirror.util.conf.DBMSAbstractConfig;
/**
* Class which parses obo file and create, for each of terms a GeneOntologyTerm
* containing the name, the GO id, the ontology and the parents of the term.
*
* @author Patrick G. Durand
*
*/
public class GeneOntologyOBONodeParser implements DicoParsable {
// terms of the obo file
private HashMap<String, GeneOntologyTerm> _nodes = new HashMap<String, GeneOntologyTerm>();
private ParserMonitor _pMonitor;
private boolean _verbose = true;
private int _entries;
private static final Log LOGGER = LogFactory
.getLog(DBMSAbstractConfig.KDMS_ROOTLOG_CATEGORY
+ ".GeneOntologyOBONodeParser");
private static final String ROOT_GO = "GO:0003673";
private static final String ROOT_NAME = "Gene_Ontology";
private static final String BIO_PRO_GO = "GO:0008150";
private static final String BIO_PRO_ONT = "biological_process";
private static final String MOL_FUNC_GO = "GO:0003674";
private static final String MOL_FUNC_ONT = "molecular_function";
private static final String CELL_COMP_GO = "GO:0005575";
private static final String CELL_COMP_ONT = "cellular_component";
private static final String OBSO_BIOPRO_GO = "obsolete_Bp";
private static final String OBSO_BIOPRO_NAME = "obsolete_biological_process";
private static final String OBSO_MOLFUNC_GO = "obsolete_Mf";
private static final String OBSO_MOLFUNC_NAME = "obsolete_molecular_function";
private static final String OBSO_CELLCOMP_GO = "obsolete_Cc";
private static final String OBSO_CELLCOMP_NAME = "obsolete_cellular_component";
private static final String TERM = "[Term]";
private static final String ID = "id:";
private static final String NAME = "name:";
private static final String IS_OBSOLETE = "is_obsolete:";
private static final String NAMESPACE = "namespace:";
private static final String IS_A = "is_a:";
private static final String RELATIONSHIP = "relationship:";
private static final String PART_OF = "part_of";
private static final String REGULATES = "regulates";
private static final String POSITIVELY_REGULATES = "positively_regulates";
private static final String NEGATIVELY_REGULATES = "negatively_regulates";
private static final String TYPE_DEF = "[Typedef]";
private static final String ALT_ID = "alt_id";
private static final int IS_A_LENGTH = IS_A
.length();
private static final int PART_OF_LENGTH = PART_OF
.length();
private static final int REGULATES_LENGTH = REGULATES
.length();
private static final int POSITIVELY_REGULATES_LENGTH = POSITIVELY_REGULATES
.length();
private static final int NEGATIVELY_REGULATES_LENGTH = NEGATIVELY_REGULATES
.length();
private static final int RELATIONSHIP_LENGTH = RELATIONSHIP
.length();
public GeneOntologyOBONodeParser() {
_nodes = new HashMap<String, GeneOntologyTerm>();
_verbose = false;
_entries = 0;
}
/**
* Implementation of DicoParsable interface.
*/
public void setParserMonitor(ParserMonitor pm) {
_pMonitor = pm;
}
/**
* Initialize the root of the gene Ontology graph. [R O O T] / | \ bio_pro
* mol_func cell_comp | | | obso_bp obso_mf obso_cc
*/
private void initStructure() {
GeneOntologyTerm root = new GeneOntologyTerm(ROOT_GO, ROOT_NAME, null);
_nodes.put(ROOT_GO, root);
GeneOntologyTerm bio_p = new GeneOntologyTerm(BIO_PRO_GO, BIO_PRO_ONT,
BIO_PRO_ONT);
bio_p.add_parent(root, GeneOntologyTermRelationship.TYPE_EDGE.K);
_nodes.put(BIO_PRO_GO, bio_p);
GeneOntologyTerm mol_fun = new GeneOntologyTerm(MOL_FUNC_GO, MOL_FUNC_ONT,
MOL_FUNC_ONT);
mol_fun.add_parent(root, GeneOntologyTermRelationship.TYPE_EDGE.K);
_nodes.put(MOL_FUNC_GO, mol_fun);
GeneOntologyTerm cell_comp = new GeneOntologyTerm(CELL_COMP_GO,
CELL_COMP_ONT, CELL_COMP_ONT);
cell_comp.add_parent(root, GeneOntologyTermRelationship.TYPE_EDGE.K);
_nodes.put(CELL_COMP_GO, cell_comp);
GeneOntologyTerm o_bp = new GeneOntologyTerm(OBSO_BIOPRO_GO,
OBSO_BIOPRO_NAME, BIO_PRO_ONT);
o_bp.add_parent(bio_p, GeneOntologyTermRelationship.TYPE_EDGE.K);
_nodes.put(OBSO_BIOPRO_GO, o_bp);
GeneOntologyTerm o_mf = new GeneOntologyTerm(OBSO_MOLFUNC_GO,
OBSO_MOLFUNC_NAME, MOL_FUNC_ONT);
o_mf.add_parent(mol_fun, GeneOntologyTermRelationship.TYPE_EDGE.K);
_nodes.put(OBSO_MOLFUNC_GO, o_mf);
GeneOntologyTerm o_cc = new GeneOntologyTerm(OBSO_CELLCOMP_GO,
OBSO_CELLCOMP_NAME, CELL_COMP_ONT);
o_cc.add_parent(cell_comp, GeneOntologyTermRelationship.TYPE_EDGE.K);
_nodes.put(OBSO_CELLCOMP_GO, o_cc);
_entries = 6;
}
/**
* Create and inquire the differents fields of the GeneOntologyTerm created
* from parsed term.
*
* @param file
* the file ro process
* @param goIdTerm
* GO id of the term obtained by the "id" field
* @param nameAndOntology
* of the term obtained by the "name" field
* @param id_parent
* fathers of the term obtained by the "is_a/part_of/regulate" field
* @param edge
* type of the link between a term's parent and the term. depends on
* "is_a/part_of/regulate" field
* @param alternative_id
* alternative GO id of the term obtained by the "alt_id" field
* @param curPos
* current position in the file (butes)
*/
private void handleData(String file, String goIdTerm, String nameAndOntology,
ArrayList<String> id_parent,
ArrayList<GeneOntologyTermRelationship.TYPE_EDGE> edge,
ArrayList<String> alternative_id, long curPos) {
GeneOntologyTerm son;
GeneOntologyTerm father;
// Ignore the root to avoid bugs
if (goIdTerm != null && !goIdTerm.equals(ROOT_GO)
&& nameAndOntology != null) {
if (!_nodes.containsKey(goIdTerm)) {
son = new GeneOntologyTerm(goIdTerm, nameAndOntology);
_nodes.put(goIdTerm, son);
} else if (_nodes.get(goIdTerm).get_node_name() == null) {
son = _nodes.get(goIdTerm);
son.set_node_ontology(nameAndOntology);
son.set_node_name(nameAndOntology);
son.set_node_nameAndOntology(nameAndOntology);
} else {
son = _nodes.get(goIdTerm);
}
if (_pMonitor != null) {
_pMonitor.seqFound(goIdTerm, nameAndOntology, file, curPos, curPos,
false);
}
// For each father of the term scanned
for (int i = 0; i < id_parent.size(); i++) {
if (!_nodes.containsKey(id_parent.get(i))) {
father = new GeneOntologyTerm(id_parent.get(i));
son.add_parent(father, edge.get(i));
_nodes.put(father.get_node_id(), father);
} else {
father = _nodes.get(id_parent.get(i));
// add the father to the fatherlist of the current term and add the
// current term as son in the sonlist of the father term
son.add_parent(father, edge.get(i));
}
}
if (!alternative_id.isEmpty()) {
for (String alt_id : alternative_id) {
_nodes.put(alt_id, son);
}
}
if (_verbose && (_entries % 5000) == 0) {
System.out.println("Nb term parsed: " + _entries);
}
}
}
public static String prepareTerm(String name, String ontology) {
StringBuffer buf = new StringBuffer();
buf.delete(0, buf.length());
buf.append(DicoUtils.GO_NAME_KEY);
buf.append(name);
buf.append("|");
buf.append(DicoUtils.GO_ONTO_KEY);
if (ontology != null)
buf.append(ontology);
else
buf.append("unknown");
return buf.toString();
}
/**
* Parse the obo file
*/
public void parse(String file, DicoStorageSystem ss)
throws DicoParserException {
BufferedReader reader = null;
String line;
String go_iD = null;
String go_name = null;
String type = null;
String termPrepared;
String alt_id_term;
String ontology = null;
ArrayList<String> go_parent = new ArrayList<String>();
ArrayList<GeneOntologyTermRelationship.TYPE_EDGE> typeEdge = new ArrayList<GeneOntologyTermRelationship.TYPE_EDGE>();
ArrayList<String> alt_id = new ArrayList<String>();
int endOfLineSize, termCounter = 0;
long curPos = 0;
boolean stop = false;
try {
_entries = 0;
initStructure();
endOfLineSize = Utils.getLineTerminatorSize(file);
reader = new BufferedReader(new InputStreamReader(new FileInputStream(
file), "UTF-8"));
if (_pMonitor != null) {
_pMonitor.startProcessingFile(file, new File(file).length());
}
while ((line = reader.readLine()) != null && !stop) {
if (line.startsWith(TERM)) {
termCounter++;
termPrepared = prepareTerm(go_name, ontology);
handleData(file, go_iD, termPrepared, go_parent, typeEdge, alt_id,
curPos);
go_iD = ontology = go_name = type = null;
go_parent.clear();
typeEdge.clear();
alt_id.clear();
} else if (line.startsWith(ID)) {
go_iD = line.substring(3).trim();
} else if (line.startsWith(NAME)) {
go_name = line.substring(5).trim();
} else if (line.startsWith(NAMESPACE)) {
ontology = line.substring(10).trim();
} else if (line.startsWith(IS_OBSOLETE)) {
typeEdge.add(GeneOntologyTermRelationship.TYPE_EDGE.O);
if (ontology.equals(BIO_PRO_ONT)) {
go_parent.add(OBSO_BIOPRO_GO);
} else if (ontology.equals(MOL_FUNC_ONT)) {
go_parent.add(OBSO_MOLFUNC_GO);
} else if (ontology.equals(CELL_COMP_GO)) {
go_parent.add(OBSO_CELLCOMP_GO);
}
} else if (line.startsWith(IS_A)) {
typeEdge.add(GeneOntologyTermRelationship.TYPE_EDGE.I);
type = line.substring(IS_A_LENGTH + 1).trim().split("!")[0].trim();
go_parent.add(type);
} else if (line.startsWith(RELATIONSHIP)) {
type = line.substring(RELATIONSHIP_LENGTH + 1).trim().split("!")[0]
.trim();
if (type.startsWith(PART_OF)) {
typeEdge.add(GeneOntologyTermRelationship.TYPE_EDGE.P);
go_parent.add(type.substring(PART_OF_LENGTH + 1));
} else if (type.startsWith(REGULATES)) {
typeEdge.add(GeneOntologyTermRelationship.TYPE_EDGE.R);
go_parent.add(type.substring(REGULATES_LENGTH + 1));
} else if (type.startsWith(POSITIVELY_REGULATES)) {
typeEdge.add(GeneOntologyTermRelationship.TYPE_EDGE.U);
go_parent.add(type.substring(POSITIVELY_REGULATES_LENGTH + 1));
} else if (type.startsWith(NEGATIVELY_REGULATES)) {
typeEdge.add(GeneOntologyTermRelationship.TYPE_EDGE.N);
go_parent.add(type.substring(NEGATIVELY_REGULATES_LENGTH + 1));
}
} else if (line.startsWith(TYPE_DEF)) {
stop = true;
} else if (line.startsWith(ALT_ID)) {
alt_id_term = line.substring(7).trim();
alt_id.add(alt_id_term);
}
curPos += (long) (line.length() + endOfLineSize);
}
// handle last term
termPrepared = prepareTerm(go_name, ontology);
handleData(file, go_iD, termPrepared, go_parent, typeEdge, alt_id, curPos);
// add Term in a Lucene index
indexingSequences(ss);
} catch (Exception e) {
String msg = "Error while parsing GeneOntology entry no. "
+ (termCounter + 1);
LOGGER.warn(msg + ": " + e);
throw new DicoParserException(msg + ": " + e.getMessage());
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
}
}
if (_pMonitor != null) {
_pMonitor.stopProcessingFile(file, _entries);
}
}
if (_entries == 0)
throw new DicoParserException("Data file does not contain any terms.");
}
public HashMap<String, GeneOntologyTerm> get_nodes() {
return _nodes;
}
/**
* For each term found, we add it in a Lucene index
*
* @param ss
* link to index
*/
private void indexingSequences(DicoStorageSystem ss) {
GeneOntologyTerm term;
Object[] keys = _nodes.keySet().toArray();
int size;
size = keys.length;
_entries += size;
for (int i = 0; i < size; i++) {
term = _nodes.get(keys[i]);
if (ss != null) {
ss.addBinaryEntry((String) keys[i], term);
}
}
}
/**
* Implementation of DicoParsable interface.
*/
public void setVerbose(boolean verbose) {
_verbose = verbose;
}
public int getTerms() {
return _entries;
}
}
|
agpl-3.0
|
kevin8909/xjerp
|
openerp/addons/Rainsoft_Xiangjie/rainsoft_stock_return.py
|
185
|
#coding:utf-8
from openerp.osv import osv,fields
class rainsoft_stock_return(osv.Model):
_inherit='stock.return.picking'
_defaults={
'invoice_state': '2binvoiced',
}
|
agpl-3.0
|
s40523222/2016fallcp_hw
|
content/20161114.md
|
1304
|
Title: W10 Brython 繪圖範例
Date: 2016-11-14 12:00
Category: Misc
Tags: 使用導引
Author: 40523222
Brython 繪圖
繪圖流程, 導入程式庫, 啟動, 然後引用各種模組開始繪圖
<!-- PELICAN_END_SUMMARY -->
<!-- 導入 Brython 標準程式庫 -->
<script type="text/javascript"
src="https://cdn.rawgit.com/brython-dev/brython/master/www/src/brython_dist.js">
</script>
<!-- 啟動 Brython -->
<script>
window.onload=function(){
brython(1);
}
</script>
<!-- 以下實際利用 Brython 畫兩條直線 -->
<canvas id="japanflag1" width="600" height="200"></canvas>
<script type="text/python3">
from browser import document as doc
import math
# 準備繪圖畫布
canvas = doc["japanflag1"]
ctx = canvas.getContext("2d")
# 以下可以利用 ctx 物件進行畫圖
# 先畫一條直線
ctx.beginPath()
# 設定線的寬度為 1 個單位
ctx.lineWidth = 1
# 將畫筆移動到 (100, 100) 座標點
ctx.moveTo(100, 100)
# 然後畫直線到 (150, 200) 座標點
ctx.lineTo(150, 200)
# 畫右上左下的斜線
ctx.moveTo(150, 100)
ctx.lineTo(100, 200)
# 設定顏色為藍色, 也可以使用 "rgb(0, 0, 255)" 字串設定顏色值
ctx.strokeStyle = "blue"
# 實際執行畫線
ctx.stroke()
ctx.closePath()
</script>
|
agpl-3.0
|
ChuckDaniels87/pydio-core
|
core/src/plugins/core.ocs/src/ActionsController.php
|
6752
|
<?php
/*
* Copyright 2007-2015 Abstrium <contact (at) pydio.com>
* This file is part of Pydio.
*
* Pydio is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pydio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Pydio. If not, see <http://www.gnu.org/licenses/>.
*
* The latest code can be found at <https://pydio.com>.
*/
namespace Pydio\OCS;
use GuzzleHttp\Client;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Pydio\Cache\Core\CacheStreamLayer;
use Pydio\Core\Exception\PydioException;
use Pydio\Core\Model\Context;
use Pydio\Core\Model\ContextInterface;
use Pydio\Core\Services\ConfService;
use Pydio\Core\Utils\Vars\InputFilter;
use Pydio\Log\Core\Logger;
use Pydio\OCS\Client\OCSClient;
use Pydio\OCS\Model\SQLStore;
use Zend\Diactoros\Response\JsonResponse;
defined('AJXP_EXEC') or die('Access not allowed');
/**
* Class ActionsController
* @package Pydio\OCS
*/
class ActionsController
{
private $configs;
/**
* ActionsController constructor.
* @param $configs
*/
public function __construct($configs){
$this->configs = $configs;
}
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @return null
* @throws PydioException
* @throws \Exception
*/
public function switchAction(ServerRequestInterface &$request, ResponseInterface &$response) {
/** @var ContextInterface $ctx */
$ctx = $request->getAttribute("ctx");
$action = $request->getAttribute("action");
$httpVars = $request->getParsedBody();
switch($action){
case "user_list_authorized_users":
if(isSet($httpVars['trusted_server_id'])){
$this->forwardUsersListToRemote($request, $response);
}
break;
case "accept_invitation":
$remoteShareId = InputFilter::sanitize($httpVars["remote_share_id"], InputFilter::SANITIZE_ALPHANUM);
$store = new SQLStore();
$remoteShare = $store->remoteShareById($remoteShareId);
if($remoteShare === null){
throw new PydioException("Cannot find remote share with ID ".$remoteShareId);
}
$client = new OCSClient();
$client->acceptInvitation($remoteShare);
$remoteShare->setStatus(OCS_INVITATION_STATUS_ACCEPTED);
$store->storeRemoteShare($remoteShare);
$urlBase = $ctx->getUrlBase();
CacheStreamLayer::clearDirCache($urlBase);
CacheStreamLayer::clearStatCache($urlBase . "/" . $remoteShare->getDocumentName());
$remoteCtx = new Context($remoteShare->getUser(), "ocs_remote_share_" . $remoteShare->getId());
CacheStreamLayer::clearStatCache($remoteCtx->getUrlBase());
break;
case "reject_invitation":
$remoteShareId = InputFilter::sanitize($httpVars["remote_share_id"], InputFilter::SANITIZE_ALPHANUM);
$store = new SQLStore();
$remoteShare = $store->remoteShareById($remoteShareId);
if($remoteShare === null){
throw new PydioException("Cannot find remote share with ID ".$remoteShareId);
}
$client = new OCSClient();
try {
$client->declineInvitation($remoteShare);
} catch (\Exception $e) {
// If the reject fails, we still want the share to be removed from the db
Logger::error(__CLASS__,"Exception",$e->getMessage());
}
$store->deleteRemoteShare($remoteShare);
ConfService::getInstance()->invalidateLoadedRepositories();
$urlBase = $ctx->getUrlBase();
CacheStreamLayer::clearDirCache($urlBase);
CacheStreamLayer::clearStatCache($urlBase . "/" . $remoteShare->getDocumentName());
$remoteCtx = new Context($remoteShare->getUser(), "ocs_remote_share_" . $remoteShare->getId());
CacheStreamLayer::clearStatCache($remoteCtx->getUrlBase());
break;
default:
break;
}
return null;
}
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $responseInterface
* @throws PydioException
*/
protected function forwardUsersListToRemote(ServerRequestInterface &$request, ResponseInterface &$responseInterface){
$httpVars = $request->getParsedBody();
$searchQuery = InputFilter::sanitize($httpVars['value'], InputFilter::SANITIZE_HTML_STRICT);
$trustedServerId = InputFilter::sanitize($httpVars['trusted_server_id'], InputFilter::SANITIZE_ALPHANUM);
if(!isSet($this->configs["TRUSTED_SERVERS"]) || !isSet($this->configs["TRUSTED_SERVERS"][$trustedServerId])){
throw new PydioException("Cannot find trusted server with id " . $trustedServerId);
}
$serverData = $this->configs["TRUSTED_SERVERS"][$trustedServerId];
$url = $serverData['url'] . '/api/pydio/user_list_authorized_users/' . $searchQuery;
$params = [
'format' => 'json',
'users_only' => 'true',
'existing_only' => 'true',
'exclude_current' => 'false'
];
$client = new Client();
$postResponse = $client->post($url, [
'headers' => [
'Authorization' => 'Basic ' . base64_encode($serverData['user'] . ':' . $serverData['pass'])
],
'body' => $params
]);
$body = $postResponse->getBody()->getContents();
$jsonContent = json_decode($body);
foreach($jsonContent as $userEntry){
$userEntry->trusted_server_id = $trustedServerId;
$userEntry->trusted_server_label = $serverData['label'];
}
$httpVars['processed'] = true;
$request = $request->withParsedBody($httpVars);
$responseInterface = new JsonResponse($jsonContent);
}
}
|
agpl-3.0
|
qoollo/bricksdb
|
src/BriksDb.RedisInterface/Server/RedisToBriks.cs
|
1543
|
using System;
using BricksDb.RedisInterface.BriksCommunication;
using BricksDb.RedisInterface.RedisOperations;
using Qoollo.Client.Configuration;
using Qoollo.Client.Support;
namespace BricksDb.RedisInterface.Server
{
class RedisToBriks : RedisToSmthSystem
{
private readonly RedisGate _redisGate;
public RedisToBriks()
{
_redisGate = new RedisGate(
new NetConfiguration(ConfigurationHelper.Instance.Localhost, 8000, Consts.WcfServiceName),
new ProxyConfiguration(Consts.ChangeDistributorTimeoutSec),
new CommonConfiguration(ConfigurationHelper.Instance.CountThreads));
}
protected override void InnerBuild(RedisMessageProcessor processor)
{
_redisGate.Build();
processor.AddOperation("SET", new RedisSet(new ProxyDataAdapter(_redisGate.RedisTable), "SET"));
processor.AddOperation("GET", new RedisGet(new ProxyDataAdapter(_redisGate.RedisTable), "GET"));
}
public override void Start()
{
_redisGate.Start();
var result = _redisGate.RedisTable.SayIAmHere(ConfigurationHelper.Instance.DistributorHost,
ConfigurationHelper.Instance.DistributorPort);
Console.WriteLine(result);
base.Start();
}
public override void Stop()
{
base.Stop();
_redisGate.Dispose();
}
}
}
|
agpl-3.0
|
siddharthadeshpande89/jive-content-manager
|
apps/content_manager/public/javascripts/helpers/messageViewHandler.js
|
2511
|
/*
This file is part of ContentManager.
ContentManager is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ContentManager is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with ContentManager. If not, see <http://www.gnu.org/licenses/>.
*/
var messageHandler = {
displayInfoMessage : function (message) {
var messageJson = {messageClass : "alert-info", message : message}
$("#app-message").html(Mustache.render($('#message-template').html() ,messageJson));
setTimeout(function(){
$("#app-message").html('');
},1500)
},
displayLoadMessage : function (message) {
var messageJson = {message : message}
$("#app-message").html(Mustache.render($('#message-template').html() ,messageJson));
},
displayErrorMessage : function (message) {
var messageJson = {messageClass : "alert-danger", message : message}
$("#app-message").html(Mustache.render($('#message-template').html() ,messageJson));
setTimeout(function(){
$("#app-message").html('');
},3000)
},
resetMessage : function(){
$("#app-message").html(Mustache.render($('#message-template').html() ,{}));
},
showJiveErrorMessage : function(message){
osapi.jive.core.container.sendNotification( {'message':message, 'severity' : 'error'} );
},
getCurrentMessage : function(){
return $("#app-message").text()
},
displayTagErrorMessage : function (message) {
var messageJson = {messageClass : "alert-danger", message : message}
$("#tag-message").html(Mustache.render($('#message-template').html() ,messageJson));
setTimeout(function(){
$("#tag-message").html('');
},1500)
},
displayCategoryErrorMessage : function(message){
var messageJson = {messageClass : "alert-danger", message : message}
$("#category-message").html(Mustache.render($('#message-template').html() ,messageJson));
setTimeout(function(){
$("#category-message").html('');
},1500)
}
}
|
agpl-3.0
|
kolplex/cunity
|
style/CunityRefreshed/javascript/cunity-core.js
|
14280
|
var origShow = jQuery.fn.show, origHide = jQuery.fn.hide;
jQuery.fn.show = function() {
$(this).removeClass("hidden");
return origShow.apply(this, arguments);
};
jQuery.fn.hide = function() {
$(this).addClass("hidden");
return origHide.apply(this, arguments);
};
$.ajaxSetup({
cache: false
});
function onBlur() {
document.body.className = 'blurred';
}
function onFocus() {
document.body.className = 'focused';
}
function getNotification(type) {
sendRequest({type: type}, "notifications", "get", function(res) {
$("#notification-dropdown").html(function() {
var str = "";
if (type !== "messages") {
if (res.result !== null && typeof res.result !== "undefined" && res.result.length > 0) {
for (x in res.result)
str += tmpl("notification-" + type, res.result[x]);
} else
str = tmpl("notification-empty", {});
return str;
} else if (type === "messages") {
if (res.conversations !== null && typeof res.conversations !== "undefined" && res.conversations.length > 0) {
$.getJSON(siteurl + "style/" + design + "/img/emoticons/emoticons.json", function(data) {
smileys = new Array();
for (x in data)
smileys[data[x]] = '<img src="' + siteurl + 'style/' + design + '/img/emoticons/' + data[x] + '.png" class="message-smiley" data-key="' + data[x] + '">';
for (con in res.conversations) {
var c = res.conversations[con], i = 0, image = null;
if (c.users !== null && typeof c.users === "string") {
us = c.users.split(","), userstring = "";
for (user in us) {
if (i === 2) {
userstring += ", +" + (us.length - 2);
break;
}
var tmp = us[user].split("|");
userstring += ", " + tmp[0];
i++;
}
userstring = userstring.substr(2);
} else if (c.users !== null & typeof c.users === "object") { // there is only one user
userstring = c.users.name;
image = c.users.pimg;
} else
userstring = "None";
c.message = c.message.substr(0, 35);
for (x in smileys)
c.message = replaceAll('[:' + x + ':]', smileys[x], c.message);
str += tmpl("notification-messages", {name: userstring, message: c.message, conversation: c.conversation, sendername: c.sendername, time: c.time, image: checkImage(image, "users", "cr_")});
}
$("#notification-dropdown").html(str);
return;
});
} else
return tmpl("notification-empty", {});
}
}).removeClass("notification-messages notification-friends notification-general").addClass("notification-" + type).show();
});
}
function sendRequest(requestData, module, action, callback) {
if (typeof requestData !== "undefined") {
return $.ajax({
url: convertUrl({module: module, action: action}),
dataType: "json",
data: requestData,
type: 'POST',
success: function(data) {
if (typeof data.session !== "undefined" && data.session === 0) {
alert("Your session is timed out! Please login again!");
location.href = convertUrl({module: "start"});
} else if (data.status == false) {
if (typeof data.msg == "undefined")
data.msg = "Error";
bootbox.alert(data.msg);
} else if (typeof callback == 'function') {
callback(data);
refreshTime();
}
}
});
}
return null;
}
function convertUrl(data) {
if (modrewrite) {
var str = siteurl + data.module;
if (typeof data.action !== "undefined" && data.action !== null)
str += "/" + data.action;
if (typeof data.x !== "undefined" && data.x !== null)
str += "/" + data.x;
if (typeof data.y !== "undefined" && data.y !== null)
str += "/" + data.y;
return str;
} else {
var str = siteurl + "index.php?m=" + data.module;
if (typeof data.action !== "undefined" && data.x !== null)
str += "&action=" + data.action;
if (typeof data.x !== "undefined" && data.x !== null)
str += "&x=" + data.y;
if (typeof data.y !== "undefined" && data.x !== null)
str += "&y=" + data.y;
return str;
}
}
function checkImage(filename, type, prefix) {
prefix = (typeof prefix === "undefined") ? "" : prefix;
if (filename === null || typeof filename === "undefined" || filename.length === 0)
return siteurl + 'style/' + design + '/img/placeholders/noimg-' + type + '.png';
return prefix + filename;
}
function getErrorMessage(tplname) {
return tmpl(tplname, {});
}
function like(ref_name, ref_id, callback) {
sendRequest({"ref_name": ref_name, "ref_id": ref_id}, "likes", "like", callback);
}
function dislike(ref_name, ref_id, callback) {
sendRequest({"ref_name": ref_name, "ref_id": ref_id}, "likes", "dislike", callback);
}
function unlike(ref_name, ref_id, callback) {
sendRequest({"ref_name": ref_name, "ref_id": ref_id}, "likes", "unlike", callback);
}
function comment(ref_name, ref_id, content, callback) {
sendRequest({"ref_name": ref_name, "ref_id": ref_id, "content": content}, "comments", "add", callback);
}
function deleteComment(comment_id) {
bootbox.confirm("Are You sure you want to delete this comment?", function(r) {
if (r) {
sendRequest({"comment_id": comment_id}, "comments", "remove", function() {
$("#comment-" + comment_id).remove();
});
}
});
}
function getLikes(refname, refid, dislike, title) {
sendRequest({"ref_name": refname, "ref_id": refid, "dislike": dislike}, "likes", "get", function(res) {
if (typeof res.likes !== "undefined" && res.likes.length > 0) {
bootbox.dialog({
message: function() {
var msg = "";
for (x in res.likes)
msg += tmpl("like-list", res.likes[x]);
return '<div class="likesmodalbox">' + msg + '</div>';
},
title: title,
buttons: {
main: {
label: "Ok",
className: "btn-primary"
}
},
className: "likelistmodal"
});
}
});
}
function refreshTime() {
$(".timestring").each(function() {
var el = $(this);
el.replaceWith(function() {
return convertDate(el.data("source"));
});
});
$(".tooltip").remove();
$(".tooltip-trigger").tooltip({
container: 'body'
});
}
function convertDate(timestring) {
if (typeof timestring == "undefined" || timestring === "" || timestring === null)
return "NaN";
var now = new Date();
var then = new Date(timestring.replace(/-/g, '/'));
var r = "";
then.setMinutes(then.getMinutes() + now.getTimezoneOffset() * (-1));
var since = Math.round((now.getTime() - then.getTime()) / 1000);
var chunks = [
[22896000, 'year'],
[2592000, 'month'],
[604800, 'week'],
[86400, 'day'],
[3600, 'hour'],
[60, 'minute']
];
if (since < 60)
r = "just now";
else {
var count;
for (i = 0, j = chunks.length; i < j; i++) {
seconds = chunks[i][0];
name = chunks[i][1];
count = Math.floor(since / seconds);
if (count !== 0)
break;
}
r = ((count === 1) ? '1 ' + name : count + " " + name + "s") + " ago";
}
return '<span class="tooltip-trigger timestring" data-source="' + timestring + '" data-title="' + then.toLocaleString() + '">' + r + '</span>';
}
function escapeRegExp(string) {
return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");
}
function replaceAll(find, replace, str) {
return str.replace(new RegExp(escapeRegExp(find), 'g'), replace);
}
$(document).ready(function() {
if (/*@cc_on!@*/false) { // check for Internet Explorer
document.onfocusin = onFocus;
document.onfocusout = onBlur;
} else {
window.onfocus = onFocus;
window.onblur = onBlur;
}
$(".sidebar").css("minHeight", window.innerHeight - 101);
$('input.filefakeinput').change(function() {
$($(this).data("rel")).val($(this).val());
});
$('.dropdown-menu').on('click', function(e) {
if ($(this).hasClass('dropdown-checkbox-menu')) {
e.stopPropagation();
}
});
$('.btn[data-loading-text]').click(function() {
$(this).button('loading');
});
$("a[href=\"#\"],a[href=\"\"]").click(function(e) {
e.preventDefault();
});
$("#mobile-slide-nav > .mobile-menu").html($(".main-menu > .nav").html());
$(document).on("click", "#menu-trigger", function() {
if (login) {
if ($("body").hasClass("menu-active"))
$("body").removeClass("menu-active");
else
$("body").addClass("menu-active");
} else
location.href = convertUrl({module: "start"});
}).on("mouseenter", ".notification-general-item:not(.read)", function() {
var el = $(this);
sendRequest({id: el.data("id")}, "notifications", "markRead", function() {
el.addClass("read");
el.find(".label-new").fadeOut("slow");
});
});
if (login) {
//Load unread messages badge
sendRequest({type: "messages"}, "notifications", "get", function(res) {
if (typeof res.conversations !== "undefined" && res.conversations.length > 0) {
$(".main-menu-item-messages > a > .badge").html(res.conversations.length);
$(".notification-link-messages").addClass("active");
} else
$(".notification-link-messages").removeClass("active");
});
sendRequest({type: "friends"}, "notifications", "get", function(res) {
if (typeof res.result !== "undefined" && res.result !== null && res.result.length > 0) {
$(".main-menu-item-friends > a > .badge").html(res.result.length);
$(".notification-link-friends").addClass("active");
} else
$(".notification-link-friends").removeClass("active");
});
sendRequest({type: "general"}, "notifications", "get", function(res) {
if (res.new > 0)
$(".notification-link-general").addClass("active");
else
$(".notification-link-general").removeClass("active");
});
}
$(document).on("click", "a.close", function(e) {
e.stopPropagation();
});
$(document).on("submit", "form.ajaxform", function(e) {
e.preventDefault();
var form = $(this);
form.find("input[type='submit'],button[type='submit']").button('loading');
if (form.prop("ajaxform-send") === true)
return;
if (form.attr("enctype") === "multipart/form-data") {
var name = "ajaxformframe" + Math.random();
var frame = $("<iframe/>", {"name": name, class: "hidden"}).appendTo(form);
form.attr("target", name).prop("ajaxform-send", true).submit();
frame.on("load", function() {
form.find("input[type='submit'],button[type='submit']").button('reset');
if (form.find(".ajaxform-callback").length > 0) {
console.log(frame.contents().find('body').html());
var callback = window[form.find(".ajaxform-callback").val()];
if (typeof callback === "function")
callback(jQuery.parseJSON(frame.contents().find('body').html()));
}
});
} else {
$.ajax({
type: form.attr('method'),
url: form.attr('action'),
data: form.serialize(),
dataType: "json"
}).done(function(data) {
form.find("input[type='submit'],button[type='submit']").button('reset');
if (form.find(".ajaxform-callback").length > 0) {
var callback = window[form.find(".ajaxform-callback").val()];
if (data.status === false) {
bootbox.alert(data.msg);
} else if (typeof callback === "function")
callback(data);
}
});
}
}).on("click", function(e) {
if ($(e.target).attr("id") !== "notification-dropdown" && $("#notification-dropdown").length > 0)
$("#notification-dropdown").hide();
});
$("#infoModal").on('show.bs.modal', function(e) {
$("#infoModal").find(".modal-title").html($(e.relatedTarget).data("title"));
if (typeof $(e.relatedTarget).data("href") !== "undefined")
$("#infoModal").find(".modal-body").html('<iframe src="' + $(e.relatedTarget).data("href") + '" style="border:0;width:100%"></iframe>').css("padding", 10);
});
$("*[data-moveto]").each(function() {
$(this).appendTo($(this).data("moveto")).removeAttr("data-moveto");
});
});
|
agpl-3.0
|
hlmnrmr/superdesk-core
|
apps/archive_history/service.py
|
3708
|
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import logging
from eve.utils import config
from copy import deepcopy
from superdesk import get_resource_service
from superdesk.resource import Resource
from superdesk.services import BaseService
from apps.archive.common import ITEM_UPDATE, get_user, ITEM_CREATE
from superdesk.metadata.item import CONTENT_STATE, ITEM_STATE
from superdesk.utc import utcnow
log = logging.getLogger(__name__)
fields_to_remove = ['_id', '_etag', 'versioncreator', 'originalcreator', 'versioncreated',
'_current_version', 'version', '_updated', 'lock_session', 'lock_user', 'lock_time', 'lock_action',
'force_unlock', '_created', 'guid', 'family_id', 'firstcreated', 'original_creator']
class ArchiveHistoryResource(Resource):
endpoint_name = 'archive_history'
resource_methods = ['GET']
item_methods = ['GET']
schema = {
'item_id': {'type': 'string'},
'user_id': Resource.rel('users', True),
'operation': {'type': 'string'},
'update': {'type': 'dict', 'nullable': True},
'version': {'type': 'integer'},
'original_item_id': {'type': 'string'}
}
mongo_indexes = {'item_id': ([('item_id', 1)], {'background': True})}
class ArchiveHistoryService(BaseService):
def on_item_updated(self, updates, original, operation=None):
item = deepcopy(original)
if updates:
item.update(updates)
self._save_history(item, updates, operation or ITEM_UPDATE)
def on_item_deleted(self, doc):
lookup = {'item_id': doc[config.ID_FIELD]}
self.delete(lookup=lookup)
def get_user_id(self, item):
user = get_user()
if user:
return user.get(config.ID_FIELD)
def _save_history(self, item, update, operation):
# in case of auto-routing, if the original_creator exists in our database
# then create item create record in the archive history.
if item.get(ITEM_STATE) == CONTENT_STATE.ROUTED and item.get('original_creator') \
and not item.get('original_id'):
user = get_resource_service('users').find_one(req=None, _id=item.get('original_creator'))
firstcreated = item.get('firstcreated', utcnow())
if user:
history = {
'item_id': item[config.ID_FIELD],
'user_id': user.get(config.ID_FIELD),
'operation': ITEM_CREATE,
'update': self._remove_unwanted_fields(update, item),
'version': item.get(config.VERSION, 1),
'_created': firstcreated,
'_updated': firstcreated
}
self.post([history])
history = {
'item_id': item[config.ID_FIELD],
'user_id': self.get_user_id(item),
'operation': operation,
'update': self._remove_unwanted_fields(update, item),
'version': item.get(config.VERSION, 1)
}
self.post([history])
def _remove_unwanted_fields(self, update, original):
if update:
update_copy = deepcopy(update)
for field in fields_to_remove:
update_copy.pop(field, None)
if original.get('sms_message') == update_copy.get('sms_message'):
update_copy.pop('sms_message', None)
return update_copy
|
agpl-3.0
|
mauriciopasquier/bibliotecadeleter
|
test/controllers/artistas_controller_test.rb
|
1366
|
# encoding: utf-8
require './test/test_helper'
describe ArtistasController do
let(:artista) { create(:artista) }
describe 'anónimamente' do
it 'accede al index' do
get :index
must_respond_with :success
assigns(:artistas).wont_be_nil
end
it 'muestra un artista' do
get :show, id: artista
must_respond_with :success
end
it 'no accede a edit' do
get :edit, id: artista
must_redirect_to :root
end
it 'no actualiza' do
put :update, id: artista, artista: attributes_for(:artista)
must_redirect_to :root
end
it 'no destruye' do
delete :destroy, id: artista
must_redirect_to :root
end
end
describe 'logueado' do
before { loguearse }
describe 'con permisos' do
it 'accede a edit' do
autorizar { get :edit, id: artista }
must_respond_with :success
end
it 'actualiza' do
autorizar { put :update, id: artista, artista: { nombre: 'Juan Salvo' } }
must_redirect_to assigns(:artista)
artista.reload.nombre.must_equal 'Juan Salvo'
end
it 'destruye' do
artista.must_be :persisted?
lambda do
autorizar { delete :destroy, id: artista }
end.must_change 'Artista.count', -1
must_redirect_to artistas_path
end
end
end
end
|
agpl-3.0
|
FiloSpaTeam/thinks
|
doc/api/files/__/__/__/__/usr/local/lib64/ruby/gems/2_1_0/gems/activerecord-4_2_3/lib/active_record/associations/preloader/collection_association_rb.html
|
2726
|
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>collection_association.rb</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../../../../../../../../../../../../../../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../../../../../../../../../../../../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../../../../../../../../../../../../../../css/github.css" type="text/css" media="screen" />
<script src="../../../../../../../../../../../../../../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../../../../../../../../../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../../../../../../../../../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../../../../../../../../../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<span>Ruby on Rails 4.2.3</span><br />
<h1>
collection_association.rb
</h1>
<ul class="files">
<li>
../../../../usr/local/lib64/ruby/gems/2.1.0/gems/activerecord-4.2.3/lib/active_record/associations/preloader/collection_association.rb
</li>
<li>Last modified: 2015-08-02 14:44:45 +0200</li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- Namespace -->
<div class="sectiontitle">Namespace</div>
<ul>
<li>
<span class="type">MODULE</span>
<a href="../../../../../../../../../../../../../../../../../classes/ActiveRecord.html">ActiveRecord</a>
</li>
<li>
<span class="type">MODULE</span>
<a href="../../../../../../../../../../../../../../../../../classes/ActiveRecord/Associations.html">ActiveRecord::Associations</a>
</li>
<li>
<span class="type">CLASS</span>
<a href="../../../../../../../../../../../../../../../../../classes/ActiveRecord/Associations/Preloader.html">ActiveRecord::Associations::Preloader</a>
</li>
</ul>
<!-- Methods -->
</div>
</div>
</body>
</html>
|
agpl-3.0
|
mikebryant/rapid-router
|
game/static/game/js/blocklyCustomBlocks.js
|
20655
|
/*
Code for Life
Copyright (C) 2015, Ocado Innovation Limited
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
ADDITIONAL TERMS – Section 7 GNU General Public Licence
This licence does not grant any right, title or interest in any “Ocado” logos,
trade names or the trademark “Ocado” or any other trademarks or domain names
owned by Ocado Innovation Limited or the Ocado group of companies or any other
distinctive brand features of “Ocado” as may be secured from time to time. You
must not distribute any modification of this program using the trademark
“Ocado” or claim any affiliation or association with Ocado or its employees.
You are not authorised to use the name Ocado (or any of its trade names) or
the names of any author or contributor in advertising or for publicity purposes
pertaining to the distribution of this program, without the prior written
authorisation of Ocado.
Any propagation, distribution or conveyance of this program must include this
copyright notice and these terms. You must not misrepresent the origins of this
program; modified versions of the program must be marked as such and not
identified as the original program.
*/
'use strict';
var ocargo = ocargo || {};
var Blockly = Blockly || {};
function initCustomBlocks() {
initCustomBlocksDescription();
initCustomBlocksPython();
}
function initCustomBlocksDescription() {
Blockly.Blocks['start'] = {
// Beginning block - identifies the start of the program
init: function() {
ocargo.blocklyControl.numStartBlocks++;
this.setColour(50);
this.appendDummyInput()
.appendField('Start')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + CHARACTER_EN_FACE_URL,
ocargo.BlocklyControl.BLOCK_CHARACTER_HEIGHT,
ocargo.BlocklyControl.BLOCK_CHARACTER_WIDTH));
this.setNextStatement(true, 'Action');
this.setTooltip('The beginning of the program');
this.setDeletable(false);
}
};
/*****************/
/* Action Blocks */
/*****************/
Blockly.Blocks['move_forwards'] = {
// Block for moving forward
init: function() {
this.setColour(160);
this.appendDummyInput()
.appendField('move forwards')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'actions/forward.svg',
ocargo.BlocklyControl.IMAGE_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
this.setPreviousStatement(true, 'Action');
this.setNextStatement(true, 'Action');
this.setTooltip('Move the van forwards');
}
};
Blockly.Blocks['turn_left'] = {
// Block for turning left
init: function() {
this.setColour(160);
this.appendDummyInput()
.appendField('turn left')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
38,
ocargo.BlocklyControl.BLOCK_HEIGHT))
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'actions/left.svg',
ocargo.BlocklyControl.IMAGE_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
this.setPreviousStatement(true, 'Action');
this.setNextStatement(true, 'Action');
this.setTooltip('Turn the van left');
}
};
Blockly.Blocks['turn_right'] = {
// Block for turning right
init: function() {
this.setColour(160);
this.appendDummyInput()
.appendField('turn right')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
29,
ocargo.BlocklyControl.BLOCK_HEIGHT))
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'actions/right.svg',
ocargo.BlocklyControl.IMAGE_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
this.setPreviousStatement(true, 'Action');
this.setNextStatement(true, 'Action');
this.setTooltip('Turn the van right');
}
};
Blockly.Blocks['turn_around'] = {
// Block for turning around
init: function() {
this.setColour(160);
this.appendDummyInput()
.appendField('turn around')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
12,
ocargo.BlocklyControl.BLOCK_HEIGHT))
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir +
'actions/turn_around.svg',
ocargo.BlocklyControl.IMAGE_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
this.setPreviousStatement(true, 'Action');
this.setNextStatement(true, 'Action');
this.setTooltip('Turn the van around');
}
};
Blockly.Blocks['wait'] = {
// Block for not moving the van for a time
init: function() {
this.setColour(160);
this.appendDummyInput()
.appendField('wait')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
60,
ocargo.BlocklyControl.BLOCK_HEIGHT))
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'actions/wait.svg',
ocargo.BlocklyControl.IMAGE_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
this.setPreviousStatement(true, 'Action');
this.setNextStatement(true, 'Action');
this.setTooltip('Keep the van stationary');
}
};
Blockly.Blocks['deliver'] = {
// Block for delivering (only on levels with multiple destinations)
init: function() {
this.setColour(160);
this.appendDummyInput()
.appendField('deliver')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
43,
ocargo.BlocklyControl.BLOCK_HEIGHT))
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'actions/deliver.svg',
ocargo.BlocklyControl.IMAGE_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
this.setPreviousStatement(true, 'Action');
this.setNextStatement(true, 'Action');
this.setTooltip('Deliver the goods from the van');
}
};
Blockly.Blocks['puff_up'] = {
// Block for puffing up the van
init: function() {
this.setColour(330);
this.appendDummyInput()
.appendField('puff up')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
43,
ocargo.BlocklyControl.BLOCK_HEIGHT))
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
ocargo.BlocklyControl.IMAGE_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
this.setPreviousStatement(true, 'EventAction');
this.setNextStatement(false);
this.setTooltip('Puff up the van to scare away the cows');
}
};
Blockly.Blocks['sound_horn'] = {
// Block for puffing up the van
init: function() {
this.setColour(330);
this.appendDummyInput()
.appendField('sound horn')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
43,
ocargo.BlocklyControl.BLOCK_HEIGHT))
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
ocargo.BlocklyControl.IMAGE_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
this.setPreviousStatement(true, 'EventAction');
this.setNextStatement(false);
this.setTooltip('Sound the horn to scare away the cows');
}
};
/*****************/
/* Conditions */
/*****************/
Blockly.Blocks['road_exists'] = {
init: function() {
var BOOLEANS =
[['road exists forward', 'FORWARD'],
['road exists left', 'LEFT'],
['road exists right', 'RIGHT']];
this.setColour(210);
this.setOutput(true, 'Boolean');
this.appendDummyInput()
.appendField(new Blockly.FieldDropdown(BOOLEANS), 'CHOICE')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
}
};
Blockly.Blocks['traffic_light'] = {
init: function() {
var BOOLEANS =
[['traffic light red', ocargo.TrafficLight.RED],
['traffic light green', ocargo.TrafficLight.GREEN]];
this.setColour(210);
this.setOutput(true, 'Boolean');
this.appendDummyInput()
.appendField(new Blockly.FieldDropdown(BOOLEANS), 'CHOICE')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
}
};
Blockly.Blocks['dead_end'] = {
init: function() {
this.setColour(210);
this.setOutput(true, 'Boolean');
this.appendDummyInput()
.appendField('is dead end')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
}
};
Blockly.Blocks['at_destination'] = {
init: function() {
this.setColour(210);
this.setOutput(true, 'Boolean');
this.appendDummyInput()
.appendField('at destination')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
}
};
/****************/
/* Procedures */
/****************/
Blockly.Blocks['call_proc'] = {
// Block for calling a defined procedure
init: function() {
var name = '';
this.setColour(260);
this.appendDummyInput()
.appendField('Call')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg', 7,
ocargo.BlocklyControl.BLOCK_HEIGHT))
.appendField(new Blockly.FieldTextInput(name),'NAME');
this.setPreviousStatement(true, 'Action');
this.setNextStatement(true, 'Action');
this.setTooltip('Call');
}
};
Blockly.Blocks['declare_proc'] = {
// Block for declaring a procedure
init: function() {
var name = '';
this.setColour(260);
this.appendDummyInput()
.appendField('Define')
.appendField(new Blockly.FieldTextInput(name),'NAME');
this.appendStatementInput('DO')
.setCheck('Action')
.appendField('Do');
this.setTooltip('Declares the procedure');
this.statementConnection_ = null;
}
};
/****************/
/* Events */
/****************/
Blockly.Blocks['declare_event'] = {
// Block for declaring an event handler
init: function() {
this.setColour(260);
var dropdown = new Blockly.FieldDropdown([['white', ocargo.Cow.WHITE], ['brown', ocargo.Cow.BROWN]], function(option) {
var imageUrl = ocargo.Drawing.imageDir + ocargo.Drawing.cowUrl(option);
this.sourceBlock_.getField('IMAGE').setValue(imageUrl);
});
this.appendDummyInput('Event')
.appendField('On ')
.appendField(dropdown, 'TYPE')
.appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + ocargo.Drawing.whiteCowUrl,
ocargo.BlocklyControl.COW_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT), 'IMAGE');
this.getField('IMAGE').EDITABLE = true; //saves the image path as well in the XML
this.appendStatementInput('DO')
.setCheck('EventAction')
.appendField('Do');
this.setTooltip('Declares the event handler');
this.statementConnection_ = null;
},
};
/*******************/
/* Control Flows */
/*******************/
Blockly.Blocks['controls_repeat_while'] = {
// Block for repeat while
init: function() {
this.setColour(120);
this.appendValueInput("condition")
.setCheck("Boolean")
.appendField("repeat while");
this.appendStatementInput("body")
.setCheck("Action")
.appendField("do");
this.setPreviousStatement(true, 'Action');
this.setNextStatement(true, 'Action');
this.setTooltip('While a value is true, do some statements');
}
};
Blockly.Blocks['controls_repeat_until'] = {
// Block for repeat until
init: function() {
this.setColour(120);
this.appendValueInput("condition")
.setCheck("Boolean")
.appendField("repeat until");
this.appendStatementInput("body")
.setCheck("Action")
.appendField("do");
this.setPreviousStatement(true, 'Action');
this.setNextStatement(true, 'Action');
this.setTooltip('Until a value is true, do some statements');
}
};
// Set text colour to red
var textBlock = Blockly.Blocks['text'];
var originalTextInit = textBlock.init;
textBlock.init = function() {
originalTextInit.call(this);
this.setColour(260);
};
//Customise controls_repeat block to not allow more than a sensible number of repetitions
var controlsRepeatBlock = Blockly.Blocks['controls_repeat'];
var originalInit = controlsRepeatBlock.init;
controlsRepeatBlock.init = function () {
originalInit.call(this);
this.setPreviousStatement(!0, 'Action');
this.setNextStatement(!0, 'Action');
this.inputList[1].setCheck('Action'); //Disallow event action blocks to be in body
var input = this.inputList[0];
var field = input.fieldRow[1];
field.changeHandler_ = function(text) {
var n = Blockly.FieldTextInput.numberValidator(text);
if (n) {
n = String(Math.min(Math.max(0, Math.floor(n)), 20));
}
return n;
};
};
// Make 'not' taller
var notBlock = Blockly.Blocks['logic_negate'];
var originalNotInit = notBlock.init;
notBlock.init = function () {
originalNotInit.call(this);
this.inputList[0].appendField(new Blockly.FieldImage(ocargo.Drawing.imageDir + 'empty.svg',
ocargo.BlocklyControl.EXTRA_BLOCK_WIDTH,
ocargo.BlocklyControl.BLOCK_HEIGHT));
};
}
function initCustomBlocksPython() {
Blockly.Python['start'] = function(block) {
return '';
};
Blockly.Python['move_forwards'] = function(block) {
return 'v.move_forwards()\n';
};
Blockly.Python['turn_left'] = function(block) {
return 'v.turn_left()\n';
};
Blockly.Python['turn_right'] = function(block) {
return 'v.turn_right()\n';
};
Blockly.Python['turn_around'] = function(block) {
return 'v.turn_around()\n';
};
Blockly.Python['wait'] = function(block) {
return 'v.wait()\n';
};
Blockly.Python['deliver'] = function(block) {
return 'v.deliver()\n';
};
Blockly.Python['road_exists'] = function(block) {
if(block.inputList[0].fieldRow[1].value_ === 'FORWARD'){
var python = "v.is_road('FORWARD')";
}else if(block.inputList[0].fieldRow[1].value_ === 'LEFT'){
var python = "v.is_road('LEFT')";
}else{
var python = "v.is_road('RIGHT')";
}
return [python, Blockly.Python.ORDER_NONE];
// TODO: figure out what this ordering relates to
};
Blockly.Python['traffic_light'] = function(block) {
var python;
if(block.inputList[0].fieldRow[1].value_ === ocargo.TrafficLight.RED){
python = "v.at_traffic_light('RED')";
}else{
python = "v.at_traffic_light('GREEN')";
}
return [python, Blockly.Python.ORDER_NONE]; //TODO: figure out what this ordering relates to
};
Blockly.Python['dead_end'] = function(block) {
return ['v.at_dead_end()', Blockly.Python.ORDER_NONE];
// TODO: figure out what this ordering relates to
};
Blockly.Python['cow_crossing'] = function(block) {
return ['v.cow_crossing()', Blockly.Python.ORDER_NONE];
// TODO: figure out what this ordering relates to
};
Blockly.Python['at_destination'] = function(block) {
return ['v.at_destination()', Blockly.Python.ORDER_NONE];
// TODO: figure out what this ordering relates to;
};
Blockly.Python['call_proc'] = function(block) {
return block.inputList[0].fieldRow[2].text_ + '()\n';
};
Blockly.Python['declare_proc'] = function(block) {
var branch = Blockly.Python.statementToCode(block, 'DO');
return 'def ' + block.inputList[0].fieldRow[1].text_ + '():\n' + branch;
// TODO: get code out of sub-blocks (there's a Blockly function for it)
};
Blockly.Python['declare_event'] = function(block) {
// TODO support events in python
throw 'events not supported in python';
};
Blockly.Python['controls_repeat_while'] = function(block) {
var condition = Blockly.Python.valueToCode(block, 'condition', Blockly.Python.ORDER_ATOMIC);
var subBlock = Blockly.Python.statementToCode(block, 'body');
var code = 'while ' + condition + ':\n' + subBlock;
return code;
};
Blockly.Python['controls_repeat_until'] = function(block) {
var condition = Blockly.Python.valueToCode(block, 'condition', Blockly.Python.ORDER_ATOMIC);
var subBlock = Blockly.Python.statementToCode(block, 'body');
var code = 'while not ' + condition + ':\n' + subBlock;
return code;
};
}
|
agpl-3.0
|
kj415j45/osu-web
|
resources/lang/pt/model_validation.php
|
5767
|
<?php
/**
* Copyright 2015-2018 ppy Pty. Ltd.
*
* This file is part of osu!web. osu!web is distributed with the hope of
* attracting more community contributions to the core ecosystem of osu!.
*
* osu!web is free software: you can redistribute it and/or modify
* it under the terms of the Affero GNU General Public License version 3
* as published by the Free Software Foundation.
*
* osu!web is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with osu!web. If not, see <http://www.gnu.org/licenses/>.
*/
return [
'not_negative' => ':attribute não pode ser negativo.',
'required' => ':attribute é necessário.',
'too_long' => ':attribute limite máximo excedido - só pode ser até :limit caracteres.',
'wrong_confirmation' => 'A confirmação não corresponde.',
'beatmap_discussion_post' => [
'discussion_locked' => 'A discussão está bloqueada.',
'first_post' => 'Não é possível eliminar uma publicação de começo.',
],
'beatmapset_discussion' => [
'beatmap_missing' => 'A marca de tempo está especificada mas o beatmap está em falta.',
'beatmapset_no_hype' => "O beatmap não pode ser hypeado.",
'hype_requires_null_beatmap' => 'O hype tem que ser feito na secção Geral (todas as dificuldades).',
'invalid_beatmap_id' => 'Dificuldade especificada inválida.',
'invalid_beatmapset_id' => 'Beatmap especificado inválido.',
'locked' => 'A discussão está bloqueada.',
'hype' => [
'guest' => 'Tens que estar com a sessão iniciada para hypear.',
'hyped' => 'Já hypeaste este beatmap.',
'limit_exceeded' => 'Usaste todo o teu hype.',
'not_hypeable' => 'Este beatmap não pode ser hypeado',
'owner' => 'Nada de hypear o teu próprio beatmap.',
],
'timestamp' => [
'exceeds_beatmapset_length' => 'A marca de tempo especificada ultrapassa a duração do beatmap.',
'negative' => "A marca de tempo não pode ser negativa.",
],
],
'forum' => [
'feature_vote' => [
'not_feature_topic' => 'Só se pode votar numa característica solicitada.',
'not_enough_feature_votes' => 'Votos insuficientes.',
],
'poll_vote' => [
'invalid' => 'Opção especificada inválida.',
],
'post' => [
'beatmapset_post_no_delete' => 'Não é permitido eliminar a publicação dos metadados do beatmap.',
'beatmapset_post_no_edit' => 'Não é permitido editar a publicação dos metadados do beatmap.',
],
'topic_poll' => [
'duplicate_options' => 'Uma opção duplicada não é permitida.',
'invalid_max_options' => 'As opções por cada utilizador não podem exceder o número de opções disponíveis.',
'minimum_one_selection' => 'Um mínimo de uma opção é necessária por utilizador.',
'minimum_two_options' => 'São necessárias pelo menos duas opções.',
'too_many_options' => 'Número máximo de opções permitidas excedido.',
],
'topic_vote' => [
'required' => 'Selecciona uma opção quando estiveres a votar.',
'too_many' => 'Foram seleccionadas opções a mais do que as permitidas.',
],
],
'user' => [
'contains_username' => 'A palavra-passe não pode conter o nome de utilizador.',
'email_already_used' => 'Endereço de email já usado.',
'invalid_country' => 'País inexistente na base de dados.',
'invalid_discord' => 'Nome de utilizador do Discord inválido.',
'invalid_email' => "Não parece que seja um endereço de email válido.",
'too_short' => 'A nova palavra-passe é demasiado curta.',
'unknown_duplicate' => 'Nome de utilizador e endereço de e-mail já usados.',
'username_available_in' => 'Este nome de utilizador irá estar disponível para uso em :duration.',
'username_available_soon' => 'Este nome de utilizador irá estar disponível para uso em qualquer momento!',
'username_invalid_characters' => 'O nome de utilizador solicitado contém caracteres inválidos.',
'username_in_use' => 'Este nome de utilizador já está a ser usado!',
'username_no_space_userscore_mix' => 'Por favor usa sublinhados ou espaços, não ambos!',
'username_no_spaces' => "O nome de utilizador não pode começar ou acabar com espaços!",
'username_not_allowed' => 'Esta escolha para nome de utilizador não é permitida.',
'username_too_short' => 'O nome de utilizador solicitado é demasiado curto.',
'username_too_long' => 'O nome de utilizador solicitado é demasiado longo.',
'weak' => 'Palavra-passe colocada na lista-negra.',
'wrong_current_password' => 'A palavra-passe actual está incorrecta.',
'wrong_email_confirmation' => 'A confirmação do email não corresponde.',
'wrong_password_confirmation' => 'A confirmação da palavra-passe não corresponde.',
'too_long' => 'Comprimento máximo excedido - só pode ser até :limit caracteres.',
'change_username' => [
'supporter_required' => [
'_' => 'Tu tens de ter :link para mudar o teu nome!',
'link_text' => 'ajudaste o osu!',
],
'username_is_same' => 'Este já é o teu nome de utilizador, tontinho!',
],
],
];
|
agpl-3.0
|
buremba/rakam
|
rakam-spi/src/main/java/org/rakam/report/PreComputedTableSubQueryVisitor.java
|
7236
|
package org.rakam.report;
import com.facebook.presto.sql.tree.*;
import org.rakam.util.ValidationUtil;
import java.util.Optional;
import java.util.function.Function;
import static com.facebook.presto.sql.tree.LogicalBinaryExpression.Type.AND;
import static com.facebook.presto.sql.tree.LogicalBinaryExpression.Type.OR;
public class PreComputedTableSubQueryVisitor extends AstVisitor<String, Boolean> {
private final Function<String, Optional<String>> columnNameMapper;
public PreComputedTableSubQueryVisitor(Function<String, Optional<String>> columnNameMapper) {
this.columnNameMapper = columnNameMapper;
}
@Override
protected String visitLogicalBinaryExpression(LogicalBinaryExpression node, Boolean negate) {
LogicalBinaryExpression.Type type = node.getType();
if (type == AND) {
// TODO find a better way
// Optimization for the case when one hand or binary expression is IS NOT NULL predicate
if (node.getRight() instanceof IsNotNullPredicate && !(node.getLeft() instanceof IsNotNullPredicate) ||
node.getLeft() instanceof IsNotNullPredicate && !(node.getRight() instanceof IsNotNullPredicate)) {
Expression isNotNull = node.getRight() instanceof IsNotNullPredicate ? node.getRight() : node.getLeft();
Expression setExpression = isNotNull == node.getRight() ? node.getLeft() : node.getRight();
String excludeQuery = process(new IsNullPredicate(((IsNotNullPredicate) isNotNull).getValue()), negate);
return "SELECT l.date, l.dimension, l._user_set FROM (" + process(setExpression, negate) + ") l LEFT JOIN (" + excludeQuery + ") r ON (r.date = l.date AND l.dimension = r.dimension) WHERE r.date IS NULL";
}
String right = process(node.getRight(), negate);
String left = process(node.getLeft(), negate);
// TODO: use INTERSECT when it's implemented in Presto.
return "SELECT l.date, l.dimension, l._user_set FROM (" + left + ") l JOIN (" + right + ") r ON (r.date = l.date)";
} else if (type == OR) {
return "SELECT date, dimension, _user_set FROM (" + process(node.getLeft(), negate) +
" UNION ALL " + process(node.getRight(), negate) + ")";
} else {
throw new IllegalStateException();
}
}
@Override
protected String visitNotExpression(NotExpression node, Boolean negate) {
return process(node.getValue(), !negate);
}
@Override
protected String visitComparisonExpression(ComparisonExpression node, Boolean negate) {
String left = process(node.getLeft(), negate);
String right = process(node.getRight(), negate);
String predicate = node.getType().getValue() + " " + right;
if (negate) {
predicate = String.format("not(%s)", predicate);
}
return "SELECT date, dimension, _user_set FROM " + left + " WHERE dimension " + predicate;
}
@Override
protected String visitLongLiteral(LongLiteral node, Boolean negate) {
return Long.toString(node.getValue());
}
@Override
protected String visitLikePredicate(LikePredicate node, Boolean negate) {
return "SELECT date, dimension, _user_set FROM " + process(node.getValue(), negate) +
" WHERE dimension LIKE " + process(node.getPattern(), negate);
}
@Override
protected String visitIsNotNullPredicate(IsNotNullPredicate node, Boolean negate) {
if (negate) {
return visitIsNullPredicate(new IsNullPredicate(node.getValue()), !negate);
}
String column = process(node.getValue(), negate);
return "SELECT date, dimension, _user_set FROM " + column + " WHERE dimension is not null";
}
@Override
protected String visitIsNullPredicate(IsNullPredicate node, Boolean negate) {
if (negate) {
return visitIsNullPredicate(new IsNullPredicate(node.getValue()), !negate);
}
return "SELECT date, dimension, _user_set FROM " + process(node.getValue(), negate) + " WHERE dimension is null";
}
@Override
protected String visitInPredicate(InPredicate node, Boolean negate) {
String predicate = "IN " + process(node.getValue(), null) + " " + process(node, negate) + " ) ";
if (negate) {
predicate = String.format("NOT ", predicate);
}
return "SELECT date, dimension, _user_set FROM " + process(node.getValue(), negate) + " WHERE dimension " + predicate;
}
@Override
protected String visitBetweenPredicate(BetweenPredicate node, Boolean negate) {
String predicate = "BETWEEN " + process(node.getMin(), null) + " " + process(node, negate) + " ) ";
if (negate) {
predicate = String.format("not(%s)", predicate);
}
return "SELECT date, dimension, _user_set FROM " + process(node.getValue(), negate) + " WHERE dimension " + predicate;
}
@Override
protected String visitDoubleLiteral(DoubleLiteral node, Boolean negate) {
return Double.toString(node.getValue());
}
@Override
protected String visitGenericLiteral(GenericLiteral node, Boolean negate) {
return node.getType() + " '" + node.getValue() + "'";
}
@Override
protected String visitTimeLiteral(TimeLiteral node, Boolean negate) {
return "TIME '" + node.getValue() + "'";
}
@Override
protected String visitTimestampLiteral(TimestampLiteral node, Boolean negate) {
return "TIMESTAMP '" + node.getValue() + "'";
}
@Override
protected String visitNullLiteral(NullLiteral node, Boolean negate) {
return "null";
}
@Override
protected String visitIntervalLiteral(IntervalLiteral node, Boolean negate) {
String sign = (node.getSign() == IntervalLiteral.Sign.NEGATIVE) ? "- " : "";
StringBuilder builder = new StringBuilder()
.append("INTERVAL ")
.append(sign)
.append(" '").append(node.getValue()).append("' ")
.append(node.getStartField());
if (node.getEndField().isPresent()) {
builder.append(" TO ").append(node.getEndField().get());
}
return builder.toString();
}
@Override
protected String visitBooleanLiteral(BooleanLiteral node, Boolean negate) {
return String.valueOf(node.getValue());
}
@Override
protected String visitStringLiteral(StringLiteral node, Boolean negate) {
return "'" + node.getValue().replace("'", "''") + "'";
}
@Override
protected String visitIdentifier(Identifier node, Boolean context) {
String tableColumn = ValidationUtil
.checkTableColumn(node.getValue(), "reference in filter", '"');
Optional<String> preComputedTable = columnNameMapper.apply(tableColumn);
if (preComputedTable.isPresent()) {
return preComputedTable.get();
}
throw new UnsupportedOperationException();
}
@Override
protected String visitNode(Node node, Boolean negate) {
throw new UnsupportedOperationException();
}
}
|
agpl-3.0
|
marwoodandrew/superdesk-core
|
content_api/publish/service.py
|
6723
|
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import logging
from copy import copy
from eve.utils import config, ParsedRequest
from superdesk.utc import utcnow
from superdesk.services import BaseService
from superdesk.publish.formatters.ninjs_formatter import NINJSFormatter
from superdesk import get_resource_service
from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE
logger = logging.getLogger('superdesk')
class PublishService(BaseService):
"""A service for publishing to the content api.
Serves mainly as a proxy to the data layer.
"""
formatter = NINJSFormatter()
subscriber = {'config': {}}
def publish(self, item, subscribers=[]):
"""Publish an item to content api.
This must be enabled via ``PUBLISH_TO_CONTENT_API`` setting.
:param item: item to publish
"""
if not self._filter_item(item):
doc = self.formatter._transform_to_ninjs(item, self.subscriber)
now = utcnow()
doc.setdefault('firstcreated', now)
doc.setdefault('versioncreated', now)
doc.setdefault(config.VERSION, item.get(config.VERSION, 1))
doc['subscribers'] = [str(sub['_id']) for sub in subscribers]
if 'evolvedfrom' in doc:
parent_item = self.find_one(req=None, _id=doc['evolvedfrom'])
if parent_item:
doc['ancestors'] = copy(parent_item.get('ancestors', []))
doc['ancestors'].append(doc['evolvedfrom'])
doc['bookmarks'] = parent_item.get('bookmarks', [])
else:
logger.warning("Failed to find evolvedfrom item '{}' for '{}'".format(
doc['evolvedfrom'], doc['guid'])
)
self._assign_associations(item, doc)
logger.info('publishing %s to %s' % (doc['guid'], subscribers))
_id = self._create_doc(doc)
if 'evolvedfrom' in doc and parent_item:
self.system_update(parent_item['_id'], {'nextversion': _id}, parent_item)
return _id
else:
return None
def create(self, docs, **kwargs):
ids = []
for doc in docs:
ids.append(self._create_doc(doc, **kwargs))
return ids
def _create_doc(self, doc, **kwargs):
"""Create a new item or update existing."""
item = copy(doc)
item.setdefault('_id', item.get('guid'))
_id = item[config.ID_FIELD] = item.pop('guid')
# merging the existing and new subscribers
original = self.find_one(req=None, _id=_id)
if original:
item['subscribers'] = list(set(original.get('subscribers', [])) | set(item.get('subscribers', [])))
self._process_associations(item, original)
self._create_version_doc(item)
if original:
self.update(_id, item, original)
return _id
else:
return super().create([item], **kwargs)[0]
def _create_version_doc(self, item):
"""
Store the item in the item version collection
:param item:
:return:
"""
version_item = copy(item)
version_item['_id_document'] = version_item.pop('_id')
get_resource_service('items_versions').create([version_item])
# if the update is a cancel we need to cancel all versions
if item.get('pubstatus', '') == 'canceled':
self._cancel_versions(item.get('_id'))
def _cancel_versions(self, doc_id):
"""
Given an id of a document set the pubstatus to canceled for all versions
:param doc_id:
:return:
"""
query = {'_id_document': doc_id}
update = {'pubstatus': 'canceled'}
for item in get_resource_service('items_versions').get_from_mongo(req=None, lookup=query):
if item.get('pubstatus') != 'canceled':
get_resource_service('items_versions').update(item['_id'], update, item)
def _filter_item(self, item):
"""
Filter the item out if it matches any API Block filter conditions
:param item:
:return: True of the item is blocked, False if it is OK to publish it on the API.
"""
# Get the API blocking Filters
req = ParsedRequest()
filter_conditions = list(get_resource_service('content_filters').get(req=req, lookup={'api_block': True}))
# No API blocking filters
if not filter_conditions:
return False
filter_service = get_resource_service('content_filters')
for fc in filter_conditions:
if filter_service.does_match(fc, item):
logger.info('API Filter block {} matched for item {}.'.format(fc, item.get(config.ID_FIELD)))
return True
return False
def _assign_associations(self, item, doc):
"""Assign Associations to published item
:param dict item: item being published
:param dit doc: ninjs documents
"""
if item[ITEM_TYPE] != CONTENT_TYPE.TEXT:
return
for assoc, assoc_item in (item.get('associations') or {}).items():
if not assoc_item:
continue
doc.get('associations', {}).get(assoc)['subscribers'] = list(map(str, assoc_item.get('subscribers') or []))
def _process_associations(self, updates, original):
"""Update associations using existing published item and ensure that associated item subscribers
are equal or subset of the parent subscribers.
:param updates:
:param original:
:return:
"""
if updates[ITEM_TYPE] != CONTENT_TYPE.TEXT:
return
subscribers = updates.get('subscribers') or []
for assoc, update_assoc in (updates.get('associations') or {}).items():
if not update_assoc:
continue
if original:
original_assoc = (original.get('associations') or {}).get(assoc)
if original_assoc and original_assoc.get(config.ID_FIELD) == update_assoc.get(config.ID_FIELD):
update_assoc['subscribers'] = list(set(original_assoc.get('subscribers') or []) |
set(update_assoc.get('subscribers') or []))
update_assoc['subscribers'] = list(set(update_assoc['subscribers']) & set(subscribers))
|
agpl-3.0
|
WenbinHou/PKUAutoGateway.Android
|
Reference/IPGWAndroid/android/support/design/widget/by.java
|
714
|
package android.support.design.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.design.c;
final class by {
private static final int[] a = new int[]{c.colorPrimary};
static void a(Context context) {
int i = 0;
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(a);
if (!obtainStyledAttributes.hasValue(0)) {
i = 1;
}
if (obtainStyledAttributes != null) {
obtainStyledAttributes.recycle();
}
if (i != 0) {
throw new IllegalArgumentException("You need to use a Theme.AppCompat theme (or descendant) with the design library.");
}
}
}
|
agpl-3.0
|
fkr/the-idb
|
app/core/puppetdb/nodes.rb
|
903
|
module Puppetdb
class Nodes < Struct.new(:urls)
def all
filter = IDB.config.puppetdb.filter.blank? ? nil : Regexp.new(IDB.config.puppetdb.filter)
nodes = []
# Try to find machines in all puppetdb servers.
urls.each do |url|
api = Puppetdb::Api.new(url)
data = api.get('/v3/nodes').data || []
data.each do |node|
if filter.nil? || node['name'].match(filter)
nodes << node['name']
end
end
end
nodes
end
def facts(node)
Puppetdb::FactsV3.for_node(node, urls)
end
# returns either the puppetdb url or nil
def find_node(fqdn)
# Try to find machine in all puppetdb servers.
urls.each do |url|
api = Puppetdb::Api.new(url)
data = api.get("/v3/nodes/#{fqdn}").data
return url if data && data["name"]
end
nil
end
end
end
|
agpl-3.0
|
exomiser/Exomiser
|
exomiser-core/src/test/java/org/monarchinitiative/exomiser/core/genome/GeneFactoryTest.java
|
2339
|
/*
* The Exomiser - A tool to annotate and prioritize genomic variants
*
* Copyright (c) 2016-2020 Queen Mary University of London.
* Copyright (c) 2012-2016 Charité Universitätsmedizin Berlin and Genome Research Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.monarchinitiative.exomiser.core.genome;
import com.google.common.collect.Sets;
import de.charite.compbio.jannovar.data.JannovarData;
import org.junit.jupiter.api.Test;
import org.monarchinitiative.exomiser.core.model.Gene;
import org.monarchinitiative.exomiser.core.model.GeneIdentifier;
import java.util.Set;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
/**
*
* @author Jules Jacobsen <jules.jacobsen@sanger.ac.uk>
*/
public class GeneFactoryTest {
private static final JannovarData DEFAULT_JANNOVAR_DATA = TestFactory.buildDefaultJannovarData();
private final GeneFactory instance = new GeneFactory(DEFAULT_JANNOVAR_DATA);
@Test
public void testCreateKnownGeneIds() {
Set<GeneIdentifier> expected = Sets.newHashSet(TestFactory.buildGeneIdentifiers());
Set<GeneIdentifier> knownGeneIds = instance.getGeneIdentifiers();
assertThat(knownGeneIds, equalTo(expected));
}
@Test
public void testCreateKnownGenes() {
Set<Gene> expected = Sets.newHashSet(TestGeneFactory.buildGenes());
Set<Gene> knownGenes = Sets.newHashSet(instance.createKnownGenes());
assertThat(knownGenes, equalTo(expected));
}
}
|
agpl-3.0
|
24eme/vinsdeloire
|
project/plugins/acVinLibPlugin/lib/util/Search.class.php
|
1975
|
<?php
class Search {
public static function matchTerm($term, $text) {
$reg = "/[ ]+/";
$text = self::normalize($text);
$term = self::normalize($term);
$words_text = preg_split($reg, $text);
$words_term = preg_split($reg, $term);
$text_final = "";
foreach($words_term as $key_term => $word_term) {
$matcher = "/".self::normalize($word_term)."/i";
$find = false;
foreach($words_text as $key_text => $word_text) {
if(preg_match($matcher, $word_text)) {
$find = true;
unset($words_text[$key_text]);
break;
}
unset($words_text[$key_text]);
}
if(!$find) {
return false;
}
}
return $find;
}
public static function matchTermLight($term, $text) {
$reg = "/[ ]+/";
$text = self::normalize($text);
$term = self::normalize($term);
$words_text = preg_split($reg, $text);
$words_term = preg_split($reg, $term);
$text_final = "";
foreach($words_term as $key_term => $word_term) {
$find = false;
foreach($words_text as $key_text => $word_text) {
if($word_term == $word_text) {
$find = true;
unset($words_text[$key_text]);
break;
}
unset($words_text[$key_text]);
}
if(!$find) {
return false;
}
}
return $find;
}
public static function normalize($text) {
return KeyInflector::unaccent($text);
}
public static function getWords($value) {
$words = array();
$expressions = preg_split('/([,; \|()])/', $value);
$words_mandatories = array("ac");
foreach($expressions as $exp) {
if(preg_match('/[\wû]{3,}/', $exp) || in_array(strtolower($exp), $words_mandatories)) {
$words[] = strtolower($exp);
}
}
return $words;
}
}
|
agpl-3.0
|
jcamposs/coderoom
|
client/templates/notifications/notifications_widget.js
|
1772
|
/**
* Copyright (C) 2016 Jorge Campos Serrano.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do not
* wish to do so, delete this exception statement from your version. If you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/
Template.notificationsWidget.helpers({
notifications: function() {
return Notifications.find({userId: Meteor.userId(), read: false}, {limit: 4});
},
notificationCount: function(){
return Notifications.find({userId: Meteor.userId(), read: false}).count();
}
});
|
agpl-3.0
|
xiaxiaoyu1988/smitm
|
lib/libevent/event2/event-config.h
|
16788
|
/* event2/event-config.h
*
* This file was generated by autoconf when libevent was built, and post-
* processed by Libevent so that its macros would have a uniform prefix.
*
* DO NOT EDIT THIS FILE.
*
* Do not rely on macros in this file existing in later versions.
*/
#ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_
#define EVENT2_EVENT_CONFIG_H_INCLUDED_
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define if libevent should build without support for a debug mode */
/* #undef EVENT__DISABLE_DEBUG_MODE */
/* Define if libevent should not allow replacing the mm functions */
/* #undef EVENT__DISABLE_MM_REPLACEMENT */
/* Define if libevent should not be compiled with thread support */
/* #undef EVENT__DISABLE_THREAD_SUPPORT */
/* Define to 1 if you have the `accept4' function. */
#define EVENT__HAVE_ACCEPT4 1
/* Define to 1 if you have the `arc4random' function. */
/* #undef EVENT__HAVE_ARC4RANDOM */
/* Define to 1 if you have the `arc4random_buf' function. */
/* #undef EVENT__HAVE_ARC4RANDOM_BUF */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define EVENT__HAVE_ARPA_INET_H 1
/* Define to 1 if you have the `clock_gettime' function. */
#define EVENT__HAVE_CLOCK_GETTIME 1
/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you
don't. */
#define EVENT__HAVE_DECL_CTL_KERN 1
/* Define to 1 if you have the declaration of `KERN_ARND', and to 0 if you
don't. */
#define EVENT__HAVE_DECL_KERN_ARND 0
/* Define to 1 if you have the declaration of `KERN_RANDOM', and to 0 if you
don't. */
#define EVENT__HAVE_DECL_KERN_RANDOM 1
/* Define to 1 if you have the declaration of `RANDOM_UUID', and to 0 if you
don't. */
#define EVENT__HAVE_DECL_RANDOM_UUID 1
/* Define if /dev/poll is available */
/* #undef EVENT__HAVE_DEVPOLL */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define EVENT__HAVE_DLFCN_H 1
/* Define if your system supports the epoll system calls */
#define EVENT__HAVE_EPOLL 1
/* Define to 1 if you have the `epoll_create1' function. */
#define EVENT__HAVE_EPOLL_CREATE1 1
/* Define to 1 if you have the `epoll_ctl' function. */
#define EVENT__HAVE_EPOLL_CTL 1
/* Define to 1 if you have the <errno.h> header file. */
#define EVENT__HAVE_ERRNO_H 1
/* Define to 1 if you have ERR_remove_thread_stat(). */
/* #undef EVENT__HAVE_ERR_REMOVE_THREAD_STATE */
/* Define to 1 if you have the `eventfd' function. */
#define EVENT__HAVE_EVENTFD 1
/* Define if your system supports event ports */
/* #undef EVENT__HAVE_EVENT_PORTS */
/* Define to 1 if you have the `fcntl' function. */
#define EVENT__HAVE_FCNTL 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define EVENT__HAVE_FCNTL_H 1
/* Define to 1 if the system has the type `fd_mask'. */
#define EVENT__HAVE_FD_MASK 1
/* Do we have getaddrinfo()? */
#define EVENT__HAVE_GETADDRINFO 1
/* Define to 1 if you have the `getegid' function. */
#define EVENT__HAVE_GETEGID 1
/* Define to 1 if you have the `geteuid' function. */
#define EVENT__HAVE_GETEUID 1
/* Define this if you have any gethostbyname_r() */
/* #undef EVENT__HAVE_GETHOSTBYNAME_R */
/* Define this if gethostbyname_r takes 3 arguments */
/* #undef EVENT__HAVE_GETHOSTBYNAME_R_3_ARG */
/* Define this if gethostbyname_r takes 5 arguments */
/* #undef EVENT__HAVE_GETHOSTBYNAME_R_5_ARG */
/* Define this if gethostbyname_r takes 6 arguments */
/* #undef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG */
/* Define to 1 if you have the `getifaddrs' function. */
#define EVENT__HAVE_GETIFADDRS 1
/* Define to 1 if you have the `getnameinfo' function. */
#define EVENT__HAVE_GETNAMEINFO 1
/* Define to 1 if you have the `getprotobynumber' function. */
#define EVENT__HAVE_GETPROTOBYNUMBER 1
/* Define to 1 if you have the `getservbyname' function. */
#define EVENT__HAVE_GETSERVBYNAME 1
/* Define to 1 if you have the `gettimeofday' function. */
#define EVENT__HAVE_GETTIMEOFDAY 1
/* Define to 1 if you have the <ifaddrs.h> header file. */
#define EVENT__HAVE_IFADDRS_H 1
/* Define to 1 if you have the `inet_ntop' function. */
#define EVENT__HAVE_INET_NTOP 1
/* Define to 1 if you have the `inet_pton' function. */
#define EVENT__HAVE_INET_PTON 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define EVENT__HAVE_INTTYPES_H 1
/* Define to 1 if you have the `issetugid' function. */
/* #undef EVENT__HAVE_ISSETUGID */
/* Define to 1 if you have the `kqueue' function. */
/* #undef EVENT__HAVE_KQUEUE */
/* Define if the system has zlib */
/* #undef EVENT__HAVE_LIBZ */
/* Define to 1 if you have the `mach_absolute_time' function. */
/* #undef EVENT__HAVE_MACH_ABSOLUTE_TIME */
/* Define to 1 if you have the <mach/mach_time.h> header file. */
/* #undef EVENT__HAVE_MACH_MACH_TIME_H */
/* Define to 1 if you have the <memory.h> header file. */
#define EVENT__HAVE_MEMORY_H 1
/* Define to 1 if you have the `mmap' function. */
#define EVENT__HAVE_MMAP 1
/* Define to 1 if you have the `nanosleep' function. */
#define EVENT__HAVE_NANOSLEEP 1
/* Define to 1 if you have the <netdb.h> header file. */
#define EVENT__HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in6.h> header file. */
/* #undef EVENT__HAVE_NETINET_IN6_H */
/* Define to 1 if you have the <netinet/in.h> header file. */
#define EVENT__HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#define EVENT__HAVE_NETINET_TCP_H 1
/* Define if the system has openssl */
/* #undef EVENT__HAVE_OPENSSL */
/* Define to 1 if you have the `pipe' function. */
#define EVENT__HAVE_PIPE 1
/* Define to 1 if you have the `pipe2' function. */
#define EVENT__HAVE_PIPE2 1
/* Define to 1 if you have the `poll' function. */
#define EVENT__HAVE_POLL 1
/* Define to 1 if you have the <poll.h> header file. */
#define EVENT__HAVE_POLL_H 1
/* Define to 1 if you have the `port_create' function. */
/* #undef EVENT__HAVE_PORT_CREATE */
/* Define to 1 if you have the <port.h> header file. */
/* #undef EVENT__HAVE_PORT_H */
/* Define if you have POSIX threads libraries and header files. */
/* #undef EVENT__HAVE_PTHREAD */
/* Define if we have pthreads on this system */
#define EVENT__HAVE_PTHREADS 1
/* Define to 1 if you have the `putenv' function. */
#define EVENT__HAVE_PUTENV 1
/* Define to 1 if the system has the type `sa_family_t'. */
#define EVENT__HAVE_SA_FAMILY_T 1
/* Define to 1 if you have the `select' function. */
#define EVENT__HAVE_SELECT 1
/* Define to 1 if you have the `sendfile' function. */
#define EVENT__HAVE_SENDFILE 1
/* Define to 1 if you have the `setenv' function. */
#define EVENT__HAVE_SETENV 1
/* Define if F_SETFD is defined in <fcntl.h> */
#define EVENT__HAVE_SETFD 1
/* Define to 1 if you have the `setrlimit' function. */
#define EVENT__HAVE_SETRLIMIT 1
/* Define to 1 if you have the `sigaction' function. */
#define EVENT__HAVE_SIGACTION 1
/* Define to 1 if you have the `signal' function. */
#define EVENT__HAVE_SIGNAL 1
/* Define to 1 if you have the `splice' function. */
#define EVENT__HAVE_SPLICE 1
/* Define to 1 if you have the <stdarg.h> header file. */
#define EVENT__HAVE_STDARG_H 1
/* Define to 1 if you have the <stddef.h> header file. */
#define EVENT__HAVE_STDDEF_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define EVENT__HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define EVENT__HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define EVENT__HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define EVENT__HAVE_STRING_H 1
/* Define to 1 if you have the `strlcpy' function. */
/* #undef EVENT__HAVE_STRLCPY */
/* Define to 1 if you have the `strsep' function. */
#define EVENT__HAVE_STRSEP 1
/* Define to 1 if you have the `strtok_r' function. */
#define EVENT__HAVE_STRTOK_R 1
/* Define to 1 if you have the `strtoll' function. */
#define EVENT__HAVE_STRTOLL 1
/* Define to 1 if the system has the type `struct addrinfo'. */
#define EVENT__HAVE_STRUCT_ADDRINFO 1
/* Define to 1 if the system has the type `struct in6_addr'. */
#define EVENT__HAVE_STRUCT_IN6_ADDR 1
/* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */
#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1
/* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */
#define EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1
/* Define to 1 if the system has the type `struct sockaddr_in6'. */
#define EVENT__HAVE_STRUCT_SOCKADDR_IN6 1
/* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */
/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN */
/* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */
/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */
#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */
/* #undef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */
/* Define to 1 if the system has the type `struct so_linger'. */
/* #undef EVENT__HAVE_STRUCT_SO_LINGER */
/* Define to 1 if you have the `sysctl' function. */
#define EVENT__HAVE_SYSCTL 1
/* Define to 1 if you have the <sys/devpoll.h> header file. */
/* #undef EVENT__HAVE_SYS_DEVPOLL_H */
/* Define to 1 if you have the <sys/epoll.h> header file. */
#define EVENT__HAVE_SYS_EPOLL_H 1
/* Define to 1 if you have the <sys/eventfd.h> header file. */
#define EVENT__HAVE_SYS_EVENTFD_H 1
/* Define to 1 if you have the <sys/event.h> header file. */
/* #undef EVENT__HAVE_SYS_EVENT_H */
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define EVENT__HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/mman.h> header file. */
#define EVENT__HAVE_SYS_MMAN_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define EVENT__HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/queue.h> header file. */
#define EVENT__HAVE_SYS_QUEUE_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define EVENT__HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define EVENT__HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sendfile.h> header file. */
#define EVENT__HAVE_SYS_SENDFILE_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#define EVENT__HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define EVENT__HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#define EVENT__HAVE_SYS_SYSCTL_H 1
/* Define to 1 if you have the <sys/timerfd.h> header file. */
#define EVENT__HAVE_SYS_TIMERFD_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define EVENT__HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define EVENT__HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/uio.h> header file. */
#define EVENT__HAVE_SYS_UIO_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#define EVENT__HAVE_SYS_WAIT_H 1
/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
#define EVENT__HAVE_TAILQFOREACH 1
/* Define if timeradd is defined in <sys/time.h> */
#define EVENT__HAVE_TIMERADD 1
/* Define if timerclear is defined in <sys/time.h> */
#define EVENT__HAVE_TIMERCLEAR 1
/* Define if timercmp is defined in <sys/time.h> */
#define EVENT__HAVE_TIMERCMP 1
/* Define to 1 if you have the `timerfd_create' function. */
#define EVENT__HAVE_TIMERFD_CREATE 1
/* Define if timerisset is defined in <sys/time.h> */
#define EVENT__HAVE_TIMERISSET 1
/* Define to 1 if the system has the type `uint16_t'. */
#define EVENT__HAVE_UINT16_T 1
/* Define to 1 if the system has the type `uint32_t'. */
#define EVENT__HAVE_UINT32_T 1
/* Define to 1 if the system has the type `uint64_t'. */
#define EVENT__HAVE_UINT64_T 1
/* Define to 1 if the system has the type `uint8_t'. */
#define EVENT__HAVE_UINT8_T 1
/* Define to 1 if the system has the type `uintptr_t'. */
#define EVENT__HAVE_UINTPTR_T 1
/* Define to 1 if you have the `umask' function. */
#define EVENT__HAVE_UMASK 1
/* Define to 1 if you have the <unistd.h> header file. */
#define EVENT__HAVE_UNISTD_H 1
/* Define to 1 if you have the `unsetenv' function. */
#define EVENT__HAVE_UNSETENV 1
/* Define to 1 if you have the `usleep' function. */
#define EVENT__HAVE_USLEEP 1
/* Define to 1 if you have the `vasprintf' function. */
#define EVENT__HAVE_VASPRINTF 1
/* Define if waitpid() supports WNOWAIT */
/* #undef EVENT__HAVE_WAITPID_WITH_WNOWAIT */
/* Define if kqueue works correctly with pipes */
/* #undef EVENT__HAVE_WORKING_KQUEUE */
/* Define to 1 if you have the <zlib.h> header file. */
/* #undef EVENT__HAVE_ZLIB_H */
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define EVENT__LT_OBJDIR ".libs/"
/* Numeric representation of the version */
#define EVENT__NUMERIC_VERSION 0x02010800
/* Name of package */
#define EVENT__PACKAGE "libevent"
/* Define to the address where bug reports for this package should be sent. */
#define EVENT__PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define EVENT__PACKAGE_NAME "libevent"
/* Define to the full name and version of this package. */
#define EVENT__PACKAGE_STRING "libevent 2.1.8-stable"
/* Define to the one symbol short name of this package. */
#define EVENT__PACKAGE_TARNAME "libevent"
/* Define to the home page for this package. */
#define EVENT__PACKAGE_URL ""
/* Define to the version of this package. */
#define EVENT__PACKAGE_VERSION "2.1.8-stable"
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
/* #undef EVENT__PTHREAD_CREATE_JOINABLE */
/* The size of `int', as computed by sizeof. */
#define EVENT__SIZEOF_INT 4
/* The size of `long', as computed by sizeof. */
#define EVENT__SIZEOF_LONG 8
/* The size of `long long', as computed by sizeof. */
#define EVENT__SIZEOF_LONG_LONG 8
/* The size of `off_t', as computed by sizeof. */
#define EVENT__SIZEOF_OFF_T 8
/* The size of `pthread_t', as computed by sizeof. */
#define EVENT__SIZEOF_PTHREAD_T 8
/* The size of `short', as computed by sizeof. */
#define EVENT__SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#define EVENT__SIZEOF_SIZE_T 8
/* The size of `void *', as computed by sizeof. */
#define EVENT__SIZEOF_VOID_P 8
/* Define to 1 if you have the ANSI C header files. */
#define EVENT__STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define EVENT__TIME_WITH_SYS_TIME 1
/* Enable extensions on AIX 3, Interix. */
#ifndef EVENT___ALL_SOURCE
# define EVENT___ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef EVENT___GNU_SOURCE
# define EVENT___GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef EVENT___POSIX_PTHREAD_SEMANTICS
# define EVENT___POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef EVENT___TANDEM_SOURCE
# define EVENT___TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef EVENT____EXTENSIONS__
# define EVENT____EXTENSIONS__ 1
#endif
/* Version number of package */
#define EVENT__VERSION "2.1.8-stable"
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef EVENT___DARWIN_USE_64_BIT_INODE
# define EVENT___DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef EVENT___FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef EVENT___LARGE_FILES */
/* Define to 1 if on MINIX. */
/* #undef EVENT___MINIX */
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef EVENT___POSIX_1_SOURCE */
/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef EVENT___POSIX_SOURCE */
/* Define to appropriate substitue if compiler doesnt have __func__ */
/* #undef EVENT____func__ */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef EVENT__const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef EVENT____cplusplus
/* #undef EVENT__inline */
#endif
/* Define to `int' if <sys/types.h> does not define. */
/* #undef EVENT__pid_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef EVENT__size_t */
/* Define to unsigned int if you dont have it */
/* #undef EVENT__socklen_t */
/* Define to `int' if <sys/types.h> does not define. */
/* #undef EVENT__ssize_t */
#endif /* event2/event-config.h */
|
agpl-3.0
|
papjul/projeqtor
|
model/Contact.php
|
1800
|
<?php
/*** COPYRIGHT NOTICE *********************************************************
*
* Copyright 2009-2016 ProjeQtOr - Pascal BERNARD - support@projeqtor.org
* Contributors : -
*
* This file is part of ProjeQtOr.
*
* ProjeQtOr is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* ProjeQtOr is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
* more details.
*
* You should have received a copy of the GNU Affero General Public License along with
* ProjeQtOr. If not, see <http://www.gnu.org/licenses/>.
*
* You can get complete code of ProjeQtOr, other resource, help and information
* about contributors at http://www.projeqtor.org
*
*** DO NOT REMOVE THIS NOTICE ************************************************/
/** ============================================================================
* Contact
*/
require_once('_securityCheck.php');
class Contact extends ContactMain {
/** ==========================================================================
* Constructor
* @param $id the id of the object in the database (null if not stored yet)
* @return void
*/
function __construct($id = NULL, $withoutDependentObjects=false) {
parent::__construct($id,$withoutDependentObjects);
}
/** ==========================================================================
* Destructor
* @return void
*/
function __destruct() {
parent::__destruct();
}
}
?>
|
agpl-3.0
|
CompassionCH/compassion-modules
|
survey_phone/__manifest__.py
|
2093
|
##############################################################################
#
# ______ Releasing children from poverty _
# / ____/___ ____ ___ ____ ____ ___________(_)___ ____
# / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \
# / /___/ /_/ / / / / / / /_/ / /_/ (__ |__ ) / /_/ / / / /
# \____/\____/_/ /_/ /_/ .___/\__,_/____/____/_/\____/_/ /_/
# /_/
# in Jesus' name
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# @author: Nicolas Badoux <n.badoux@hotmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# pylint: disable=C8101
{
"name": "Survey Phone",
"summary": "Make the filling of survey by internal users easier.",
"version": "12.0.1.0.0",
"category": "Other",
"sequence": 150,
"author": "Compassion CH",
"license": "AGPL-3",
"website": "http://www.compassion.ch",
"depends": [
"survey", # oca_addons/survey
"base_phone", # oca_addons/connector-telephony
"survey",
"partner_contact_birthdate", # oca_addons/partner_contact
"advanced_translation",
],
"data": [
"views/survey_user_input_view.xml",
"views/survey_phone.xml",
"report/survey_report.xml",
],
"demo": [],
"installable": True,
"auto_install": False,
}
|
agpl-3.0
|
raviselker/jasp-desktop
|
JASP-Desktop/widgets/tablemodelvariableslevels.cpp
|
12498
|
//
// Copyright (C) 2013-2016 University of Amsterdam
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public
// License along with this program. If not, see
// <http://www.gnu.org/licenses/>.
//
#include "tablemodelvariableslevels.h"
#include <QMimeData>
#include <QDebug>
#include "options/optionstring.h"
#include "options/optionlist.h"
#include "options/optionvariables.h"
#include "column.h"
using namespace std;
TableModelVariablesLevels::TableModelVariablesLevels(QWidget *parent) :
TableModel(parent)
{
_boundTo = NULL;
_source = NULL;
_variableTypesSuggested = 0;
_variableTypesAllowed = 0xff;
_nominalTextIcon = QIcon(":/icons/variable-nominal-text.svg");
_nominalIcon = QIcon(":/icons/variable-nominal.svg");
_ordinalIcon = QIcon(":/icons/variable-ordinal.svg");
_scaleIcon = QIcon(":/icons/variable-scale.svg");
_limitToOneLevel = false;
}
void TableModelVariablesLevels::bindTo(Option *option)
{
if (_source == NULL)
{
qDebug() << "source not set!";
return;
}
_boundTo = dynamic_cast<OptionsTable *>(option);
_levels = _boundTo->value();
Terms alreadyAssigned;
foreach (Options *level, _levels)
{
OptionVariables *levelVariablesOption = static_cast<OptionVariables*>(level->get("variables"));
Terms variablesInLevel = levelVariablesOption->variables();
alreadyAssigned.add(variablesInLevel);
}
if (alreadyAssigned.size() > 0)
_source->notifyAlreadyAssigned(alreadyAssigned);
refresh();
}
void TableModelVariablesLevels::mimeDataMoved(const QModelIndexList &indexes)
{
bool levelRemoved = false;
Terms toRemove;
foreach (const QModelIndex &index, indexes)
toRemove.add(_rows.at(index.row()).title());
for (int i = _levels.size() - 1; i >= 0; i--)
{
Options *levelOptions = _levels.at(i);
OptionVariables *variablesOption = dynamic_cast<OptionVariables *>(levelOptions->get("variables"));
Terms variables = variablesOption->variables();
variables.remove(toRemove);
if (variables.size() == 0)
{
Options *options = _levels.at(i);
_levels.erase(find(_levels.begin(), _levels.end(), options));
delete options;
levelRemoved = true;
}
else
{
variablesOption->setValue(variables.asVector());
}
}
if (levelRemoved)
{
OptionString *nameOption = static_cast<OptionString *>(_boundTo->rowTemplate()->get("name"));
QString nameTemplate = tq(nameOption->value());
for (uint i = 0; i < _levels.size(); i++)
{
nameOption = static_cast<OptionString *>(_levels.at(i)->get("name"));
nameOption->setValue(fq(nameTemplate.arg(i + 1)));
}
}
_boundTo->setValue(_levels);
refresh();
}
void TableModelVariablesLevels::setVariableTypesSuggested(int variableTypesSuggested)
{
_variableTypesSuggested = variableTypesSuggested;
}
int TableModelVariablesLevels::variableTypesSuggested() const
{
return _variableTypesSuggested;
}
void TableModelVariablesLevels::setVariableTypesAllowed(int variableTypesAllowed)
{
_variableTypesAllowed = variableTypesAllowed;
}
int TableModelVariablesLevels::variableTypesAllowed() const
{
return _variableTypesAllowed;
}
void TableModelVariablesLevels::setLimitToOneLevel(bool limitToOne)
{
_limitToOneLevel = limitToOne;
}
bool TableModelVariablesLevels::isSuggested(const Term &term) const
{
QVariant v = requestInfo(term, VariableInfo::VariableType);
int variableType = v.toInt();
return variableType & _variableTypesSuggested;
}
bool TableModelVariablesLevels::isAllowed(const Term &term) const
{
QVariant v = requestInfo(term, VariableInfo::VariableType);
int variableType = v.toInt();
return variableType == 0 || variableType & _variableTypesAllowed;
}
int TableModelVariablesLevels::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
if (_boundTo == NULL)
return 0;
return _rows.length();
}
int TableModelVariablesLevels::columnCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
if (_boundTo == NULL)
return 0;
return 1;
}
QVariant TableModelVariablesLevels::data(const QModelIndex &index, int role) const
{
if (_boundTo == NULL)
return QVariant();
Row row = _rows.at(index.row());
if (role == Qt::DisplayRole || role == Qt::EditRole)
{
if ( ! row.isOption())
{
return row.title();
}
else
{
OptionList *list = row.option();
QString selected = tq(list->value());
if (role == Qt::DisplayRole)
return selected;
QStringList items = tql(list->options());
QList<QVariant> value;
value.append(selected);
value.append(items);
return value;
}
}
else if (role == Qt::DecorationRole)
{
if (row.isHeading() == false && row.isOption() == false)
{
int variableType = requestInfo(row.title(), VariableInfo::VariableType).toInt();
switch (variableType)
{
case Column::ColumnTypeNominalText:
return QVariant(_nominalTextIcon);
case Column::ColumnTypeNominal:
return QVariant(_nominalIcon);
case Column::ColumnTypeOrdinal:
return QVariant(_ordinalIcon);
case Column::ColumnTypeScale:
return QVariant(_scaleIcon);
default:
return QVariant();
}
}
}
else if (role == Qt::ForegroundRole)
{
if (_limitToOneLevel == false && index.row() == _rows.length() - 1)
return QBrush(QColor(0xAA, 0xAA, 0xAA));
}
else if (role == Qt::TextAlignmentRole)
{
if (row.isHeading())
return Qt::AlignCenter;
else if (row.isOption())
return Qt::AlignTop;
}
else if (role == Qt::SizeHintRole)
{
if (row.isHeading())
return QSize(-1, 24);
}
return QVariant();
}
Qt::ItemFlags TableModelVariablesLevels::flags(const QModelIndex &index) const
{
Qt::ItemFlags flags = Qt::ItemIsEnabled;
if (index.isValid() == false)
{
flags |= Qt::ItemIsDropEnabled;
}
else
{
Row row = _rows.at(index.row());
if (row.isOption())
flags |= Qt::ItemIsEditable;
else if (row.isHeading() == false)
flags |= Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
}
return flags;
}
bool TableModelVariablesLevels::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (role != Qt::DisplayRole && role != Qt::EditRole)
return false;
if (_boundTo == NULL)
return false;
OptionList *list = _rows.at(index.row()).option();
QString qsValue = value.toString();
QByteArray bytes = qsValue.toUtf8();
list->setValue(string(bytes.constData(), bytes.length()));
_boundTo->setValue(_levels);
emit dataChanged(index, index);
return true;
}
Qt::DropActions TableModelVariablesLevels::supportedDropActions() const
{
return Qt::MoveAction;
}
Qt::DropActions TableModelVariablesLevels::supportedDragActions() const
{
return Qt::MoveAction;
}
QStringList TableModelVariablesLevels::mimeTypes() const
{
QStringList m;
m << "application/vnd.list.variable";
return m;
}
QMimeData *TableModelVariablesLevels::mimeData(const QModelIndexList &indexes) const
{
QMimeData *mimeData = new QMimeData();
QByteArray encodedData;
QDataStream dataStream(&encodedData, QIODevice::WriteOnly);
dataStream << indexes.length();
for (int i = 0; i < indexes.length(); i++)
{
Row row = _rows.at(indexes.at(i).row());
dataStream << QStringList(row.title());
}
mimeData->setData("application/vnd.list.variable", encodedData);
return mimeData;
}
bool TableModelVariablesLevels::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
if (action == Qt::IgnoreAction)
return true;
if ( ! canDropMimeData(data, action, row, column, parent))
return false;
if (mimeTypes().contains("application/vnd.list.variable"))
{
QByteArray encodedData = data->data("application/vnd.list.variable");
Terms variables;
variables.set(encodedData);
if (variables.size() == 0)
return false;
if (parent.isValid() == false)
{
if (row == -1) // dropped at end
row = _rows.length();
else if (row == 0) // dropped at beginning
row = 1;
size_t level = 0;
int positionInLevel = 0;
for (int i = 1; i < row; i++)
{
if (_rows[i].isHeading())
{
level++;
positionInLevel = 0;
}
else if (_rows[i].isOption() == false)
{
positionInLevel++;
}
}
if (level == _levels.size())
{
// create new level
Options *options = dynamic_cast<Options*>(_boundTo->rowTemplate()->clone());
OptionString *nameOption = dynamic_cast<OptionString *>(options->get("name"));
string levelName = fq(tq(nameOption->value()).arg(level + 1));
nameOption->setValue(levelName);
_levels.push_back(options);
}
Options *levelDroppedOn = _levels.at(level);
OptionVariables *variablesOption = dynamic_cast<OptionVariables*>(levelDroppedOn->get("variables"));
Terms currentVariables = variablesOption->variables();
foreach (const Term &variable, variables)
{
if (currentVariables.contains(variable)) // prevent dropping to own level (because it introduces complications)
return false;
currentVariables.insert(positionInLevel, variable);
positionInLevel++;
}
variablesOption->setValue(currentVariables.asVector());
// remove the variables which were just dropped, from the other levels
// (to handle the case that a variable is dragged and dropped from another level)
bool levelRemoved = false;
vector<Options*>::iterator itr = _levels.begin();
while (itr != _levels.end())
{
Options *level = *itr;
if (level == levelDroppedOn)
{
itr++;
continue;
}
OptionVariables *variablesOption = dynamic_cast<OptionVariables*>(level->get("variables"));
Terms currentVariables = variablesOption->variables();
currentVariables.remove(variables);
if (currentVariables.size() == 0)
{
delete variablesOption;
itr = _levels.erase(itr);
levelRemoved = true;
}
else
{
variablesOption->setValue(currentVariables.asVector());
itr++;
}
}
if (levelRemoved)
{
// update the level names
OptionString *nameOption = static_cast<OptionString *>(_boundTo->rowTemplate()->get("name"));
QString nameTemplate = tq(nameOption->value());
for (uint i = 0; i < _levels.size(); i++)
{
nameOption = static_cast<OptionString *>(_levels.at(i)->get("name"));
nameOption->setValue(fq(nameTemplate.arg(i + 1)));
}
}
_boundTo->setValue(_levels);
refresh();
return true;
}
}
return false;
}
bool TableModelVariablesLevels::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const
{
Q_UNUSED(action);
Q_UNUSED(row);
Q_UNUSED(column);
Q_UNUSED(parent);
if (data->hasFormat("application/vnd.list.variable"))
{
QByteArray encodedData = data->data("application/vnd.list.variable");
Terms variables;
variables.set(encodedData);
foreach (const Term &variable, variables)
{
if ( ! isAllowed(variable))
return false;
}
return true;
}
else
{
return false;
}
return false;
}
void TableModelVariablesLevels::setSource(TableModelVariablesAvailable *source)
{
_source = source;
setInfoProvider(source);
}
void TableModelVariablesLevels::refresh()
{
_rows.clear();
if (_boundTo == NULL)
return;
beginResetModel();
uint i;
for (i = 0; i < _levels.size(); i++)
{
Options *level = _levels.at(i);
OptionVariables *variablesOption = dynamic_cast<OptionVariables *>(level->get("variables"));
OptionString *nameOption = dynamic_cast<OptionString *>(level->get("name"));
vector<string> variables = variablesOption->variables();
_rows.append(Row(tq(nameOption->value()), true));
for (uint j = 2; j < level->size(); j++)
{
OptionList *list = dynamic_cast<OptionList *>(level->get(j));
_rows.append(Row(list));
}
foreach (const string &variable, variables)
_rows.append(Row(tq(variable)));
}
if (_limitToOneLevel == false)
{
OptionString *nameTemplate = static_cast<OptionString *>(_boundTo->rowTemplate()->get("name"));
QString name = tq(nameTemplate->value()).arg(i + 1);
_rows.append(Row(name, true));
}
endResetModel();
}
|
agpl-3.0
|
oneclickorgs/one-click-orgs
|
app/models/change_board_composition_resolution.rb
|
1028
|
class ChangeBoardCompositionResolution < ResolutionWrapper
attr_accessor :max_user_directors, :max_employee_directors, :max_supporter_directors,
:max_producer_directors, :max_consumer_directors
def after_initialize
[
:max_user_directors, :max_employee_directors, :max_supporter_directors, :max_producer_directors, :max_consumer_directors
].each do |clause_name|
send("#{clause_name}=", organisation.constitution.send(clause_name)) unless send(clause_name)
end
end
def attributes_for_resolutions
result = []
[:user, :employee, :supporter, :producer, :consumer].each do |member_type|
method = "max_#{member_type}_directors"
if organisation.send(method) != send(method).to_i
result.push({
:relation => :change_integer_resolutions,
:name => method,
:value => send(method).to_i,
:title => "Allow a maximum of #{send(method)} #{member_type.to_s.titlecase} Members on the Board"
})
end
end
result
end
end
|
agpl-3.0
|
codegram/decidim
|
decidim-surveys/lib/decidim/surveys/version.rb
|
161
|
# frozen_string_literal: true
module Decidim
# This holds the decidim-surveys version.
module Surveys
def self.version
"0.22.0"
end
end
end
|
agpl-3.0
|
v12technology/fluxtion-utils
|
runtime-plugins/src/main/java/com/fluxtion/runtime/plugin/executor/SingleThreadedAsyncEventHandler.java
|
1904
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.fluxtion.runtime.plugin.executor;
import com.fluxtion.runtime.event.Event;
import com.fluxtion.runtime.lifecycle.EventHandler;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
*
* @author Greg Higgins (greg.higgins@V12technology.com)
*/
public class SingleThreadedAsyncEventHandler implements AsyncEventHandler {
private final EventHandler handler;
public SingleThreadedAsyncEventHandler(EventHandler handler) {
this.handler = handler;
}
@Override
public Future submitTask(SepCallable task) {
return new Future() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return true;
}
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isDone() {
return true;
}
@Override
public Object get() throws InterruptedException, ExecutionException {
try {
return task.call(handler);
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
@Override
public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return get();
}
};
}
@Override
public void onEvent(Event e) {
handler.onEvent(e);
}
@Override
public EventHandler delegate() {
return handler;
}
}
|
agpl-3.0
|
ChiweenieDijon/noonian-sys
|
noonian_pkg/AngularTemplate/perspective_editor.html.[content].qwW8v9NIReKHdrGiRZl9tg.html
|
1442
|
<div>
<div class="modal-header">
<h3 class="modal-title">{{title}}</h3>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-6">
<div class="picker-list-title">Available Fields</div>
<div class="list-group basic-picker-list">
<div class="list-group-item" ng-repeat="fi in availableFields" ng-hide="fi.included" ng-click="addField(fi)">
{{fi.fieldLabel}}
</div>
</div>
</div>
<div class="col-sm-6">
<div class="picker-list-title">Displayed Fields</div>
<div class="list-group basic-picker-list">
<div class="list-group-item" ng-repeat="fieldName in fieldList" ng-class="{'selected-item':selectedForMove($index)}" ng-click="selectForMove($index)">
<span>{{getFieldLabel(fieldName)}}</span>
<button class="pull-right" ng-click="remove($index)"> <i class="fa fa-close"></i></button>
</div>
</div>
<div class="text-center">
<button class="btn btn-default" ng-click="moveUp()" ng-disabled="!canMoveUp()"> <i class="fa fa-arrow-up"></i></button>
<button class="btn btn-default" ng-click="moveDown()" ng-disabled="!canMoveDown()"> <i class="fa fa-arrow-down"></i></button>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-warning" type="button" ng-click="$close()">Done</button>
</div>
</div>
|
agpl-3.0
|
Asqatasun/Web-Snapshot
|
README.md
|
1457
|
[](LICENSE)
[](https://travis-ci.org/Asqatasun/Web-Snapshot)
[](https://github.com/Asqatasun/Web-Snapshot/releases/latest)
[](https://github.com/Asqatasun/Web-Snapshot/blob/develop/CODE_OF_CONDUCT.md)
[](https://github.com/Asqatasun/Web-Snapshot/blob/develop/CONTRIBUTING.md)
# Asqatasun Web-Snapshot
Java API to create snaphots or thumbnails of webpage
## Documentation
How to build, install and use ?
Go to the [documentation](documentation/) !
## Support and discussions
* [Asqatasun discussion space](http://forum.asqatasun.org/)
* [Twitter @Asqatasun](https://twitter.com/Asqatasun)
* email to `asqatasun AT asqatasun dot org` (only English, French and klingon is spoken :) )
## Contribute
We would be really glad to have you on board ! You can help in many ways:
* [Fill in a bug report](https://github.com/Asqatasun/Web-Snapshot/issues)
* [Pull Requests](https://github.com/Asqatasun/Web-Snapshot/pulls) are off course welcome
Everything is summarized in the [CONTRIBUTING](CONTRIBUTING.md) file.
## License
[AGPL v3](LICENSE)
|
agpl-3.0
|
gwater/rlo-plan
|
entry.js
|
16345
|
/**
* This file is part of RLO-Plan.
*
* Copyright 2009, 2010 Tillmann Karras, Josua Grawitter
*
* RLO-Plan is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RLO-Plan is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with RLO-Plan. If not, see <http://www.gnu.org/licenses/>.
*/
var column_titles = ['Uhrzeit', 'Klasse', 'Fach', 'Dauer', 'Vertretung', 'Änderung', 'Alter Raum', 'Neuer Raum'];
var column_names = ['time', 'course', 'subject', 'duration', 'sub', 'change', 'oldroom', 'newroom'];
var column_widths = ['40px', '40px', '45px', '25px', '150px', '245px', '40px', '40px'];
var column_maxLengths = [ 5, 5, 6, 3, 30, 40, 5, 5];
var day_names = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'];
var relative_day_names = ['heute', 'morgen', 'übermorgen']; // array index corresponds to distance from today
function modify_entry(button) {
hide_buttons(button);
show_buttons(button.nextSibling.nextSibling);
var row = button.parentNode.parentNode;
for (var i = 0; i < row.childNodes.length - 1; i++) {
var cell = row.childNodes[i];
make_textbox(cell, i);
make_backup(cell, cell.lastChild.value);
}
}
function remove_row(row) {
if (row.parentNode.childNodes.length == 2) {
var teacher = row.parentNode.parentNode;
var day = teacher.parentNode;
if (day.childNodes.length == 4) {
remove(day);
} else {
remove(teacher);
}
} else {
remove(row);
}
}
function delete_entry(button) {
hide_buttons(button.previousSibling);
var row = button.parentNode.parentNode;
var msg = 'action=delete&id=' + row.id.substr(5); // remove 'entry' from 'entry123'
var status = newStatus('Wird gelöscht...', row.lastChild);
send_msg(msg, function(xhr) {
if (xhr.status == 200) {
remove_row(row);
} else {
show_buttons(button.previousSibling);
remove_status(status, xhr);
}
});
}
function save_entry(button) {
var row = button.parentNode.parentNode;
var teacher = row.parentNode.parentNode;
var day = teacher.parentNode;
var date = parse_date(day.firstChild.textContent);
if (date === null) {
alert('Bitte berichtigen Sie erst das Datum.');
return;
}
date = format_date_server(date);
var msg = '&date=' + date + '&teacher=' + teacher.firstChild.textContent;
var contentHasChanged = false;
for (var i = 0; i < row.childNodes.length - 1; i++) {
var cell = row.childNodes[i];
var new_value = cell.firstChild.value;
if (i == 0) {
new_value = parse_time(new_value);
if (new_value === null) {
alert('Die Uhrzeit ist fehlerhaft.');
return;
}
hide_buttons(button);
}
if (new_value != cell.lastChild.textContent) {
cell.textContent = new_value;
msg += '&' + column_names[i] + '=' + new_value;
contentHasChanged = true;
} else {
cell.textContent = cell.lastChild.textContent;
}
}
if (contentHasChanged) {
msg = 'action=update&id=' + row.id.substr(5) + msg;
var status = newStatus('Wird gespeichert...', row.lastChild);
send_msg(msg, function(xhr) {
show_buttons(button.previousSibling.previousSibling);
if (xhr.status != 200) {
button.previousSibling.previousSibling.click();
}
remove_status(status, xhr);
});
} else {
show_buttons(button.previousSibling.previousSibling);
}
}
function save_new_entry(button) {
var row = button.parentNode.parentNode;
var teacher = row.parentNode.parentNode;
var day = teacher.parentNode;
var date = parse_date(day.firstChild.textContent);
if (date === null) {
alert('Bitte berichtigen Sie erst das Datum.');
return;
}
date = format_date_server(date);
var msg = '&date=' + date + '&teacher=' + teacher.firstChild.textContent;
for (var i = 0; i < row.childNodes.length - 1; i++) {
var cell = row.childNodes[i];
var new_value = cell.firstChild.value;
if (i == 0) {
new_value = parse_time(new_value);
if (new_value === null) {
alert('Die Uhrzeit ist fehlerhaft.');
return;
}
hide_buttons(button);
}
cell.textContent = new_value;
msg += '&' + column_names[i] + '=' + cell.textContent;
}
msg = 'action=add' + msg;
var status = newStatus('Wird hinzugefügt...', row.lastChild);
send_msg(msg, function(xhr) {
remove_status(status, xhr);
if (xhr.status == 200) {
row.id = 'entry' + xhr.responseText;
} else {
row.lastChild.firstChild.onclick();
}
// TODO: is this ok here?
show_buttons(button.previousSibling.previousSibling);
button.onclick = function() {
save_entry(button);
}
button.nextSibling.innerHTML = 'Abbrechen';
button.nextSibling.onclick = function() {
cancel_editing(button.nextSibling);
}
});
}
function delete_new_entry(button) {
remove_row(button.parentNode.parentNode);
}
function add_new_entry(button) {
var row = newElement('tr');
// data cells:
for (var i = 0; i < column_widths.length; i++) {
var cell = newCell('');
make_textbox(cell, i);
row.appendChild(cell);
}
// button cell:
var button_cell = newElement('td');
var mod_button = newButton('Bearbeiten', modify_entry);
mod_button.style.display = 'none';
button_cell.appendChild(mod_button);
var del_button = newButton('Löschen', delete_entry);
del_button.style.display = 'none';
button_cell.appendChild(del_button);
var save_button = newButton('Speichern', save_new_entry);
button_cell.appendChild(save_button);
var cancel_button = newButton('Löschen', delete_new_entry);
button_cell.appendChild(cancel_button);
row.appendChild(button_cell);
button.previousSibling.appendChild(row);
row.firstChild.firstChild.focus();
}
function add_teacher(button) {
var day = button.parentNode;
var teacher = newTeacher('Neuer Lehrer', []);
day.insertBefore(teacher, day.lastChild);
teacher.childNodes[1].value = '';
teacher.firstChild.onclick();
}
function parse_time(time) {
var matches = time.match(/^(\d\d?).(\d\d?)$/);
if (matches !== null) {
for (var i = 1; i <= 2; i++) {
if (matches[i].length == 1) {
matches[i] = '0' + matches[i];
}
}
return matches[1] + ':' + matches[2];
}
return null;
}
function parse_date(date) {
var matches = date.match(/(\d\d?).(\d\d?).((\d\d)?\d\d)$/);
if (matches !== null) {
var year = matches[3];
if (year.length == 2) {
year = '20' + year;
}
return new Date(year, matches[2] - 1, matches[1], 0, 0, 0, 0);
}
var lower_date = date.toLowerCase();
for (var i = 0; i < relative_day_names.length; i++) {
if (lower_date == relative_day_names[i]) {
var result = new Date();
result.setDate(result.getDate() + i);
return result;
}
}
if (date.length <= 10) { // length of 'Donnerstag'
for (var i = 0; i < day_names.length; i++) {
if (lower_date == day_names[i].substr(0, lower_date.length).toLowerCase()) {
var result = new Date();
var today = result.getDay();
if (i < today) {
i += 7;
}
result.setDate(result.getDate() + i - today);
return result;
}
}
}
return null;
}
// DayOfWeek, DD.MM.YYYY
function format_date_client(d) {
var day = d.getDate() + '';
if (day.length == 1) {
day = '0' + day;
}
var month = (d.getMonth() + 1) + '';
if (month.length == 1) {
month = '0' + month;
}
return day_names[d.getDay()] + ', ' + day + '.' + month + '.' + d.getFullYear();
}
// YYYY-MM-DD
function format_date_server(d) {
return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate();
}
function get_default_date() {
var d = new Date();
var last_day = document.getElementById('ovp').lastChild.previousSibling;
if (last_day) {
var last_date = parse_date(last_day.firstChild.textContent);
if (last_date && last_date.getDate() >= d.getDate()) {
d = last_date;
d.setDate(d.getDate() + 1);
}
}
if (d.getDay() == 0) { // skip Sunday
d.setDate(d.getDate() + 1);
} else if (d.getDay() == 6) { // skip Saturday
d.setDate(d.getDate() + 2);
}
return format_date_client(d);
}
function add_day(button) {
var ovp = button.parentNode;
var date = get_default_date();
var day = newDay(date, []);
ovp.insertBefore(day, ovp.lastChild);
day.firstChild.onclick();
}
// 'id' is from the database
function newEntry(id, cols) {
var row = newElement('tr');
row.id = 'entry' + id;
// data cells:
for (i in cols) {
row.appendChild(newCell(cols[i]));
}
// button cell:
var button_cell = newElement('td');
var mod_button = newButton('Bearbeiten', modify_entry);
button_cell.appendChild(mod_button);
var del_button = newButton('Löschen', delete_entry);
button_cell.appendChild(del_button);
var save_button = newButton('Speichern', save_entry);
save_button.style.display = 'none';
button_cell.appendChild(save_button);
var cancel_button = newButton('Abbrechen', cancel_editing);
cancel_button.style.display = 'none';
button_cell.appendChild(cancel_button);
row.appendChild(button_cell);
return row;
}
function save_teacher(teacher) {
// subfunction needed since otherwise "status" would reference one variable only
function update_entry(msg, parent) {
var status = newStatus('Wird aktualisiert...', parent);
send_msg(msg, function(xhr) {
remove_status(status, xhr);
});
}
var date = parse_date(teacher.parentNode.firstChild.textContent);
if (date === null) {
alert('Bitte berichtigen Sie erst das Datum.');
return;
}
date = format_date_server(date);
var rows = teacher.childNodes[2].childNodes;
for (var i = 1; i < rows.length; i++) {
var row = rows[i];
if (row.id) {
var cells = row.childNodes;
var msg = 'action=update&id=' + row.id.substr(5) + '&date=' + date + '&teacher=' + teacher.firstChild.textContent;
for (var j = 0; j < cells.length - 1; j++) {
msg += '&' + column_names[j] + '=' + cells[j].textContent;
}
update_entry(msg, row.lastChild);
}
}
}
function newTeacher(name, entries) {
var teacher = newElement('section');
var header = newElement('h3');
header.style.display = 'table';
header.innerHTML = name;
header.onclick = function() {
header.style.display = 'none';
var textbox = header.nextSibling;
textbox.style.display = 'block';
textbox.focus();
textbox.select();
}
teacher.appendChild(header);
var textbox = newElement('input');
textbox.type = 'text';
textbox.style.display = 'none';
textbox.value = name;
textbox['last_key'] = 0;
textbox.onkeydown = function(e) {
var key;
if (window.event) {
key = event.keyCode;
} else if (e) {
key = e.which;
}
if (key == 9 && textbox['last_key'] == 0) {
textbox['create_entry_on_first_blur'] = true;
}
textbox['last_key'] = key - 9;
return true;
}
textbox.onkeyup = function() {
textbox['last_key'] = 0;
}
textbox.onblur = function() {
textbox.style.display = 'none';
var header = textbox.previousSibling;
var table = textbox.nextSibling;
if (textbox.value != header.textContent && textbox.value != '') {
header.textContent = textbox.value;
if (table.childNodes.length > 1) {
save_teacher(textbox.parentNode);
}
}
if (table.childNodes.length == 1 && textbox['create_entry_on_first_blur']) {
textbox.parentNode.lastChild.onclick();
}
header.style.display = 'table';
}
teacher.appendChild(textbox);
var table = newElement('table');
table.setAttribute('class', 'ovp_table');
var header_row = newElement('tr');
for (var i = 0; i < column_titles.length; i++) {
header_row.appendChild(newCell(column_titles[i]));
}
header_row.appendChild(newCell('Aktion'));
table.appendChild(header_row);
for (i in entries) {
table.appendChild(entries[i]);
}
teacher.appendChild(table);
var entry_button = newButton('+ Eintrag', add_new_entry);
teacher.appendChild(entry_button);
return teacher;
}
function newDay(title, teachers) {
var day = newElement('section');
var header = newElement('h2');
header.style.display = 'table';
header.innerHTML = title;
header.onclick = function() {
header.style.display = 'none';
var textbox = header.nextSibling;
textbox.style.display = 'block';
textbox.focus();
textbox.select();
}
day.appendChild(header);
var textbox = newElement('input');
textbox.type = 'text';
textbox.style.display = 'none';
textbox.value = title;
textbox['last_key'] = 0;
textbox.onkeydown = function(e) {
var key;
if (window.event) {
key = event.keyCode;
} else if (e) {
key = e.which;
}
if (key == 9 && textbox['last_key'] == 0) {
textbox['create_teacher_on_first_blur'] = true;
}
textbox['last_key'] = key - 9;
return true;
}
textbox.onkeyup = function() {
textbox['last_key'] = 0;
}
textbox.onblur = function() {
var header = textbox.previousSibling;
if (textbox.value != '') {
var new_date = parse_date(textbox.value);
if (new_date) {
var new_header = format_date_client(new_date);
if (header.textContent != new_header) {
header.textContent = new_header;
var teachers = textbox.parentNode.getElementsByTagName('section');
for (var i = 0; i < teachers.length; i++) {
save_teacher(teachers[i]);
}
}
} else {
header.innerHTML = '<span class="ovp_error">' + textbox.value + '</span>';
}
}
textbox.style.display = 'none';
header.style.display = 'table';
if (textbox.parentNode.childNodes.length == 3 && textbox['create_teacher_on_first_blur']) {
textbox.parentNode.lastChild.onclick();
}
}
day.appendChild(textbox);
for (i in teachers) {
day.appendChild(teachers[i]);
}
day.appendChild(newButton('+ Lehrer', add_teacher));
return day;
}
function insert_days(days) {
var ovp = document.getElementById('ovp');
for (i in days) {
ovp.insertBefore(days[i], ovp.lastChild);
}
}
function init_entry() {
document.getElementById('ovp').appendChild(newButton('+ Tag', add_day));
fill_in_data();
}
document.addEventListener("DOMContentLoaded", init_entry, false);
|
agpl-3.0
|
safety-data/talismane
|
talismane_machine_learning/src/main/java/com/joliciel/talismane/machineLearning/features/IfThenElseGenericFeature.java
|
3068
|
///////////////////////////////////////////////////////////////////////////////
//Copyright (C) 2014 Joliciel Informatique
//
//This file is part of Talismane.
//
//Talismane is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//Talismane is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with Talismane. If not, see <http://www.gnu.org/licenses/>.
//////////////////////////////////////////////////////////////////////////////
package com.joliciel.talismane.machineLearning.features;
/**
* Mimics an in-then-else structure - if condition is true return thenFeature result, else return elseFeature result.
* @author Assaf Urieli
*
*/
public class IfThenElseGenericFeature<T,Y> extends AbstractCachableFeature<T,Y> {
private BooleanFeature<T> condition;
private Feature<T,Y> thenFeature;
private Feature<T,Y> elseFeature;
public IfThenElseGenericFeature(BooleanFeature<T> condition, Feature<T,Y> thenFeature, Feature<T,Y> elseFeature) {
super();
this.condition = condition;
this.thenFeature = thenFeature;
this.elseFeature = elseFeature;
this.setName("IfThenElse(" + condition.getName() + "," + thenFeature.getName() + "," + elseFeature.getName() + ")");
}
@Override
protected FeatureResult<Y> checkInternal(T context, RuntimeEnvironment env) {
FeatureResult<Y> featureResult = null;
FeatureResult<Boolean> conditionResult = condition.check(context, env);
if (conditionResult!=null) {
boolean conditionOutcome = conditionResult.getOutcome();
if (conditionOutcome) {
FeatureResult<Y> thenFeatureResult = thenFeature.check(context, env);
if (thenFeatureResult!=null) {
Y result = thenFeatureResult.getOutcome();
featureResult = this.generateResult(result);
}
} else {
FeatureResult<Y> elseFeatureResult = elseFeature.check(context, env);
if (elseFeatureResult!=null) {
Y result = elseFeatureResult.getOutcome();
featureResult = this.generateResult(result);
}
}
}
return featureResult;
}
public BooleanFeature<T> getCondition() {
return condition;
}
public Feature<T,Y> getThenFeature() {
return thenFeature;
}
public Feature<T,Y> getElseFeature() {
return elseFeature;
}
public void setCondition(BooleanFeature<T> condition) {
this.condition = condition;
}
public void setThenFeature(Feature<T,Y> thenFeature) {
this.thenFeature = thenFeature;
}
public void setElseFeature(Feature<T,Y> elseFeature) {
this.elseFeature = elseFeature;
}
@SuppressWarnings("rawtypes")
@Override
public Class<? extends Feature> getFeatureType() {
return thenFeature.getFeatureType();
}
}
|
agpl-3.0
|
canonical-websites/build.snapcraft.io
|
src/common/containers/container.css
|
722
|
.wrapper {
box-sizing: border-box;
max-width: 1038px;
margin: 0 auto;
padding: 0;
width: 100%;
}
.container {
composes: wrapper;
margin-bottom: 60px;
padding: 1rem 1.25rem;
}
.spinner {
width: 20px;
margin: 5px auto;
}
.strip {
clear: both;
padding: 2rem 0;
position: relative;
width: 100%;
}
.lightStrip {
composes: strip;
background-color: $light-grey;
}
.repoHeading {
display: flex;
align-items: baseline;
justify-content: space-between;
}
.row {
display: flex;
justify-content: space-between;
}
.rowItem {
display: flex;
flex: 1;
margin-right: 20px;
}
.rowItem:last-child {
margin-right: 0;
}
.buildOnDemand {
display: flex;
justify-content: flex-end;
}
|
agpl-3.0
|
consul/consul
|
app/controllers/sdg_management/cards_controller.rb
|
374
|
class SDGManagement::CardsController < SDGManagement::BaseController
include Admin::Widget::CardsActions
helper_method :index_path
load_and_authorize_resource :phase, class: "SDG::Phase", id_param: "sdg_phase_id"
load_and_authorize_resource :card, through: :phase, class: "Widget::Card"
private
def index_path
sdg_management_homepage_path
end
end
|
agpl-3.0
|
rahulvador/CoreHD
|
Kernel/Modules/AdminPackageManager.pm
|
65102
|
# --
# Kernel/Modules/AdminPackageManager.pm - manage software packages
# Copyright (C) 2001-2014 OTRS AG, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
package Kernel::Modules::AdminPackageManager;
use strict;
use warnings;
use XML::FeedPP;
use Kernel::System::Package;
use Kernel::System::Web::UploadCache;
use Kernel::System::Cache;
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {%Param};
bless( $Self, $Type );
# check needed objects
for my $Needed (qw(ParamObject DBObject LayoutObject LogObject ConfigObject MainObject)) {
if ( !$Self->{$Needed} ) {
$Self->{LayoutObject}->FatalError( Message => "Got no $Needed!" );
}
}
$Self->{PackageObject} = Kernel::System::Package->new(%Param);
$Self->{UploadCacheObject} = Kernel::System::Web::UploadCache->new(%Param);
$Self->{CacheObject} = Kernel::System::Cache->new(%Param);
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
my $Source = $Self->{UserRepository} || '';
my %Errors;
# ------------------------------------------------------------ #
# check mod perl version and Apache::Reload
# ------------------------------------------------------------ #
if ( exists $ENV{MOD_PERL} ) {
if ( defined $mod_perl::VERSION ) { ## no critic
if ( $mod_perl::VERSION >= 1.99 ) { ## no critic
# check if Apache::Reload is loaded
my $ApacheReload = 0;
for my $Module ( sort keys %INC ) {
$Module =~ s/\//::/g;
$Module =~ s/\.pm$//g;
if ( $Module eq 'Apache::Reload' || $Module eq 'Apache2::Reload' ) {
$ApacheReload = 1;
}
}
if ( !$ApacheReload ) {
return $Self->{LayoutObject}->ErrorScreen(
Message =>
'Sorry, Apache::Reload is needed as PerlModule and '
.
'PerlInitHandler in Apache config file. See also scripts/apache2-httpd.include.conf. '
.
'Alternatively, you can use the cmd tool bin/otrs.PackageManager.pl to install packages!'
);
}
}
}
}
# secure mode message (don't allow this action until secure mode is enabled)
if ( !$Self->{ConfigObject}->Get('SecureMode') ) {
$Self->{LayoutObject}->SecureMode();
}
# ------------------------------------------------------------ #
# view diff file
# ------------------------------------------------------------ #
if ( $Self->{Subaction} eq 'ViewDiff' ) {
my $Name = $Self->{ParamObject}->GetParam( Param => 'Name' ) || '';
my $Version = $Self->{ParamObject}->GetParam( Param => 'Version' ) || '';
my $Location = $Self->{ParamObject}->GetParam( Param => 'Location' );
# get package
my $Package = $Self->{PackageObject}->RepositoryGet(
Name => $Name,
Version => $Version,
Result => 'SCALAR',
);
if ( !$Package ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
my %Structure = $Self->{PackageObject}->PackageParse( String => $Package );
my $File = '';
if ( ref $Structure{Filelist} eq 'ARRAY' ) {
for my $Hash ( @{ $Structure{Filelist} } ) {
if ( $Hash->{Location} eq $Location ) {
$File = $Hash->{Content};
}
}
}
my $LocalFile = $Self->{ConfigObject}->Get('Home') . "/$Location";
# do not allow to read file with including .. path (security related)
$LocalFile =~ s/\.\.//g;
if ( !$File ) {
$Self->{LayoutObject}->Block(
Name => 'FileDiff',
Data => {
Location => $Location,
Name => $Name,
Version => $Version,
Diff => "No such file $LocalFile in package!",
},
);
}
elsif ( !-e $LocalFile ) {
$Self->{LayoutObject}->Block(
Name => 'FileDiff',
Data => {
Location => $Location,
Name => $Name,
Version => $Version,
Diff => "No such file $LocalFile in local file system!",
},
);
}
elsif ( -e $LocalFile ) {
my $Content = $Self->{MainObject}->FileRead(
Location => $LocalFile,
Mode => 'binmode',
);
if ($Content) {
$Self->{MainObject}->Require('Text::Diff');
my $Diff = Text::Diff::diff( \$File, $Content, { STYLE => 'OldStyle' } );
$Self->{LayoutObject}->Block(
Name => "FileDiff",
Data => {
Location => $Location,
Name => $Name,
Version => $Version,
Diff => $Diff,
},
);
}
else {
$Self->{LayoutObject}->Block(
Name => "FileDiff",
Data => {
Location => $Location,
Name => $Name,
Version => $Version,
Diff => "Can't read $LocalFile!",
},
);
}
}
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# ------------------------------------------------------------ #
# view package
# ------------------------------------------------------------ #
if ( $Self->{Subaction} eq 'View' ) {
my $Name = $Self->{ParamObject}->GetParam( Param => 'Name' ) || '';
my $Version = $Self->{ParamObject}->GetParam( Param => 'Version' ) || '';
my $Location = $Self->{ParamObject}->GetParam( Param => 'Location' );
my %Frontend;
# get package
my $Package = $Self->{PackageObject}->RepositoryGet(
Name => $Name,
Version => $Version,
Result => 'SCALAR',
);
if ( !$Package ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
# parse package
my %Structure = $Self->{PackageObject}->PackageParse( String => $Package );
# online verification
my $Verified = $Self->{PackageObject}->PackageVerify(
Package => $Package,
Structure => \%Structure,
) || 'verified';
my %VerifyInfo = $Self->{PackageObject}->PackageVerifyInfo();
# translate description
if ( $Self->{LayoutObject}->{LanguageObject} ) {
$VerifyInfo{Description} = $Self->{LayoutObject}->{LanguageObject}->Get(
$VerifyInfo{Description}
);
}
# deploy check
my $Deployed = $Self->{PackageObject}->DeployCheck(
Name => $Name,
Version => $Version,
);
my %DeployInfo = $Self->{PackageObject}->DeployCheckInfo();
$Self->{LayoutObject}->Block(
Name => 'Package',
Data => { %Param, %Frontend, Name => $Name, Version => $Version, },
);
for my $PackageAction (qw(DownloadLocal Rebuild Reinstall)) {
$Self->{LayoutObject}->Block(
Name => 'Package' . $PackageAction,
Data => {
%Param,
%Frontend,
Name => $Name,
Version => $Version,
},
);
}
# check if file is requested
if ($Location) {
if ( ref $Structure{Filelist} eq 'ARRAY' ) {
for my $Hash ( @{ $Structure{Filelist} } ) {
if ( $Hash->{Location} eq $Location ) {
return $Self->{LayoutObject}->Attachment(
Filename => $Location,
ContentType => 'application/octet-stream',
Content => $Hash->{Content},
);
}
}
}
}
my @DatabaseBuffer;
for my $Key ( sort keys %Structure ) {
if ( ref $Structure{$Key} eq 'HASH' ) {
if ( $Key =~ /^(Description|Filelist)$/ ) {
$Self->{LayoutObject}->Block(
Name => "PackageItem$Key",
Data => { Tag => $Key, %{ $Structure{$Key} } },
);
}
elsif ( $Key =~ /^Database(Install|Reinstall|Upgrade|Uninstall)$/ ) {
for my $Type (qw(pre post)) {
for my $Hash ( @{ $Structure{$Key}->{$Type} } ) {
if ( $Hash->{TagType} eq 'Start' ) {
if ( $Hash->{Tag} =~ /^Table/ ) {
$Self->{LayoutObject}->Block(
Name => "PackageItemDatabase",
Data => { %{$Hash}, TagName => $Key, Type => $Type },
);
push @DatabaseBuffer, $Hash;
}
else {
$Self->{LayoutObject}->Block(
Name => "PackageItemDatabaseSub",
Data => { %{$Hash}, TagName => $Key, },
);
push @DatabaseBuffer, $Hash;
}
}
if ( $Hash->{Tag} =~ /^Table/ && $Hash->{TagType} eq 'End' ) {
push @DatabaseBuffer, $Hash;
my @SQL = $Self->{DBObject}->SQLProcessor(
Database => \@DatabaseBuffer
);
my @SQLPost = $Self->{DBObject}->SQLProcessorPost();
push @SQL, @SQLPost;
for my $SQL (@SQL) {
$Self->{LayoutObject}->Block(
Name => "PackageItemDatabaseSQL",
Data => { TagName => $Key, SQL => $SQL, },
);
}
@DatabaseBuffer = ();
}
}
}
}
else {
$Self->{LayoutObject}->Block(
Name => 'PackageItemGeneric',
Data => { Tag => $Key, %{ $Structure{$Key} } },
);
}
}
elsif ( ref $Structure{$Key} eq 'ARRAY' ) {
for my $Hash ( @{ $Structure{$Key} } ) {
if ( $Key =~ /^(Description|ChangeLog)$/ ) {
$Self->{LayoutObject}->Block(
Name => "PackageItem$Key",
Data => { %{$Hash}, Tag => $Key, },
);
}
elsif ( $Key =~ /^Code/ ) {
$Hash->{Content} = $Self->{LayoutObject}->Ascii2Html(
Text => $Hash->{Content},
HTMLResultMode => 1,
NewLine => 72,
);
$Self->{LayoutObject}->Block(
Name => "PackageItemCode",
Data => { Tag => $Key, %{$Hash} },
);
}
elsif ( $Key =~ /^(Intro)/ ) {
if ( $Hash->{Format} && $Hash->{Format} =~ /plain/i ) {
$Hash->{Content}
= '<pre class="contentbody">' . $Hash->{Content} . '</pre>';
}
$Self->{LayoutObject}->Block(
Name => "PackageItemIntro",
Data => { %{$Hash}, Tag => $Key, },
);
}
elsif ( $Hash->{Tag} =~ /^(File)$/ ) {
# add human readable file size
if ( $Hash->{Size} ) {
# remove meta data in files
if ( $Hash->{Size} > ( 1024 * 1024 ) ) {
$Hash->{Size} = sprintf "%.1f MBytes",
( $Hash->{Size} / ( 1024 * 1024 ) );
}
elsif ( $Hash->{Size} > 1024 ) {
$Hash->{Size} = sprintf "%.1f KBytes", ( ( $Hash->{Size} / 1024 ) );
}
else {
$Hash->{Size} = $Hash->{Size} . ' Bytes';
}
}
$Self->{LayoutObject}->Block(
Name => "PackageItemFilelistFile",
Data => {
Name => $Name,
Version => $Version,
%{$Hash},
},
);
if ( $DeployInfo{File}->{ $Hash->{Location} } ) {
if ( $DeployInfo{File}->{ $Hash->{Location} } =~ /different/ ) {
$Self->{LayoutObject}->Block(
Name => "PackageItemFilelistFileNoteDiff",
Data => {
Name => $Name,
Version => $Version,
%{$Hash},
Message => $DeployInfo{File}->{ $Hash->{Location} },
Icon => 'IconNotReady',
},
);
}
else {
$Self->{LayoutObject}->Block(
Name => "PackageItemFilelistFileNote",
Data => {
Name => $Name,
Version => $Version,
%{$Hash},
Message => $DeployInfo{File}->{ $Hash->{Location} },
Icon => 'IconNotReadyGrey',
},
);
}
}
else {
$Self->{LayoutObject}->Block(
Name => "PackageItemFilelistFileNote",
Data => {
Name => $Name,
Version => $Version,
%{$Hash},
Message => 'ok',
Icon => 'IconReady',
},
);
}
}
else {
$Self->{LayoutObject}->Block(
Name => "PackageItemGeneric",
Data => { %{$Hash}, Tag => $Key, },
);
}
}
}
}
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
if ( !$Deployed ) {
$Output .= $Self->{LayoutObject}->Notify(
Priority => 'Error',
Data => "$Name $Version"
. ' - $Text{"Package not correctly deployed! Please reinstall the package."}',
Link => '$Env{"Baselink"}Action=$Env{"Action"};Subaction=View;Name='
. $Name
. ';Version='
. $Version,
);
}
if ( $Verified ne 'verified' ) {
$Output .= $Self->{LayoutObject}->Notify(
Priority => 'Error',
Data => "$Name $Version - "
. '$Text{"Package not verified by the OTRS Group! It is recommended not to use this package."}',
);
}
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# ------------------------------------------------------------ #
# view remote package
# ------------------------------------------------------------ #
if ( $Self->{Subaction} eq 'ViewRemote' ) {
my $File = $Self->{ParamObject}->GetParam( Param => 'File' ) || '';
my $Location = $Self->{ParamObject}->GetParam( Param => 'Location' );
my %Frontend;
# download package
my $Package = $Self->{PackageObject}->PackageOnlineGet(
Source => $Source,
File => $File,
);
if ( !$Package ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
my %Structure = $Self->{PackageObject}->PackageParse( String => $Package );
$Self->{LayoutObject}->Block(
Name => 'Package',
Data => { %Param, %Frontend, },
);
$Self->{LayoutObject}->Block(
Name => 'PackageDownloadRemote',
Data => { %Param, %Frontend, File => $File, },
);
# check if file is requested
if ($Location) {
if ( ref $Structure{Filelist} eq 'ARRAY' ) {
for my $Hash ( @{ $Structure{Filelist} } ) {
if ( $Hash->{Location} eq $Location ) {
return $Self->{LayoutObject}->Attachment(
Filename => $Location,
ContentType => 'application/octet-stream',
Content => $Hash->{Content},
);
}
}
}
}
my @DatabaseBuffer;
for my $Key ( sort keys %Structure ) {
if ( ref $Structure{$Key} eq 'HASH' ) {
if ( $Key =~ /^(Description|Filelist)$/ ) {
$Self->{LayoutObject}->Block(
Name => "PackageItem$Key",
Data => { Tag => $Key, %{ $Structure{$Key} } },
);
}
elsif ( $Key =~ /^Database(Install|Reinstall|Upgrade|Uninstall)$/ ) {
for my $Type (qw(pre post)) {
for my $Hash ( @{ $Structure{$Key}->{$Type} } ) {
if ( $Hash->{TagType} eq 'Start' ) {
if ( $Hash->{Tag} =~ /^Table/ ) {
$Self->{LayoutObject}->Block(
Name => "PackageItemDatabase",
Data => { %{$Hash}, TagName => $Key, Type => $Type },
);
push @DatabaseBuffer, $Hash;
}
else {
$Self->{LayoutObject}->Block(
Name => "PackageItemDatabaseSub",
Data => { %{$Hash}, TagName => $Key, },
);
push @DatabaseBuffer, $Hash;
}
}
if ( $Hash->{Tag} =~ /^Table/ && $Hash->{TagType} eq 'End' ) {
push @DatabaseBuffer, $Hash;
my @SQL = $Self->{DBObject}->SQLProcessor(
Database => \@DatabaseBuffer
);
my @SQLPost = $Self->{DBObject}->SQLProcessorPost();
push @SQL, @SQLPost;
for my $SQL (@SQL) {
$Self->{LayoutObject}->Block(
Name => "PackageItemDatabaseSQL",
Data => { TagName => $Key, SQL => $SQL, },
);
}
@DatabaseBuffer = ();
}
}
}
}
else {
$Self->{LayoutObject}->Block(
Name => 'PackageItemGeneric',
Data => { Tag => $Key, %{ $Structure{$Key} } },
);
}
}
elsif ( ref $Structure{$Key} eq 'ARRAY' ) {
for my $Hash ( @{ $Structure{$Key} } ) {
if ( $Key =~ /^(Description|ChangeLog)$/ ) {
$Self->{LayoutObject}->Block(
Name => "PackageItem$Key",
Data => { %{$Hash}, Tag => $Key, },
);
}
elsif ( $Key =~ /^Code/ ) {
$Hash->{Content} = $Self->{LayoutObject}->Ascii2Html(
Text => $Hash->{Content},
HTMLResultMode => 1,
NewLine => 72,
);
$Self->{LayoutObject}->Block(
Name => "PackageItemCode",
Data => { Tag => $Key, %{$Hash} },
);
}
elsif ( $Key =~ /^(Intro)/ ) {
if ( $Hash->{Format} && $Hash->{Format} =~ /plain/i ) {
$Hash->{Content}
= '<pre class="contentbody">' . $Hash->{Content} . '</pre>';
}
$Self->{LayoutObject}->Block(
Name => "PackageItemIntro",
Data => { %{$Hash}, Tag => $Key, },
);
}
elsif ( $Hash->{Tag} =~ /^(File)$/ ) {
# add human readable file size
if ( $Hash->{Size} ) {
# remove meta data in files
if ( $Hash->{Size} > ( 1024 * 1024 ) ) {
$Hash->{Size} = sprintf "%.1f MBytes",
( $Hash->{Size} / ( 1024 * 1024 ) );
}
elsif ( $Hash->{Size} > 1024 ) {
$Hash->{Size} = sprintf "%.1f KBytes", ( ( $Hash->{Size} / 1024 ) );
}
else {
$Hash->{Size} = $Hash->{Size} . ' Bytes';
}
}
$Self->{LayoutObject}->Block(
Name => 'PackageItemFilelistFile',
Data => {
Name => $Structure{Name}->{Content},
Version => $Structure{Version}->{Content},
File => $File,
%{$Hash},
},
);
}
else {
$Self->{LayoutObject}->Block(
Name => 'PackageItemGeneric',
Data => { %{$Hash}, Tag => $Key, },
);
}
}
}
}
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# ------------------------------------------------------------ #
# download package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'Download' ) {
my $Name = $Self->{ParamObject}->GetParam( Param => 'Name' ) || '';
my $Version = $Self->{ParamObject}->GetParam( Param => 'Version' ) || '';
# get package
my $Package = $Self->{PackageObject}->RepositoryGet(
Name => $Name,
Version => $Version,
);
if ( !$Package ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
return $Self->{LayoutObject}->Attachment(
Content => $Package,
ContentType => 'application/octet-stream',
Filename => "$Name-$Version.opm",
Type => 'attachment',
);
}
# ------------------------------------------------------------ #
# download remote package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'DownloadRemote' ) {
my $File = $Self->{ParamObject}->GetParam( Param => 'File' ) || '';
# download package
my $Package = $Self->{PackageObject}->PackageOnlineGet(
Source => $Source,
File => $File,
);
# check
if ( !$Package ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
return $Self->{LayoutObject}->Attachment(
Content => $Package,
ContentType => 'application/octet-stream',
Filename => $File,
Type => 'attachment',
);
}
# ------------------------------------------------------------ #
# change repository
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'ChangeRepository' ) {
# challenge token check for write action
$Self->{LayoutObject}->ChallengeTokenCheck();
my $Source = $Self->{ParamObject}->GetParam( Param => 'Source' ) || '';
$Self->{SessionObject}->UpdateSessionID(
SessionID => $Self->{SessionID},
Key => 'UserRepository',
Value => $Source,
);
return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
}
# ------------------------------------------------------------ #
# install package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'Install' ) {
# challenge token check for write action
$Self->{LayoutObject}->ChallengeTokenCheck();
my $Name = $Self->{ParamObject}->GetParam( Param => 'Name' ) || '';
my $Version = $Self->{ParamObject}->GetParam( Param => 'Version' ) || '';
# get package
my $Package = $Self->{PackageObject}->RepositoryGet(
Name => $Name,
Version => $Version,
Result => 'SCALAR',
);
return $Self->_InstallHandling( Package => $Package );
}
# ------------------------------------------------------------ #
# install remote package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'InstallRemote' ) {
# challenge token check for write action
$Self->{LayoutObject}->ChallengeTokenCheck();
my $File = $Self->{ParamObject}->GetParam( Param => 'File' ) || '';
# download package
my $Package = $Self->{PackageObject}->PackageOnlineGet(
Source => $Source,
File => $File,
);
return $Self->_InstallHandling(
Package => $Package,
Source => $Source,
File => $File,
);
}
# ------------------------------------------------------------ #
# upgrade remote package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'UpgradeRemote' ) {
# challenge token check for write action
$Self->{LayoutObject}->ChallengeTokenCheck();
my $File = $Self->{ParamObject}->GetParam( Param => 'File' ) || '';
# download package
my $Package = $Self->{PackageObject}->PackageOnlineGet(
File => $File,
Source => $Source,
);
return $Self->_UpgradeHandling(
Package => $Package,
File => $File,
Source => $Source,
);
}
# ------------------------------------------------------------ #
# reinstall package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'Reinstall' ) {
# challenge token check for write action
$Self->{LayoutObject}->ChallengeTokenCheck();
my $Name = $Self->{ParamObject}->GetParam( Param => 'Name' ) || '';
my $Version = $Self->{ParamObject}->GetParam( Param => 'Version' ) || '';
my $IntroReinstallPre = $Self->{ParamObject}->GetParam( Param => 'IntroReinstallPre' )
|| '';
# get package
my $Package = $Self->{PackageObject}->RepositoryGet(
Name => $Name,
Version => $Version,
Result => 'SCALAR',
);
if ( !$Package ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
# check if we have to show reinstall intro pre
my %Structure = $Self->{PackageObject}->PackageParse( String => $Package, );
# intro screen
my %Data;
if ( $Structure{IntroReinstall} ) {
%Data = $Self->_MessageGet( Info => $Structure{IntroReinstall}, Type => 'pre' );
}
if ( %Data && !$IntroReinstallPre ) {
$Self->{LayoutObject}->Block(
Name => 'Intro',
Data => {
%Param,
%Data,
Subaction => $Self->{Subaction},
Type => 'IntroReinstallPre',
Name => $Structure{Name}->{Content},
Version => $Structure{Version}->{Content},
},
);
$Self->{LayoutObject}->Block(
Name => 'IntroCancel',
);
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
Data => \%Param,
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# reinstall screen
else {
$Self->{LayoutObject}->Block(
Name => 'Reinstall',
Data => {
%Param,
Name => $Structure{Name}->{Content},
Version => $Structure{Version}->{Content},
},
);
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
}
# ------------------------------------------------------------ #
# reinstall action package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'ReinstallAction' ) {
# challenge token check for write action
$Self->{LayoutObject}->ChallengeTokenCheck();
my $Name = $Self->{ParamObject}->GetParam( Param => 'Name' ) || '';
my $Version = $Self->{ParamObject}->GetParam( Param => 'Version' ) || '';
my $IntroReinstallPost = $Self->{ParamObject}->GetParam( Param => 'IntroReinstallPost' )
|| '';
# get package
my $Package = $Self->{PackageObject}->RepositoryGet(
Name => $Name,
Version => $Version,
);
if ( !$Package ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
# check if we have to show reinstall intro pre
my %Structure = $Self->{PackageObject}->PackageParse( String => $Package, );
# intro screen
if ( !$Self->{PackageObject}->PackageReinstall( String => $Package ) ) {
return $Self->{LayoutObject}->ErrorScreen();
}
my %Data;
if ( $Structure{IntroReinstall} ) {
%Data = $Self->_MessageGet( Info => $Structure{IntroReinstall}, Type => 'post' );
}
if ( %Data && !$IntroReinstallPost ) {
$Self->{LayoutObject}->Block(
Name => 'Intro',
Data => {
%Param,
%Data,
Subaction => '',
Type => 'IntroReinstallPost',
Name => $Name,
Version => $Version,
},
);
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# redirect
return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
}
# ------------------------------------------------------------ #
# uninstall package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'Uninstall' ) {
# challenge token check for write action
$Self->{LayoutObject}->ChallengeTokenCheck();
my $Name = $Self->{ParamObject}->GetParam( Param => 'Name' ) || '';
my $Version = $Self->{ParamObject}->GetParam( Param => 'Version' ) || '';
my $IntroUninstallPre = $Self->{ParamObject}->GetParam( Param => 'IntroUninstallPre' )
|| '';
# get package
my $Package = $Self->{PackageObject}->RepositoryGet(
Name => $Name,
Version => $Version,
Result => 'SCALAR',
);
if ( !$Package ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
# check if we have to show uninstall intro pre
my %Structure = $Self->{PackageObject}->PackageParse( String => $Package, );
# intro screen
my %Data;
if ( $Structure{IntroUninstall} ) {
%Data = $Self->_MessageGet( Info => $Structure{IntroUninstall}, Type => 'pre' );
}
if ( %Data && !$IntroUninstallPre ) {
$Self->{LayoutObject}->Block(
Name => 'Intro',
Data => {
%Param,
%Data,
Subaction => $Self->{Subaction},
Type => 'IntroUninstallPre',
Name => $Structure{Name}->{Content},
Version => $Structure{Version}->{Content},
},
);
$Self->{LayoutObject}->Block(
Name => 'IntroCancel',
);
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# uninstall screen
else {
$Self->{LayoutObject}->Block(
Name => 'Uninstall',
Data => {
%Param,
Name => $Structure{Name}->{Content},
Version => $Structure{Version}->{Content},
},
);
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
}
# ------------------------------------------------------------ #
# uninstall action package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'UninstallAction' ) {
# challenge token check for write action
$Self->{LayoutObject}->ChallengeTokenCheck();
my $Name = $Self->{ParamObject}->GetParam( Param => 'Name' ) || '';
my $Version = $Self->{ParamObject}->GetParam( Param => 'Version' ) || '';
my $IntroUninstallPost = $Self->{ParamObject}->GetParam( Param => 'IntroUninstallPost' )
|| '';
# get package
my $Package = $Self->{PackageObject}->RepositoryGet(
Name => $Name,
Version => $Version,
);
if ( !$Package ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
# parse package
my %Structure = $Self->{PackageObject}->PackageParse( String => $Package, );
# unsinstall the package
if ( !$Self->{PackageObject}->PackageUninstall( String => $Package ) ) {
return $Self->{LayoutObject}->ErrorScreen();
}
# intro screen
my %Data;
if ( $Structure{IntroUninstall} ) {
%Data = $Self->_MessageGet( Info => $Structure{IntroUninstall}, Type => 'post' );
}
if ( %Data && !$IntroUninstallPost ) {
my %Data = $Self->_MessageGet( Info => $Structure{IntroUninstallPost} );
$Self->{LayoutObject}->Block(
Name => 'Intro',
Data => {
%Param,
%Data,
Subaction => '',
Type => 'IntroUninstallPost',
Name => $Name,
Version => $Version,
},
);
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# redirect
return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
}
# ------------------------------------------------------------ #
# install package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'InstallUpload' ) {
# challenge token check for write action
$Self->{LayoutObject}->ChallengeTokenCheck();
my $FormID = $Self->{ParamObject}->GetParam( Param => 'FormID' ) || '';
my %UploadStuff = $Self->{ParamObject}->GetUploadAll(
Param => 'FileUpload',
Source => 'string',
);
# save package in upload cache
if (%UploadStuff) {
my $Added = $Self->{UploadCacheObject}->FormIDAddFile(
FormID => $FormID,
%UploadStuff,
);
# if file got not added to storage
# (e. g. because of 1 MB max_allowed_packet MySQL problem)
if ( !$Added ) {
$Self->{LayoutObject}->FatalError();
}
}
# get package from upload cache
else {
my @AttachmentData = $Self->{UploadCacheObject}->FormIDGetAllFilesData(
FormID => $FormID,
);
if ( !@AttachmentData || ( $AttachmentData[0] && !%{ $AttachmentData[0] } ) ) {
$Errors{FileUploadInvalid} = 'ServerError';
}
else {
%UploadStuff = %{ $AttachmentData[0] };
}
}
if ( !%Errors ) {
my $Feedback
= $Self->{PackageObject}->PackageIsInstalled( String => $UploadStuff{Content} );
if ($Feedback) {
return $Self->_UpgradeHandling(
Package => $UploadStuff{Content},
FormID => $FormID,
);
}
return $Self->_InstallHandling(
Package => $UploadStuff{Content},
FormID => $FormID,
);
}
}
# ------------------------------------------------------------ #
# rebuild package
# ------------------------------------------------------------ #
elsif ( $Self->{Subaction} eq 'RebuildPackage' ) {
# challenge token check for write action
$Self->{LayoutObject}->ChallengeTokenCheck();
my $Name = $Self->{ParamObject}->GetParam( Param => 'Name' ) || '';
my $Version = $Self->{ParamObject}->GetParam( Param => 'Version' ) || '';
# get package
my $Package = $Self->{PackageObject}->RepositoryGet(
Name => $Name,
Version => $Version,
Result => 'SCALAR',
);
if ( !$Package ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
my %Structure = $Self->{PackageObject}->PackageParse( String => $Package, );
my $File = $Self->{PackageObject}->PackageBuild(%Structure);
return $Self->{LayoutObject}->Attachment(
Content => $File,
ContentType => 'application/octet-stream',
Filename => "$Name-$Version-rebuild.opm",
Type => 'attachment',
);
}
# ------------------------------------------------------------ #
# overview
# ------------------------------------------------------------ #
my %Frontend;
my %NeedReinstall;
my %List;
my $OutputNotify = '';
if ( $Self->{ConfigObject}->Get('Package::RepositoryList') ) {
%List = %{ $Self->{ConfigObject}->Get('Package::RepositoryList') };
}
my %RepositoryRoot;
if ( $Self->{ConfigObject}->Get('Package::RepositoryRoot') ) {
%RepositoryRoot = $Self->{PackageObject}->PackageOnlineRepositories();
}
$Frontend{SourceList} = $Self->{LayoutObject}->BuildSelection(
Data => { %List, %RepositoryRoot, },
Name => 'Source',
Max => 40,
Translation => 0,
SelectedID => $Source,
Class => "W100pc",
);
$Self->{LayoutObject}->Block(
Name => 'Overview',
Data => { %Param, %Frontend, },
);
if ($Source) {
my @List = $Self->{PackageObject}->PackageOnlineList(
URL => $Source,
Lang => $Self->{LayoutObject}->{UserLanguage},
);
if ( !@List ) {
$OutputNotify .= $Self->{LayoutObject}->Notify( Priority => 'Error', );
if ( !$OutputNotify ) {
$OutputNotify .= $Self->{LayoutObject}->Notify(
Priority => 'Info',
Info => 'No packages, or no new packages, found in selected repository.',
);
}
$Self->{LayoutObject}->Block(
Name => 'NoDataFoundMsg',
Data => {},
);
}
for my $Data (@List) {
$Self->{LayoutObject}->Block(
Name => 'ShowRemotePackage',
Data => {
%{$Data},
Source => $Source,
},
);
# show documentation link
my %DocFile = $Self->_DocumentationGet( Filelist => $Data->{Filelist} );
if (%DocFile) {
$Self->{LayoutObject}->Block(
Name => 'ShowRemotePackageDocumentation',
Data => {
%{$Data},
Source => $Source,
%DocFile,
},
);
}
if ( $Data->{Upgrade} ) {
$Self->{LayoutObject}->Block(
Name => 'ShowRemotePackageUpgrade',
Data => { %{$Data}, Source => $Source, },
);
}
elsif ( !$Data->{Installed} ) {
$Self->{LayoutObject}->Block(
Name => 'ShowRemotePackageInstall',
Data => { %{$Data}, Source => $Source, },
);
}
}
}
# if there are no remote packages to show, a msg is displayed
else {
$Self->{LayoutObject}->Block(
Name => 'NoDataFoundMsg',
Data => {},
);
}
my @RepositoryList = $Self->{PackageObject}->RepositoryList();
# if there are no local packages to show, a msg is displayed
if ( !@RepositoryList ) {
$Self->{LayoutObject}->Block(
Name => 'NoDataFoundMsg2',
);
}
# verify packages if we have some
my %VerificationData;
if (@RepositoryList) {
%VerificationData = $Self->{PackageObject}->PackageVerifyAll();
}
my %NotVerifiedPackages;
for my $Package (@RepositoryList) {
my %Data = $Self->_MessageGet( Info => $Package->{Description} );
$Self->{LayoutObject}->Block(
Name => 'ShowLocalPackage',
Data => {
%{$Package},
%Data,
Name => $Package->{Name}->{Content},
Version => $Package->{Version}->{Content},
Vendor => $Package->{Vendor}->{Content},
URL => $Package->{URL}->{Content},
},
);
if (
$VerificationData{ $Package->{Name}->{Content} }
&& $VerificationData{ $Package->{Name}->{Content} } eq 'verified'
)
{
$Self->{LayoutObject}->Block(
Name => 'ShowLocalPackageVerifyLogo',
);
}
# show documentation link
my %DocFile = $Self->_DocumentationGet( Filelist => $Package->{Filelist} );
if (%DocFile) {
$Self->{LayoutObject}->Block(
Name => 'ShowLocalPackageDocumentation',
Data => {
Name => $Package->{Name}->{Content},
Version => $Package->{Version}->{Content},
%DocFile,
},
);
}
if ( $Package->{Status} eq 'installed' ) {
$Self->{LayoutObject}->Block(
Name => 'ShowLocalPackageUninstall',
Data => {
%{$Package},
Name => $Package->{Name}->{Content},
Version => $Package->{Version}->{Content},
Vendor => $Package->{Vendor}->{Content},
URL => $Package->{URL}->{Content},
},
);
if (
!$Self->{PackageObject}->DeployCheck(
Name => $Package->{Name}->{Content},
Version => $Package->{Version}->{Content}
)
)
{
$NeedReinstall{ $Package->{Name}->{Content} } = $Package->{Version}->{Content};
$Self->{LayoutObject}->Block(
Name => 'ShowLocalPackageReinstall',
Data => {
%{$Package},
Name => $Package->{Name}->{Content},
Version => $Package->{Version}->{Content},
Vendor => $Package->{Vendor}->{Content},
URL => $Package->{URL}->{Content},
},
);
}
}
else {
$Self->{LayoutObject}->Block(
Name => 'ShowLocalPackageInstall',
Data => {
%{$Package},
Name => $Package->{Name}->{Content},
Version => $Package->{Version}->{Content},
Vendor => $Package->{Vendor}->{Content},
URL => $Package->{URL}->{Content},
},
);
}
if (
$VerificationData{ $Package->{Name}->{Content} }
&& $VerificationData{ $Package->{Name}->{Content} } eq 'not_verified'
)
{
$NotVerifiedPackages{ $Package->{Name}->{Content} } = $Package->{Version}->{Content};
}
}
# show file upload
if ( $Self->{ConfigObject}->Get('Package::FileUpload') ) {
$Self->{LayoutObject}->Block(
Name => 'OverviewFileUpload',
Data => {
FormID => $Self->{UploadCacheObject}->FormIDCreate(),
%Errors,
},
);
}
# FeatureAddons
if ( $Self->{ConfigObject}->Get('Package::ShowFeatureAddons') ) {
my $FeatureAddonData = $Self->_GetFeatureAddonData();
if ( ref $FeatureAddonData eq 'ARRAY' && scalar @{$FeatureAddonData} > 0 ) {
$Self->{LayoutObject}->Block(
Name => 'FeatureAddonList',
);
for my $Item ( @{$FeatureAddonData} ) {
$Self->{LayoutObject}->Block(
Name => 'FeatureAddonData',
Data => $Item,
);
}
}
}
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $OutputNotify;
for my $ReinstallKey ( sort keys %NeedReinstall ) {
$Output .= $Self->{LayoutObject}->Notify(
Priority => 'Error',
Data => "$ReinstallKey $NeedReinstall{$ReinstallKey}"
. ' - $Text{"Package not correctly deployed! Please reinstall the package."}',
Link => '$Env{"Baselink"}Action=$Env{"Action"};Subaction=View;Name='
. $ReinstallKey
. ';Version='
. $NeedReinstall{$ReinstallKey},
);
}
VERIFICATION:
for my $Package ( sort keys %NotVerifiedPackages ) {
next VERIFICATION if !$Package;
next VERIFICATION if !$NotVerifiedPackages{$Package};
$Output .= $Self->{LayoutObject}->Notify(
Priority => 'Error',
Data => "$Package $NotVerifiedPackages{$Package} - "
. '$Text{"Package not verified by the OTRS Group! It is recommended not to use this package."}',
);
}
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
sub _MessageGet {
my ( $Self, %Param ) = @_;
my $Title = '';
my $Description = '';
my $Use = 0;
my $Language = $Self->{LayoutObject}->{UserLanguage}
|| $Self->{ConfigObject}->Get('DefaultLanguage');
if ( $Param{Info} ) {
for my $Tag ( @{ $Param{Info} } ) {
if ( $Param{Type} ) {
next if $Tag->{Type} !~ /^$Param{Type}/i;
}
$Use = 1;
if ( $Tag->{Format} && $Tag->{Format} =~ /plain/i ) {
$Tag->{Content} = '<pre class="contentbody">' . $Tag->{Content} . '</pre>';
}
if ( !$Description && $Tag->{Lang} eq 'en' ) {
$Description = $Tag->{Content};
$Title = $Tag->{Title};
}
if ( $Tag->{Lang} eq $Language ) {
$Description = $Tag->{Content};
$Title = $Tag->{Title};
}
}
if ( !$Description && $Use ) {
for my $Tag ( @{ $Param{Info} } ) {
if ( !$Description ) {
$Description = $Tag->{Content};
$Title = $Tag->{Title};
}
}
}
}
return if !$Description && !$Title;
return (
Description => $Description,
Title => $Title,
);
}
sub _DocumentationGet {
my ( $Self, %Param ) = @_;
return if !$Param{Filelist};
return if ref $Param{Filelist} ne 'ARRAY';
# find the correct user language documentation file
my $DocumentationFileUserLanguage;
# find the correct default language documentation file
my $DocumentationFileDefaultLanguage;
# find the correct en documentation file
my $DocumentationFile;
# remember fallback file
my $DocumentationFileFallback;
# get default language
my $DefaultLanguage = $Self->{ConfigObject}->Get('DefaultLanguage');
# find documentation files
FILE:
for my $File ( @{ $Param{Filelist} } ) {
next FILE if !$File;
next FILE if !$File->{Location};
my ( $Dir, $Filename ) = $File->{Location} =~ m{ \A doc/ ( .+ ) / ( .+? .pdf ) }xmsi;
next FILE if !$Dir;
next FILE if !$Filename;
# take user language first
if ( $Dir eq $Self->{LayoutObject}->{UserLanguage} ) {
$DocumentationFileUserLanguage = $File->{Location};
}
# take default language next
elsif ( $Dir eq $DefaultLanguage ) {
$DocumentationFileDefaultLanguage = $File->{Location};
}
# take en language next
elsif ( $Dir eq 'en' && !$DocumentationFile ) {
$DocumentationFile = $File->{Location};
}
# remember fallback file
$DocumentationFileFallback = $File->{Location};
}
# set fallback file (if exists) as documentation file
my %Doc;
if ($DocumentationFileUserLanguage) {
$Doc{Location} = $DocumentationFileUserLanguage;
}
elsif ($DocumentationFileDefaultLanguage) {
$Doc{Location} = $DocumentationFileDefaultLanguage;
}
elsif ($DocumentationFile) {
$Doc{Location} = $DocumentationFile;
}
elsif ($DocumentationFileFallback) {
$Doc{Location} = $DocumentationFileFallback;
}
return %Doc;
}
sub _InstallHandling {
my ( $Self, %Param ) = @_;
# check needed params
if ( !$Param{Package} ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
# redirect after finishing installation
if ( $Self->{ParamObject}->GetParam( Param => 'IntroInstallPost' ) ) {
return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
}
my $IntroInstallPre = $Self->{ParamObject}->GetParam( Param => 'IntroInstallPre' ) || '';
my $IntroInstallVendor = $Self->{ParamObject}->GetParam( Param => 'IntroInstallVendor' ) || '';
# parse package
my %Structure = $Self->{PackageObject}->PackageParse( String => $Param{Package} );
# online verification
my $Verified = $Self->{PackageObject}->PackageVerify(
Package => $Param{Package},
Structure => \%Structure,
) || 'verified';
my %VerifyInfo = $Self->{PackageObject}->PackageVerifyInfo();
# translate description
if ( $Self->{LayoutObject}->{LanguageObject} ) {
$VerifyInfo{Description} = $Self->{LayoutObject}->{LanguageObject}->Get(
$VerifyInfo{Description}
);
}
# vendor screen
if ( !$IntroInstallVendor && !$IntroInstallPre && $Verified ne 'verified' ) {
$Self->{LayoutObject}->Block(
Name => 'Intro',
Data => {
%Param,
%VerifyInfo,
Subaction => $Self->{Subaction},
Type => 'IntroInstallVendor',
Name => $Structure{Name}->{Content},
Version => $Structure{Version}->{Content},
},
);
$Self->{LayoutObject}->Block(
Name => 'IntroCancel',
);
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# intro screen
my %Data;
if ( $Structure{IntroInstall} ) {
%Data = $Self->_MessageGet( Info => $Structure{IntroInstall}, Type => 'pre' );
}
# intro before installation
if ( %Data && !$IntroInstallPre ) {
$Self->{LayoutObject}->Block(
Name => 'Intro',
Data => {
%Param,
%Data,
Subaction => $Self->{Subaction},
Type => 'IntroInstallPre',
Name => $Structure{Name}->{Content},
Version => $Structure{Version}->{Content},
},
);
if ( $Verified eq 'verified' ) {
$Self->{LayoutObject}->Block(
Name => 'OTRSVerifyLogo',
);
}
$Self->{LayoutObject}->Block(
Name => 'IntroCancel',
);
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# install package
elsif ( $Self->{PackageObject}->PackageInstall( String => $Param{Package} ) ) {
# intro screen
my %Data;
if ( $Structure{IntroInstall} ) {
%Data = $Self->_MessageGet( Info => $Structure{IntroInstall}, Type => 'post' );
}
if (%Data) {
$Self->{LayoutObject}->Block(
Name => 'Intro',
Data => {
%Param,
%Data,
Subaction => 'Install',
Type => 'IntroInstallPost',
Name => $Structure{Name}->{Content},
Version => $Structure{Version}->{Content},
},
);
if ( $Verified eq 'verified' ) {
$Self->{LayoutObject}->Block(
Name => 'OTRSVerifyLogo',
);
}
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# redirect
return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
}
return $Self->{LayoutObject}->ErrorScreen();
}
sub _UpgradeHandling {
my ( $Self, %Param ) = @_;
# check needed params
if ( !$Param{Package} ) {
return $Self->{LayoutObject}->ErrorScreen( Message => 'No such package!' );
}
# redirect after finishing upgrade
if ( $Self->{ParamObject}->GetParam( Param => 'IntroUpgradePost' ) ) {
return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
}
my $IntroUpgradePre = $Self->{ParamObject}->GetParam( Param => 'IntroUpgradePre' ) || '';
# check if we have to show upgrade intro pre
my %Structure = $Self->{PackageObject}->PackageParse( String => $Param{Package}, );
# intro screen
my %Data;
if ( $Structure{IntroUpgrade} ) {
%Data = $Self->_MessageGet( Info => $Structure{IntroUpgrade}, Type => 'pre' );
}
if ( %Data && !$IntroUpgradePre ) {
$Self->{LayoutObject}->Block(
Name => 'Intro',
Data => {
%Param,
%Data,
Subaction => $Self->{Subaction},
Type => 'IntroUpgradePre',
Name => $Structure{Name}->{Content},
Version => $Structure{Version}->{Content},
},
);
$Self->{LayoutObject}->Block(
Name => 'IntroCancel',
);
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# upgrade
elsif ( $Self->{PackageObject}->PackageUpgrade( String => $Param{Package} ) ) {
# intro screen
my %Data;
if ( $Structure{IntroUpgrade} ) {
%Data = $Self->_MessageGet( Info => $Structure{IntroUpgrade}, Type => 'post' );
}
if (%Data) {
$Self->{LayoutObject}->Block(
Name => 'Intro',
Data => {
%Param,
%Data,
Subaction => '',
Type => 'IntroUpgradePost',
Name => $Structure{Name}->{Content},
Version => $Structure{Version}->{Content},
},
);
my $Output = $Self->{LayoutObject}->Header();
$Output .= $Self->{LayoutObject}->NavigationBar();
$Output .= $Self->{LayoutObject}->Output(
TemplateFile => 'AdminPackageManager',
);
$Output .= $Self->{LayoutObject}->Footer();
return $Output;
}
# redirect
return $Self->{LayoutObject}->Redirect( OP => "Action=$Self->{Action}" );
}
return $Self->{LayoutObject}->ErrorScreen();
}
sub _GetFeatureAddonData {
my ( $Self, %Param ) = @_;
# Default URL
my $FeedURL = 'http://www.otrs.com/feed/?post_type=feature_add_ons&lang=en';
my $Language = $Self->{LayoutObject}->{UserLanguage};
# Check if URL for UserLanguage is available
if ( $Language =~ m/^de/ ) {
$FeedURL = 'http://www.otrs.com/feed/?post_type=feature_add_ons&lang=de';
}
if ( $Language =~ m/^es/ ) {
$FeedURL = 'http://www.otrs.com/feed/?post_type=feature_add_ons&lang=es';
}
my $CacheKey = "FeatureAddonData::$FeedURL";
my $CacheTTL = 60 * 60 * 24; # 1 day
my $CacheType = 'PackageManager';
my $CacheResult = $Self->{CacheObject}->Get(
Type => $CacheType,
Key => $CacheKey,
);
return $CacheResult if ref $CacheResult eq 'ARRAY';
# set proxy settings can't use Kernel::System::WebAgent because of used
# XML::FeedPP to get RSS files
my $Proxy = $Self->{ConfigObject}->Get('WebUserAgent::Proxy');
if ($Proxy) {
$ENV{CGI_HTTP_PROXY} = $Proxy;
}
# get content
my $Feed = eval {
XML::FeedPP->new(
$FeedURL,
'xml_deref' => 1,
'utf8_flag' => 1,
);
};
return if !$Feed;
my @Result;
my $Count = 0;
ITEM:
for my $Item ( $Feed->get_item() ) {
$Count++;
last ITEM if $Count > 100;
push @Result, {
Title => $Item->title(),
Link => $Item->link(),
Description => $Item->get('content:encoded'),
};
}
# set cache
$Self->{CacheObject}->Set(
Type => $CacheType,
Key => $CacheKey,
Value => \@Result,
TTL => $CacheTTL,
);
return \@Result;
}
1;
|
agpl-3.0
|
Scindix/ArrakizPHP
|
tracking.php
|
612
|
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//arrakiz.org/analytics/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 1]);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//arrakiz.org/analytics/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
|
agpl-3.0
|
StefanOltmann/PokerGame
|
server/src/test/java/de/stefan_oltmann/poker/server/SpielControllerTest.java
|
8108
|
/*****************************************************************************
* Stefans Poker Game *
* *
* Copyright (C) 2016 Stefan Oltmann *
* *
* Contact : pokergame@stefan-oltmann.de *
* Homepage: http://www.stefan-oltmann.de/ *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
package de.stefan_oltmann.poker.server;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
import de.stefan_oltmann.poker.model.Account;
import de.stefan_oltmann.poker.model.BlindHoehe;
import de.stefan_oltmann.poker.model.SpielEventListener;
import de.stefan_oltmann.poker.model.SpielImpl;
import de.stefan_oltmann.poker.model.Spieler;
import de.stefan_oltmann.poker.model.SpielerStatus;
import de.stefan_oltmann.poker.model.hand.Karte;
public class SpielControllerTest extends TestCase {
public static final Account ALICE = new Account("TEST1", "Alice", 1500);
public static final Account BOB = new Account("TEST2", "Bob", 1500);
public static final Account EVE = new Account("TEST3", "Eve", 1500);
/*
* TODO FIXME Unfertig
*/
public void testSpielMitDreiSpielern() {
SpielImpl spiel = new SpielImpl("123");
SpielLog spielLog = new SpielLog();
spiel.addListener(spielLog);
SpielController spielController = new SpielController(spiel);
Spieler spielerAlice = new Spieler("1", ALICE.getId(), spiel.getId());
Spieler spielerBob = new Spieler("2", BOB.getId(), spiel.getId());
Spieler spielerEve = new Spieler("3", EVE.getId(), spiel.getId());
/*
* Status-Prüfung vor Start
*/
assertEquals(0, spiel.getAnzahlAktiverSpieler());
assertFalse(spielController.isSpielLaueft());
assertNull(spiel.getDealer());
assertNull(spiel.getAktiverSpieler());
/* Drei Spieler treten bei uns warten auf die nächste Runde. */
spiel.sitIn(spielerAlice, 1, 1500);
assertEquals(1, spiel.getAnzahlAktiverSpieler());
assertFalse(spielController.isSpielLaueft());
assertEquals("sitIn Spieler[Account[TEST1:Alice]@Spiel[123]] platz=1 chips=1500", spielLog.getNextMessage());
assertEquals(SpielerStatus.WARTET_AUF_NAECHSTE_RUNDE, spielerAlice.getStatus());
spiel.sitIn(spielerBob, 2, 1500);
assertEquals(2, spiel.getAnzahlAktiverSpieler());
assertTrue(spielController.isSpielLaueft());
assertEquals("sitIn Spieler[Account[TEST2:Bob]@Spiel[123]] platz=2 chips=1500", spielLog.getNextMessage());
assertEquals(SpielerStatus.WARTET_AUF_NAECHSTE_RUNDE, spielerBob.getStatus());
spiel.sitIn(spielerEve, 3, 1500);
assertEquals(3, spiel.getAnzahlAktiverSpieler());
assertTrue(spielController.isSpielLaueft());
assertEquals("sitIn Spieler[Account[TEST3:Eve]@Spiel[123]] platz=3 chips=1500", spielLog.getNextMessage());
assertEquals(SpielerStatus.WARTET_AUF_NAECHSTE_RUNDE, spielerEve.getStatus());
/*
* Das Spiel startet
*/
try {
Thread.sleep(100);
} catch (InterruptedException e1) {
}
/* Alice wird als Button ausgewählt */
assertEquals("setzeButton Spieler[Account[TEST1:Alice]@Spiel[123]]", spielLog.getNextMessage());
try {
Thread.sleep(9999);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private class SpielLog implements SpielEventListener {
private List<String> messages = new ArrayList<String>();
// public List<String> getMessages() {
// return messages;
// }
public int counter = -1;
public String getNextMessage() {
this.counter++;
if (counter >= messages.size())
return null;
return messages.get(counter);
}
private void addMessage(String message) {
this.messages.add(message);
System.out.println("addMessage(): " + message);
}
@Override
public void onPlayerSatIn(Spieler spieler, int platzNummer, int chips) {
addMessage("sitIn " + spieler + " platz=" + platzNummer + " chips=" + chips);
}
@Override
public void onPlayerSatOut(Spieler spieler) {
addMessage("sitOut " + spieler);
}
@Override
public void onPlayerLeft(Spieler spieler) {
addMessage("leave " + spieler);
}
@Override
public void onHoleCardsDealt() {
addMessage("dealHoleCards");
}
@Override
public void onFlopDealt(Karte flop1, Karte flop2, Karte flop3) {
addMessage("dealFlop " + flop1 + " " + flop2 + " " + flop3);
}
@Override
public void onTurnDealt(Karte turn) {
addMessage("dealTurn " + turn);
}
@Override
public void onRiverDealt(Karte river) {
addMessage("dealRiver " + river);
}
@Override
public void onHandEnded() {
addMessage("endHand");
}
@Override
public void onButtonGesetzt(Spieler spieler) {
addMessage("setzeButton " + spieler);
}
@Override
public void onAktiverSpielerGesetzt(Spieler spieler, int sekunden) {
addMessage("setzeAktivenSpieler " + spieler);
}
@Override
public void onLetztenSpielerGesetzt(Spieler spieler) {
addMessage("setzeLetztenSpieler " + spieler);
}
@Override
public void onBlindLevelChanged(BlindHoehe blindHoehe) {
addMessage("changeBlindLevel " + blindHoehe);
}
@Override
public void onPlayerFold(Spieler spieler) {
addMessage("fold " + spieler);
}
@Override
public void onPlayerCheck(Spieler spieler) {
addMessage("check " + spieler);
}
@Override
public void onPlayerBet(Spieler spieler, int chips) {
addMessage("bet " + spieler + " chips=" + chips);
}
@Override
public void onPlayerRaise(Spieler spieler, int chips) {
addMessage("raise " + spieler + " chips=" + chips);
}
@Override
public void onHoleCardsShown(Spieler spieler, Karte holeCard1, Karte holeCard2) {
addMessage("showHoleCards " + holeCard1 + " " + holeCard2);
}
}
}
|
agpl-3.0
|
tsrnnash/bg8-cdw11
|
static/pelicanconf.py
|
2146
|
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'kmol'
SITENAME = 'CDW11 網頁 (虎尾科大MDE)'
SITEURL = 'http://cdw11-40323200.rhcloud.com/static/'
# 不要用文章所在目錄作為類別
USE_FOLDER_AS_CATEGORY = False
#PATH = 'content'
#OUTPUT_PATH = 'output'
TIMEZONE = 'Asia/Taipei'
DEFAULT_LANG = 'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
# Blogroll
LINKS = (('Pelican', 'http://getpelican.com/'),
('pelican-bootstrap3', 'https://github.com/DandyDev/pelican-bootstrap3/'),
('pelican-plugins', 'https://github.com/getpelican/pelican-plugins'),
('Tipue search', 'https://github.com/Tipue/Tipue-Search'),)
# Social widget
#SOCIAL = (('You can add links in your config file', '#'),('Another social link', '#'),)
DEFAULT_PAGINATION = 10
# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True
# 必須絕對目錄或相對於設定檔案所在目錄
PLUGIN_PATHS = ['plugin']
PLUGINS = ['liquid_tags.notebook', 'summary', 'tipue_search', 'sitemap', 'render_math']
# for sitemap plugin
SITEMAP = {
'format': 'xml',
'priorities': {
'articles': 0.5,
'indexes': 0.5,
'pages': 0.5
},
'changefreqs': {
'articles': 'monthly',
'indexes': 'daily',
'pages': 'monthly'
}
}
# search is for Tipue search
DIRECT_TEMPLATES = (('index', 'tags', 'categories', 'authors', 'archives', 'search'))
# for pelican-bootstrap3 theme settings
#TAG_CLOUD_MAX_ITEMS = 50
DISPLAY_CATEGORIES_ON_SIDEBAR = True
DISPLAY_RECENT_POSTS_ON_SIDEBAR = True
DISPLAY_TAGS_ON_SIDEBAR = True
DISPLAY_TAGS_INLINE = True
TAGS_URL = "tags.html"
CATEGORIES_URL = "categories.html"
#SHOW_ARTICLE_AUTHOR = True
#MENUITEMS = [('Home', '/'), ('Archives', '/archives.html'), ('Search', '/search.html')]
# 希望將部份常用的 Javascript 最新版程式庫放到這裡, 可以透過 http://cadlab.mde.tw/post/js/ 呼叫
STATIC_PATHS = ['js']
|
agpl-3.0
|
empirical-org/Empirical-Core
|
services/QuillLMS/client/app/bundles/Diagnostic/components/lessons/lessonFormComponents.tsx
|
887
|
import * as React from 'react';
export interface DeleteButtonProps {
questionId: string,
onChange(questionId: string): void
}
export interface NameInputProps {
name: string,
onChange(value: string, e: object): void
}
export const DeleteButton = ({ questionId, onChange }: DeleteButtonProps) => {
function handleClick() { onChange(questionId) }
return <button onClick={handleClick} type="button">Delete</button>;
}
export const NameInput = ({ name, onChange }: NameInputProps) => {
function handleChange(e: object) { onChange('name', e) };
return(
<label className="label" htmlFor="activity-name-input">
Name
<input
aria-label="activity-name-input"
className="input"
id="activity-name-input"
onChange={handleChange}
placeholder="Text input"
type="text"
value={name}
/>
</label>
);
}
|
agpl-3.0
|
SamR1/FitTrackee
|
fittrackee/workouts/utils_files.py
|
174
|
import os
from flask import current_app
def get_absolute_file_path(relative_path: str) -> str:
return os.path.join(current_app.config['UPLOAD_FOLDER'], relative_path)
|
agpl-3.0
|
JanMarvin/rstudio
|
src/gwt/src/org/rstudio/studio/client/workbench/views/output/sourcecpp/events/SourceCppStartedEvent.java
|
1265
|
/*
* SourceCppStartedEvent.java
*
* Copyright (C) 2020 by RStudio, PBC
*
* Unless you have received this program directly from RStudio pursuant
* to the terms of a commercial license agreement with RStudio, then
* this program is licensed to you under the terms of version 3 of the
* GNU Affero General Public License. This program is distributed WITHOUT
* ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
* AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
*
*/
package org.rstudio.studio.client.workbench.views.output.sourcecpp.events;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
public class SourceCppStartedEvent extends GwtEvent<SourceCppStartedEvent.Handler>
{
public interface Handler extends EventHandler
{
void onSourceCppStarted(SourceCppStartedEvent event);
}
public SourceCppStartedEvent()
{
}
@Override
public Type<Handler> getAssociatedType()
{
return TYPE;
}
@Override
protected void dispatch(Handler handler)
{
handler.onSourceCppStarted(this);
}
public static final Type<Handler> TYPE = new Type<>();
}
|
agpl-3.0
|
hflabs/perecoder
|
rcd-web/src/main/javascript/app/model/groups/groups-list.js
|
619
|
'use strict';
define(function(require) {
var Backbone = require('backbone'),
routes = require('routes'),
GroupModel = require('model/groups/group-model');
var GroupsList = Backbone.Collection.extend({
model: GroupModel,
url: routes.absoluteUrl(routes.GROUPS_DATA),
fetch: function(options){
if (this.search) {
(options || (options = {})).data = {
search: this.search
};
}
return Backbone.Collection.prototype.fetch.call(this, options);
}
});
return GroupsList;
})
|
agpl-3.0
|
openfisca/openfisca-web-ui
|
openfisca_web_ui/static/js/components/test-case/form/enumeration-control.js
|
1605
|
/** @jsx React.DOM */
'use strict';
var Lazy = require('lazy.js'),
React = require('react'),
ReactIntlMixin = require('react-intl');
var EnumerationControl = React.createClass({
mixins: [ReactIntlMixin],
propTypes: {
default: React.PropTypes.string,
error: React.PropTypes.string,
label: React.PropTypes.element.isRequired,
labels: React.PropTypes.object.isRequired,
name: React.PropTypes.string.isRequired,
onChange: React.PropTypes.func.isRequired,
suggestion: React.PropTypes.string,
value: React.PropTypes.oneOfType([
React.PropTypes.number,
React.PropTypes.string,
]),
},
handleChange(event) {
this.props.onChange(event.target.value);
},
render() {
var firstOptionLabel = `${this.getIntlMessage('notIndicated')} (${
this.props.suggestion ?
this.formatMessage(this.getIntlMessage('suggestedValue'), {value: this.props.labels[this.props.suggestion]}) :
this.formatMessage(this.getIntlMessage('defaultValue'), {value: this.props.labels[this.props.default]})
})`;
return (
<div>
{this.props.label}
<select
className="form-control"
id={this.props.name}
onChange={this.handleChange}
value={this.props.value}
>
<option value="">{firstOptionLabel}</option>
{
Lazy(this.props.labels).map((label, labelId) =>
<option key={labelId} value={labelId}>{label}</option>
).toArray()
}
</select>
</div>
);
},
});
module.exports = EnumerationControl;
|
agpl-3.0
|
XiaodunServerGroup/ddyedx
|
cms/envs/common.py
|
18114
|
# -*- coding: utf-8 -*-
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change the feature
configuration in an environment specific config file and re-calculate those
values.
We should make a method that calls all these config methods so that you just
make one call at the end of your site-specific dev file to reset all the
dependent variables (like INSTALLED_APPS) for you.
Longer TODO:
1. Right now our treatment of static content in general and in particular
course-specific static content is haphazard.
2. We should have a more disciplined approach to feature flagging, even if it
just means that we stick them in a dict called FEATURES.
3. We need to handle configuration for multiple courses. This could be as
multiple sites, but we do need a way to map their data assets.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0611, W0614
import sys
import json
import lms.envs.common
from lms.envs.common import (
USE_TZ, TECH_SUPPORT_EMAIL, PLATFORM_NAME, BUGS_EMAIL, DOC_STORE_CONFIG, ALL_LANGUAGES
)
from path import path
from lms.lib.xblock.mixin import LmsBlockMixin
from cms.lib.xblock.mixin import CmsBlockMixin
from xmodule.modulestore.inheritance import InheritanceMixin
from xmodule.x_module import XModuleMixin, prefer_xmodules
from dealer.git import git
############################ FEATURE CONFIGURATION #############################
FEATURES = {
'USE_DJANGO_PIPELINE': True,
'GITHUB_PUSH': False,
'ENABLE_DISCUSSION_SERVICE': False,
'AUTH_USE_CERTIFICATES': False,
# email address for studio staff (eg to request course creation)
'STUDIO_REQUEST_EMAIL': '',
'STUDIO_NPS_SURVEY': True,
# Segment.io - must explicitly turn it on for production
'SEGMENT_IO': False,
# Enable URL that shows information about the status of various services
'ENABLE_SERVICE_STATUS': False,
# Don't autoplay videos for course authors
'AUTOPLAY_VIDEOS': False,
# If set to True, new Studio users won't be able to author courses unless
# edX has explicitly added them to the course creator group.
'ENABLE_CREATOR_GROUP': False,
# whether to use password policy enforcement or not
'ENFORCE_PASSWORD_POLICY': False,
# If set to True, Studio won't restrict the set of advanced components
# to just those pre-approved by edX
'ALLOW_ALL_ADVANCED_COMPONENTS': False,
# Turn off account locking if failed login attempts exceeds a limit
'ENABLE_MAX_FAILED_LOGIN_ATTEMPTS': False,
# Allow editing of short description in course settings in cms
'EDITABLE_SHORT_DESCRIPTION': True,
# Hide any Personally Identifiable Information from application logs
'SQUELCH_PII_IN_LOGS': False,
# Toggles embargo functionality
'EMBARGO': False,
# Turn on/off Microsites feature
'USE_MICROSITES': False,
}
ENABLE_JASMINE = False
########### course fields #############
# COURSE_EXTEND_FIELDS = lms.envs.common.COURSE_EXTEND_FIELDS
############################# SET PATH INFORMATION #############################
PROJECT_ROOT = path(__file__).abspath().dirname().dirname() # /edx-platform/cms
REPO_ROOT = PROJECT_ROOT.dirname()
COMMON_ROOT = REPO_ROOT / "common"
LMS_ROOT = REPO_ROOT / "lms"
ENV_ROOT = REPO_ROOT.dirname() # virtualenv dir /edx-platform is in
GITHUB_REPO_ROOT = ENV_ROOT / "data"
sys.path.append(REPO_ROOT)
sys.path.append(PROJECT_ROOT / 'djangoapps')
sys.path.append(COMMON_ROOT / 'djangoapps')
sys.path.append(COMMON_ROOT / 'lib')
# For geolocation ip database
GEOIP_PATH = REPO_ROOT / "common/static/data/geoip/GeoIP.dat"
############################# WEB CONFIGURATION #############################
# This is where we stick our compiled template files.
from tempdir import mkdtemp_clean
MAKO_MODULE_DIR = mkdtemp_clean('mako')
MAKO_TEMPLATES = {}
MAKO_TEMPLATES['main'] = [
PROJECT_ROOT / 'templates',
COMMON_ROOT / 'templates',
COMMON_ROOT / 'djangoapps' / 'pipeline_mako' / 'templates',
COMMON_ROOT / 'djangoapps' / 'pipeline_js' / 'templates',
]
for namespace, template_dirs in lms.envs.common.MAKO_TEMPLATES.iteritems():
MAKO_TEMPLATES['lms.' + namespace] = template_dirs
TEMPLATE_DIRS = MAKO_TEMPLATES['main']
EDX_ROOT_URL = ''
LOGIN_REDIRECT_URL = EDX_ROOT_URL + '/signin'
LOGIN_URL = EDX_ROOT_URL + '/signin'
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.request',
'django.core.context_processors.static',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.i18n',
'django.contrib.auth.context_processors.auth', # this is required for admin
'django.core.context_processors.csrf',
'dealer.contrib.django.staff.context_processor', # access git revision
'contentstore.context_processors.doc_url',
)
# use the ratelimit backend to prevent brute force attacks
AUTHENTICATION_BACKENDS = (
'ratelimitbackend.backends.RateLimitModelBackend',
)
LMS_BASE = None
#################### CAPA External Code Evaluation #############################
XQUEUE_INTERFACE = {
'url': 'http://localhost:8888',
'django_auth': {'username': 'local',
'password': 'local'},
'basic_auth': None,
}
################################# Middleware ###################################
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'staticfiles.finders.FileSystemFinder',
'staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
)
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE_CLASSES = (
'request_cache.middleware.RequestCache',
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'method_override.middleware.MethodOverrideMiddleware',
# Instead of AuthenticationMiddleware, we use a cache-backed version
'cache_toolbox.middleware.CacheBackedAuthenticationMiddleware',
'student.middleware.UserStandingMiddleware',
'contentserver.middleware.StaticContentServer',
'crum.CurrentRequestUserMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'track.middleware.TrackMiddleware',
# Allows us to dark-launch particular languages
'dark_lang.middleware.DarkLangMiddleware',
'embargo.middleware.EmbargoMiddleware',
# Detects user-requested locale from 'accept-language' header in http request
'django.middleware.locale.LocaleMiddleware',
'django.middleware.transaction.TransactionMiddleware',
# needs to run after locale middleware (or anything that modifies the request context)
'edxmako.middleware.MakoMiddleware',
# catches any uncaught RateLimitExceptions and returns a 403 instead of a 500
'ratelimitbackend.middleware.RateLimitMiddleware',
# for expiring inactive sessions
'session_inactivity_timeout.middleware.SessionInactivityTimeout',
# use Django built in clickjacking protection
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
# Clickjacking protection can be enabled by setting this to 'DENY'
X_FRAME_OPTIONS = 'ALLOW'
############# XBlock Configuration ##########
# This should be moved into an XBlock Runtime/Application object
# once the responsibility of XBlock creation is moved out of modulestore - cpennington
XBLOCK_MIXINS = (LmsBlockMixin, CmsBlockMixin, InheritanceMixin, XModuleMixin)
# Allow any XBlock in Studio
# You should also enable the ALLOW_ALL_ADVANCED_COMPONENTS feature flag, so that
# xblocks can be added via advanced settings
XBLOCK_SELECT_FUNCTION = prefer_xmodules
############################ SIGNAL HANDLERS ################################
# This is imported to register the exception signal handling that logs exceptions
import monitoring.exceptions # noqa
############################ DJANGO_BUILTINS ################################
# Change DEBUG/TEMPLATE_DEBUG in your environment settings files, not here
DEBUG = False
TEMPLATE_DEBUG = False
# Site info
SITE_ID = 1
SITE_NAME = "0.0.0.0:8001"
HTTPS = 'on'
ROOT_URLCONF = 'cms.urls'
IGNORABLE_404_ENDS = ('favicon.ico')
# Email
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.126.com'
EMAIL_PORT = 25
EMAIL_USE_TLS = False
EMAIL_HOST_USER = 'xiaodunxin'
EMAIL_HOST_PASSWORD = '123456qr'
DEFAULT_FROM_EMAIL = 'xiaodunxin@126.com'
DEFAULT_FEEDBACK_EMAIL = 'xiaodunxin@126.com'
SERVER_EMAIL = 'xiaodunxin@126.com'
ADMINS = ()
MANAGERS = ADMINS
# Static content
STATIC_URL = '/static/' + git.revision + "/"
ADMIN_MEDIA_PREFIX = '/static/admin/'
STATIC_ROOT = ENV_ROOT / "staticfiles" / git.revision
STATICFILES_DIRS = [
COMMON_ROOT / "static",
PROJECT_ROOT / "static",
LMS_ROOT / "static",
# This is how you would use the textbook images locally
# ("book", ENV_ROOT / "book_images"),
]
# Locale/Internationalization
TIME_ZONE = 'Asia/Shanghai' # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
LANGUAGE_CODE = 'zh-cn' # http://www.i18nguy.com/unicode/language-identifiers.html
SITE_NAME = 'mooc.diandiyun.com:18010'
LANGUAGES = lms.envs.common.LANGUAGES
USE_I18N = True
USE_L10N = True
# Localization strings (e.g. django.po) are under this directory
LOCALE_PATHS = (REPO_ROOT + '/conf/locale',) # edx-platform/conf/locale/
# Messages
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
# If this is true, random scores will be generated for the purpose of debugging the profile graphs
GENERATE_PROFILE_SCORES = False
############################### Pipeline #######################################
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
from rooted_paths import rooted_glob
PIPELINE_CSS = {
'style-vendor': {
'source_filenames': [
'css/vendor/normalize.css',
'css/vendor/font-awesome.css',
'css/vendor/html5-input-polyfills/number-polyfill.css',
'js/vendor/CodeMirror/codemirror.css',
'css/vendor/ui-lightness/jquery-ui-1.8.22.custom.css',
'css/vendor/jquery.qtip.min.css',
'js/vendor/markitup/skins/simple/style.css',
'js/vendor/markitup/sets/wiki/style.css',
],
'output_filename': 'css/cms-style-vendor.css',
},
'style-app': {
'source_filenames': [
'sass/style-app.css',
],
'output_filename': 'css/cms-style-app.css',
},
'style-app-extend1': {
'source_filenames': [
'sass/style-app-extend1.css',
],
'output_filename': 'css/cms-style-app-extend1.css',
},
'style-xmodule': {
'source_filenames': [
'sass/style-xmodule.css',
],
'output_filename': 'css/cms-style-xmodule.css',
},
'style-calendar-vendor': {
'source_filenames': [
'css/vendor/fullcalendar/fullcalendar.css',
'css/vendor/fullcalendar/fullcalendar_s.css',
'css/vendor/fullcalendar/fullcalendar.print.css',
],
'output_filename': 'css/lms-style-fullcalendar-vendor.css',
}
}
fullcalendar_vendor_js = [
'js/vendor/fullcalendar/moment.min.js',
'js/vendor/fullcalendar/fullcalendar.min.js',
'js/vendor/fullcalendar/jquery-ui.custom.min.js',
'js/vendor/fullcalendar/lang-all.js',
]
# test_order: Determines the position of this chunk of javascript on
# the jasmine test page
PIPELINE_JS = {
'module-js': {
'source_filenames': (
rooted_glob(COMMON_ROOT / 'static/', 'xmodule/descriptors/js/*.js') +
rooted_glob(COMMON_ROOT / 'static/', 'xmodule/modules/js/*.js') +
rooted_glob(COMMON_ROOT / 'static/', 'coffee/src/discussion/*.js')
),
'output_filename': 'js/cms-modules.js',
'test_order': 1
},
'calendar_vendor': {
'source_filenames': fullcalendar_vendor_js,
'output_filename': 'js/lms-fullcalendar_vendor.js',
'test_order': 0,
},
}
PIPELINE_COMPILERS = (
'pipeline.compilers.coffee.CoffeeScriptCompiler',
)
PIPELINE_CSS_COMPRESSOR = None
PIPELINE_JS_COMPRESSOR = None
STATICFILES_IGNORE_PATTERNS = (
"*.py",
"*.pyc"
# it would be nice if we could do, for example, "**/*.scss",
# but these strings get passed down to the `fnmatch` module,
# which doesn't support that. :(
# http://docs.python.org/2/library/fnmatch.html
"sass/*.scss",
"sass/*/*.scss",
"sass/*/*/*.scss",
"sass/*/*/*/*.scss",
"coffee/*.coffee",
"coffee/*/*.coffee",
"coffee/*/*/*.coffee",
"coffee/*/*/*/*.coffee",
# Symlinks used by js-test-tool
"xmodule_js",
"common_static",
)
PIPELINE_YUI_BINARY = 'yui-compressor'
################################# CELERY ######################################
# Message configuration
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_MESSAGE_COMPRESSION = 'gzip'
# Results configuration
CELERY_IGNORE_RESULT = False
CELERY_STORE_ERRORS_EVEN_IF_IGNORED = True
# Events configuration
CELERY_TRACK_STARTED = True
CELERY_SEND_EVENTS = True
CELERY_SEND_TASK_SENT_EVENT = True
# Exchange configuration
CELERY_DEFAULT_EXCHANGE = 'edx.core'
CELERY_DEFAULT_EXCHANGE_TYPE = 'direct'
# Queues configuration
HIGH_PRIORITY_QUEUE = 'edx.core.high'
DEFAULT_PRIORITY_QUEUE = 'edx.core.default'
LOW_PRIORITY_QUEUE = 'edx.core.low'
CELERY_QUEUE_HA_POLICY = 'all'
CELERY_CREATE_MISSING_QUEUES = True
CELERY_DEFAULT_QUEUE = DEFAULT_PRIORITY_QUEUE
CELERY_DEFAULT_ROUTING_KEY = DEFAULT_PRIORITY_QUEUE
CELERY_QUEUES = {
HIGH_PRIORITY_QUEUE: {},
LOW_PRIORITY_QUEUE: {},
DEFAULT_PRIORITY_QUEUE: {}
}
############################## Video ##########################################
# URL to test YouTube availability
YOUTUBE_TEST_URL = 'https://gdata.youtube.com/feeds/api/videos/'
############################ APPS #####################################
INSTALLED_APPS = (
# Standard apps
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'djcelery',
'south',
'method_override',
# Database-backed configuration
'config_models',
# Monitor the status of services
'service_status',
# Testing
'django_nose',
# For CMS
'contentstore',
'course_creators',
'student', # misleading name due to sharing with lms
'course_groups', # not used in cms (yet), but tests run
# Tracking
'track',
'eventtracking.django',
# Monitoring
'datadog',
# For asset pipelining
'edxmako',
'pipeline',
'staticfiles',
'static_replace',
# comment common
'django_comment_common',
# for course creator table
'django.contrib.admin',
# XBlocks containing migrations
'mentoring',
# for managing course modes
'course_modes',
# Dark-launching languages
'dark_lang',
# Student identity reverification
'reverification',
# User preferences
'user_api',
'django_openid_auth',
'embargo',
)
################# EDX MARKETING SITE ##################################
EDXMKTG_COOKIE_NAME = 'edxloggedin'
MKTG_URLS = {}
MKTG_URL_LINK_MAP = {
}
COURSES_WITH_UNSAFE_CODE = []
############################## EVENT TRACKING #################################
TRACK_MAX_EVENT = 10000
TRACKING_BACKENDS = {
'logger': {
'ENGINE': 'track.backends.logger.LoggerBackend',
'OPTIONS': {
'name': 'tracking'
}
}
}
#### PASSWORD POLICY SETTINGS #####
PASSWORD_MIN_LENGTH = None
PASSWORD_MAX_LENGTH = None
PASSWORD_COMPLEXITY = {}
PASSWORD_DICTIONARY_EDIT_DISTANCE_THRESHOLD = None
PASSWORD_DICTIONARY = []
# We're already logging events, and we don't want to capture user
# names/passwords. Heartbeat events are likely not interesting.
TRACKING_IGNORE_URL_PATTERNS = [r'^/event', r'^/login', r'^/heartbeat']
TRACKING_ENABLED = True
# Current youtube api for requesting transcripts.
# for example: http://video.google.com/timedtext?lang=en&v=j_jEn79vS3g.
YOUTUBE_API = {
'url': "http://video.google.com/timedtext",
'params': {'lang': 'en', 'v': 'set_youtube_id_of_11_symbols_here'}
}
##### ACCOUNT LOCKOUT DEFAULT PARAMETERS #####
MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED = 5
MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = 15 * 60
### JSdraw (only installed in some instances)
try:
import edx_jsdraw
except ImportError:
pass
else:
INSTALLED_APPS += ('edx_jsdraw',)
############## SSO KEY ################
SSO_KEY = "SSOFOUNDER"
############## user auth ##############
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
'django.contrib.auth.hashers.BCryptPasswordHasher',
'django.contrib.auth.hashers.SHA1PasswordHasher',
'django.contrib.auth.hashers.MD5PasswordHasher',
'django.contrib.auth.hashers.UnsaltedSHA1PasswordHasher',
'django.contrib.auth.hashers.CryptPasswordHasher'
)
############## SSO KEY ################
SSO_KEY = "SSOFOUNDER"
############## BUSINESS SYSTEM #################
XIAODUN_BACK_HOST = 'http://busi.xiaodun.cn/app'
############## video mettings ##################
VEDIO_MEETING_DOMAIN = "http://passport.guoshi.com/mp"
############## wenjuan domain ##################
WENJUAN_DOMAIN = "http://apitest.wenjuan.com:8000"
####### wenjuan secret_key #######
WENJUAN_SECKEY = "9d15a674a6e621058f1ea9171413b7c0"
|
agpl-3.0
|
ACEmulator/ACE-World
|
Database/3-Core/9 WeenieDefaults/SQL/Creature/Undead/33285 Enraged Ancient Soul.sql
|
64218
|
DELETE FROM `weenie` WHERE `class_Id` = 33285;
INSERT INTO `weenie` (`class_Id`, `class_Name`, `type`, `last_Modified`)
VALUES (33285, 'ace33285-enragedancientsoul', 10, '2019-02-10 00:00:00') /* Creature */;
INSERT INTO `weenie_properties_int` (`object_Id`, `type`, `value`)
VALUES (33285, 1, 16) /* ItemType - Creature */
, (33285, 2, 14) /* CreatureType - Undead */
, (33285, 6, -1) /* ItemsCapacity */
, (33285, 7, -1) /* ContainersCapacity */
, (33285, 16, 1) /* ItemUseable - No */
, (33285, 25, 185) /* Level */
, (33285, 93, 1032) /* PhysicsState - ReportCollisions, Gravity */
, (33285, 133, 2) /* ShowableOnRadar - ShowMovement */
, (33285, 8007, 0) /* PCAPRecordedAutonomousMovement */;
INSERT INTO `weenie_properties_bool` (`object_Id`, `type`, `value`)
VALUES (33285, 1, True ) /* Stuck */;
INSERT INTO `weenie_properties_float` (`object_Id`, `type`, `value`)
VALUES (33285, 39, 1.3) /* DefaultScale */
, (33285, 76, 0.6) /* Translucency */;
INSERT INTO `weenie_properties_string` (`object_Id`, `type`, `value`)
VALUES (33285, 1, 'Enraged Ancient Soul') /* Name */
, (33285, 8006, 'AAA9AAAAAAA=') /* PCAPRecordedCurrentMotionState */;
INSERT INTO `weenie_properties_d_i_d` (`object_Id`, `type`, `value`)
VALUES (33285, 1, 0x02000FA4) /* Setup */
, (33285, 2, 0x09000017) /* MotionTable */
, (33285, 3, 0x20000016) /* SoundTable */
, (33285, 6, 0x040015F0) /* PaletteBase */
, (33285, 8, 0x06002CF5) /* Icon */
, (33285, 22, 0x34000028) /* PhysicsEffectTable */
, (33285, 8001, 8388630) /* PCAPRecordedWeenieHeader - ItemsCapacity, ContainersCapacity, Usable, RadarBehavior */
, (33285, 8003, 20) /* PCAPRecordedObjectDesc - Stuck, Attackable */
, (33285, 8005, 366787) /* PCAPRecordedPhysicsDesc - CSetup, MTable, Children, ObjScale, STable, PeTable, Position, Movement, Translucency */;
INSERT INTO `weenie_properties_position` (`object_Id`, `position_Type`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`)
VALUES (33285, 8040, 0x00CE03DA, 60, -140, 12.00975, 1, 0, 0, 0) /* PCAPRecordedLocation */
/* @teleloc 0x00CE03DA [60.000000 -140.000000 12.009750] 1.000000 0.000000 0.000000 0.000000 */;
INSERT INTO `weenie_properties_i_i_d` (`object_Id`, `type`, `value`)
VALUES (33285, 8000, 0xDD039BB2) /* PCAPRecordedObjectIID */;
INSERT INTO `weenie_properties_attribute_2nd` (`object_Id`, `type`, `init_Level`, `level_From_C_P`, `c_P_Spent`, `current_Level`)
VALUES (33285, 1, 0, 0, 0, 2410) /* MaxHealth */;
INSERT INTO `weenie_properties_create_list` (`object_Id`, `destination_Type`, `weenie_Class_Id`, `stack_Size`, `palette`, `shade`, `try_To_Bond`)
VALUES (33285, 2, 48102, 1, 0, 0, False) /* Create Khopesh (48102) for Wield */
, (33285, 2, 48103, 1, 0, 0, False) /* Create Sickle (48103) for Wield */
, (33285, 9, 42750, 0, 0, 0, False) /* Create Haebrean Gauntlets (42750) for ContainTreasure */
, (33285, 9, 295, 0, 0, 0, False) /* Create Bracelet (295) for ContainTreasure */
, (33285, 9, 45416, 0, 0, 0, False) /* Create Knife (45416) for ContainTreasure */
, (33285, 9, 7790, 0, 0, 0, False) /* Create Electric Spiked Club (7790) for ContainTreasure */
, (33285, 9, 31764, 0, 0, 0, False) /* Create Lugian Hammer (31764) for ContainTreasure */
, (33285, 9, 44849, 0, 0, 0, False) /* Create Chevron Cloak (44849) for ContainTreasure */
, (33285, 9, 49215, 0, 0, 0, False) /* Create Acid Skeleton Minion Essence (100) (49215) for ContainTreasure */
, (33285, 9, 29240, 0, 0, 0, False) /* Create Electric Bow (29240) for ContainTreasure */
, (33285, 9, 622, 0, 0, 0, False) /* Create Necklace (622) for ContainTreasure */
, (33285, 9, 2407, 1, 0, 0, False) /* Create Gem (2407) for ContainTreasure */
, (33285, 9, 25648, 0, 0, 0, False) /* Create Leather Pauldrons (25648) for ContainTreasure */
, (33285, 9, 41488, 0, 0, 0, False) /* Create Top (41488) for ContainTreasure */
, (33285, 9, 21159, 0, 0, 0, False) /* Create Covenant Tassets (21159) for ContainTreasure */
, (33285, 9, 49306, 0, 0, 0, False) /* Create Frost K'nath Essence (125) (49306) for ContainTreasure */
, (33285, 9, 42, 0, 0, 0, False) /* Create Studded Leather Breastplate (42) for ContainTreasure */
, (33285, 9, 30582, 0, 0, 0, False) /* Create Lightning Mazule (30582) for ContainTreasure */
, (33285, 9, 40699, 0, 0, 0, False) /* Create Covenant Girth (40699) for ContainTreasure */
, (33285, 9, 27218, 0, 0, 0, False) /* Create Chiran Leggings (27218) for ContainTreasure */
, (33285, 9, 63, 0, 0, 0, False) /* Create Studded Leather Girth (63) for ContainTreasure */
, (33285, 9, 163, 0, 0, 0, False) /* Create Ornamental Bowl (163) for ContainTreasure */
, (33285, 9, 29262, 0, 0, 0, False) /* Create Fire Sceptre (29262) for ContainTreasure */
, (33285, 9, 624, 0, 0, 0, False) /* Create Ring (624) for ContainTreasure */
, (33285, 9, 25642, 0, 0, 0, False) /* Create Leather Gauntlets (25642) for ContainTreasure */
, (33285, 9, 49444, 0, 0, 0, False) /* Create Frost Spectre Essence (100) (49444) for ContainTreasure */
, (33285, 9, 6005, 0, 0, 0, False) /* Create Koujia Sleeves (6005) for ContainTreasure */
, (33285, 9, 49362, 0, 0, 0, False) /* Create Frost Moar Essence (125) (49362) for ContainTreasure */
, (33285, 9, 28629, 0, 0, 0, False) /* Create Alduressa Coat (28629) for ContainTreasure */
, (33285, 9, 45111, 0, 0, 0, False) /* Create Flaming Schlager (45111) for ContainTreasure */
, (33285, 9, 21155, 0, 0, 0, False) /* Create Covenant Greaves (21155) for ContainTreasure */
, (33285, 9, 2590, 0, 0, 0, False) /* Create Baggy Shirt (2590) for ContainTreasure */
, (33285, 9, 7798, 0, 0, 0, False) /* Create Electric Naginata (7798) for ContainTreasure */
, (33285, 9, 25647, 0, 0, 0, False) /* Create Leather Pants (25647) for ContainTreasure */
, (33285, 9, 49278, 0, 0, 0, False) /* Create Frost Child Essence (125) (49278) for ContainTreasure */
, (33285, 9, 2587, 0, 0, 0, False) /* Create Shirt (2587) for ContainTreasure */
, (33285, 9, 48, 0, 0, 0, False) /* Create Studded Leather Coat (48) for ContainTreasure */
, (33285, 9, 43055, 0, 0, 0, False) /* Create Knorr Academy Vambraces (43055) for ContainTreasure */
, (33285, 9, 49525, 0, 0, 0, False) /* Create Acid Phyntos Wasp Essence (80) (49525) for ContainTreasure */
, (33285, 9, 41483, 0, 0, 0, False) /* Create Compass (41483) for ContainTreasure */
, (33285, 9, 48965, 0, 0, 0, False) /* Create Fire Child Essence (125) (48965) for ContainTreasure */
, (33285, 9, 3803, 0, 0, 0, False) /* Create Lightning Jitte (3803) for ContainTreasure */
, (33285, 9, 44802, 0, 0, 0, False) /* Create Vestiri Over-robe (44802) for ContainTreasure */
, (33285, 9, 20248, 0, 0, 0, False) /* Create Scroll of Ogfoot (20248) for ContainTreasure */
, (33285, 9, 41487, 0, 0, 0, False) /* Create Mechanical Scarab (41487) for ContainTreasure */
, (33285, 9, 28606, 0, 0, 0, False) /* Create Viamontian Pants (28606) for ContainTreasure */
, (33285, 9, 44, 0, 0, 0, False) /* Create Buckler (44) for ContainTreasure */
, (33285, 9, 40703, 0, 0, 0, False) /* Create Covenant Shield (40703) for ContainTreasure */
, (33285, 9, 38, 0, 0, 0, False) /* Create Studded Leather Bracers (38) for ContainTreasure */
, (33285, 9, 42637, 1, 0, 0, False) /* Create Aetheria (42637) for ContainTreasure */
, (33285, 9, 20465, 0, 0, 0, False) /* Create Scroll of Caustic Boon (20465) for ContainTreasure */
, (33285, 9, 22441, 0, 0, 0, False) /* Create Acid Dirk (22441) for ContainTreasure */
, (33285, 9, 49216, 0, 0, 0, False) /* Create Acid Skeleton Bushi Essence (125) (49216) for ContainTreasure */
, (33285, 9, 28607, 0, 0, 0, False) /* Create Lace Shirt (28607) for ContainTreasure */
, (33285, 9, 154, 0, 0, 0, False) /* Create Goblet (154) for ContainTreasure */
, (33285, 9, 49333, 0, 0, 0, False) /* Create Frost Wisp Essence (100) (49333) for ContainTreasure */
, (33285, 9, 20483, 0, 0, 0, False) /* Create Scroll of Boon of the Arrow Turner (20483) for ContainTreasure */
, (33285, 9, 621, 0, 0, 0, False) /* Create Heavy Bracelet (621) for ContainTreasure */
, (33285, 9, 29260, 0, 0, 0, False) /* Create Blunt Sceptre (29260) for ContainTreasure */
, (33285, 9, 22158, 0, 0, 0, False) /* Create Jo (22158) for ContainTreasure */
, (33285, 9, 25643, 0, 0, 0, False) /* Create Leather Girth (25643) for ContainTreasure */
, (33285, 9, 3939, 0, 0, 0, False) /* Create Acid Morning Star (3939) for ContainTreasure */
, (33285, 9, 28610, 0, 0, 0, False) /* Create Loafers (28610) for ContainTreasure */
, (33285, 9, 332, 0, 0, 0, False) /* Create Morning Star (332) for ContainTreasure */
, (33285, 9, 31867, 0, 0, 0, False) /* Create Diadem (31867) for ContainTreasure */
, (33285, 9, 793, 0, 0, 0, False) /* Create Scalemail Coif (793) for ContainTreasure */
, (33285, 9, 7772, 0, 0, 0, False) /* Create Trident (7772) for ContainTreasure */
, (33285, 9, 27225, 0, 0, 0, False) /* Create Lorica Sleeves (27225) for ContainTreasure */
, (33285, 9, 30948, 0, 0, 0, False) /* Create Diforsa Hauberk (30948) for ContainTreasure */
, (33285, 9, 20479, 0, 0, 0, False) /* Create Scroll of Inferno's Gift (20479) for ContainTreasure */
, (33285, 9, 31790, 0, 0, 0, False) /* Create Lightning Stick (31790) for ContainTreasure */
, (33285, 9, 49534, 0, 0, 0, False) /* Create Fire Phyntos Wasp Essence (125) (49534) for ContainTreasure */
, (33285, 9, 135, 0, 0, 0, False) /* Create Turban (135) for ContainTreasure */
, (33285, 9, 20404, 0, 0, 0, False) /* Create Scroll of Swordsman's Bane (20404) for ContainTreasure */
, (33285, 9, 30560, 0, 0, 0, False) /* Create Frost Hatchet (30560) for ContainTreasure */
, (33285, 9, 31868, 0, 0, 0, False) /* Create Signet Crown (31868) for ContainTreasure */
, (33285, 9, 150, 0, 0, 0, False) /* Create Flagon (150) for ContainTreasure */
, (33285, 9, 40636, 0, 0, 0, False) /* Create Acid Tetsubo (40636) for ContainTreasure */
, (33285, 9, 6043, 0, 0, 0, False) /* Create Celdon Girth (6043) for ContainTreasure */
, (33285, 9, 31865, 0, 0, 0, False) /* Create Circlet (31865) for ContainTreasure */
, (33285, 9, 2409, 1, 0, 0, False) /* Create Gem (2409) for ContainTreasure */
, (33285, 9, 20599, 0, 0, 0, False) /* Create Scroll of Eye of the Grunt (20599) for ContainTreasure */
, (33285, 9, 25661, 0, 0, 0, False) /* Create Leather Boots (25661) for ContainTreasure */
, (33285, 9, 2367, 0, 0, 0, False) /* Create Gorget (2367) for ContainTreasure */
, (33285, 9, 2588, 0, 0, 0, False) /* Create Flared Shirt (2588) for ContainTreasure */
, (33285, 9, 3818, 0, 0, 0, False) /* Create Acid Katar (3818) for ContainTreasure */
, (33285, 9, 25644, 0, 0, 0, False) /* Create Leather Greaves (25644) for ContainTreasure */
, (33285, 9, 20490, 0, 0, 0, False) /* Create Scroll of Battlemage's Blessing (20490) for ContainTreasure */
, (33285, 9, 48946, 0, 0, 0, False) /* Create Fire Skeleton Bushi Essence (125) (48946) for ContainTreasure */
, (33285, 9, 49431, 0, 0, 0, False) /* Create Lightning Spectre Essence (125) (49431) for ContainTreasure */
, (33285, 9, 30611, 0, 0, 0, False) /* Create Knuckles (30611) for ContainTreasure */
, (33285, 9, 4195, 0, 0, 0, False) /* Create Nekode (4195) for ContainTreasure */
, (33285, 9, 2600, 0, 0, 0, False) /* Create Pantaloons (2600) for ContainTreasure */
, (33285, 9, 297, 0, 0, 0, False) /* Create Ring (297) for ContainTreasure */
, (33285, 9, 41486, 0, 0, 0, False) /* Create Puzzle Box (41486) for ContainTreasure */
, (33285, 9, 43373, 0, 0, 0, False) /* Create Scroll of Void Magic Ineptitude Other VII (43373) for ContainTreasure */
, (33285, 9, 20563, 0, 0, 0, False) /* Create Scroll of Eyes Clouded (20563) for ContainTreasure */
, (33285, 9, 31799, 0, 0, 0, False) /* Create Acid Compound Bow (31799) for ContainTreasure */
, (33285, 9, 25636, 0, 0, 0, False) /* Create Leather Helm (25636) for ContainTreasure */
, (33285, 9, 31866, 0, 0, 0, False) /* Create Coronet (31866) for ContainTreasure */
, (33285, 9, 2410, 1, 0, 0, False) /* Create Gem (2410) for ContainTreasure */
, (33285, 9, 44977, 0, 0, 0, False) /* Create Lyceum Hood (44977) for ContainTreasure */
, (33285, 9, 2403, 1, 0, 0, False) /* Create Gem (2403) for ContainTreasure */
, (33285, 9, 42749, 0, 0, 0, False) /* Create Haebrean Breastplate (42749) for ContainTreasure */
, (33285, 9, 40706, 0, 0, 0, False) /* Create Covenant Bracers (40706) for ContainTreasure */
, (33285, 9, 25637, 0, 0, 0, False) /* Create Leather Bracers (25637) for ContainTreasure */
, (33285, 9, 2593, 0, 0, 0, False) /* Create Loose Tunic (2593) for ContainTreasure */
, (33285, 9, 45, 0, 0, 0, False) /* Create Leather Cap (45) for ContainTreasure */
, (33285, 9, 121, 0, 0, 0, False) /* Create Gloves (121) for ContainTreasure */
, (33285, 9, 20236, 0, 0, 0, False) /* Create Scroll of Temeritous Touch (20236) for ContainTreasure */
, (33285, 9, 42754, 0, 0, 0, False) /* Create Haebrean Pauldrons (42754) for ContainTreasure */
, (33285, 9, 40708, 0, 0, 0, False) /* Create Covenant Gauntlets (40708) for ContainTreasure */
, (33285, 9, 31759, 0, 0, 0, False) /* Create Dericost Blade (31759) for ContainTreasure */
, (33285, 9, 31783, 0, 0, 0, False) /* Create Frost Claw (31783) for ContainTreasure */
, (33285, 9, 114, 0, 0, 0, False) /* Create Platemail Vambraces (114) for ContainTreasure */
, (33285, 9, 128, 0, 0, 0, False) /* Create Qafiya (128) for ContainTreasure */
, (33285, 9, 43300, 0, 0, 0, False) /* Create Scroll of Nether Arc VII (43300) for ContainTreasure */
, (33285, 9, 20546, 0, 0, 0, False) /* Create Scroll of Jahannan's Boon (20546) for ContainTreasure */
, (33285, 9, 3858, 0, 0, 0, False) /* Create Lightning Shou-ono (3858) for ContainTreasure */
, (33285, 9, 20237, 0, 0, 0, False) /* Create Scroll of Perseverance (20237) for ContainTreasure */
, (33285, 9, 132, 0, 0, 0, False) /* Create Shoes (132) for ContainTreasure */
, (33285, 9, 20471, 0, 0, 0, False) /* Create Scroll of Boon of the Mace Turner (20471) for ContainTreasure */
, (33285, 9, 49320, 0, 0, 0, False) /* Create Lightning Wisp Essence (125) (49320) for ContainTreasure */
, (33285, 9, 623, 0, 0, 0, False) /* Create Heavy Necklace (623) for ContainTreasure */
, (33285, 9, 40702, 0, 0, 0, False) /* Create Covenant Pauldrons (40702) for ContainTreasure */
, (33285, 9, 243, 0, 0, 0, False) /* Create Dinner Plate (243) for ContainTreasure */
, (33285, 9, 29239, 0, 0, 0, False) /* Create Bone Bow (29239) for ContainTreasure */
, (33285, 9, 49269, 0, 0, 0, False) /* Create Lightning Elemental Essence (80) (49269) for ContainTreasure */
, (33285, 9, 31766, 0, 0, 0, False) /* Create Lightning Lugian Hammer (31766) for ContainTreasure */
, (33285, 9, 142, 0, 0, 0, False) /* Create Chalice (142) for ContainTreasure */
, (33285, 9, 31779, 0, 0, 0, False) /* Create Spine Glaive (31779) for ContainTreasure */
, (33285, 9, 20531, 0, 0, 0, False) /* Create Scroll of Lilitha's Blessing (20531) for ContainTreasure */
, (33285, 9, 31778, 0, 0, 0, False) /* Create Frost Spine Glaive (31778) for ContainTreasure */
, (33285, 9, 31781, 0, 0, 0, False) /* Create Electric Spine Glaive (31781) for ContainTreasure */
, (33285, 9, 49391, 0, 0, 0, False) /* Create Frost Grievver Essence (150) (49391) for ContainTreasure */
, (33285, 9, 28612, 0, 0, 0, False) /* Create Bandana (28612) for ContainTreasure */
, (33285, 9, 359, 0, 0, 0, False) /* Create War Hammer (359) for ContainTreasure */
, (33285, 9, 20542, 0, 0, 0, False) /* Create Scroll of Yoshi's Boon (20542) for ContainTreasure */
, (33285, 9, 44856, 0, 0, 0, False) /* Create Trimmed Cloak (44856) for ContainTreasure */
, (33285, 9, 41294, 0, 0, 0, False) /* Create Scroll of Greased Palms (41294) for ContainTreasure */
, (33285, 9, 129, 0, 0, 0, False) /* Create Sandals (129) for ContainTreasure */
, (33285, 9, 40704, 0, 0, 0, False) /* Create Covenant Tassets (40704) for ContainTreasure */
, (33285, 9, 64, 0, 0, 0, False) /* Create Yoroi Girth (64) for ContainTreasure */
, (33285, 9, 49374, 0, 0, 0, False) /* Create Lightning Grievver Essence (80) (49374) for ContainTreasure */
, (33285, 9, 21152, 0, 0, 0, False) /* Create Covenant Breastplate (21152) for ContainTreasure */
, (33285, 9, 49375, 0, 0, 0, False) /* Create Lightning Grievver Essence (100) (49375) for ContainTreasure */
, (33285, 9, 49348, 0, 0, 0, False) /* Create Lightning Moar Essence (125) (49348) for ContainTreasure */
, (33285, 9, 20495, 0, 0, 0, False) /* Create Scroll of Bottle Breaker (20495) for ContainTreasure */
, (33285, 9, 20543, 0, 0, 0, False) /* Create Scroll of Yoshi's Blessing (20543) for ContainTreasure */
, (33285, 9, 40762, 0, 0, 0, False) /* Create Lightning Nodachi (40762) for ContainTreasure */
, (33285, 9, 24477, 0, 0, 0, False) /* Create Sturdy Steel Key (24477) for ContainTreasure */
, (33285, 9, 49299, 0, 0, 0, False) /* Create Fire K'nath Essence (125) (49299) for ContainTreasure */
, (33285, 9, 31801, 0, 0, 0, False) /* Create Electric Compound Bow (31801) for ContainTreasure */
, (33285, 9, 20253, 0, 0, 0, False) /* Create Scroll of Might of the 5 Mules (20253) for ContainTreasure */
, (33285, 9, 31777, 0, 0, 0, False) /* Create Fire Board with Nail (31777) for ContainTreasure */
, (33285, 9, 45418, 0, 0, 0, False) /* Create Lightning Knife (45418) for ContainTreasure */
, (33285, 9, 30581, 0, 0, 0, False) /* Create Mazule (30581) for ContainTreasure */
, (33285, 9, 31816, 0, 0, 0, False) /* Create Fire Slingshot (31816) for ContainTreasure */
, (33285, 9, 554, 0, 0, 0, False) /* Create Studded Leather Basinet (554) for ContainTreasure */
, (33285, 9, 49540, 0, 0, 0, False) /* Create Frost Phyntos Wasp Essence (100) (49540) for ContainTreasure */
, (33285, 9, 49284, 0, 0, 0, False) /* Create Acid K'nath Essence (100) (49284) for ContainTreasure */
, (33285, 9, 44858, 0, 0, 0, False) /* Create Quartered Cloak (44858) for ContainTreasure */
, (33285, 9, 20534, 0, 0, 0, False) /* Create Scroll of Avalenne's Blessing (20534) for ContainTreasure */
, (33285, 9, 30561, 0, 0, 0, False) /* Create Dolabra (30561) for ContainTreasure */
, (33285, 9, 40711, 0, 0, 0, False) /* Create Covenant Helm (40711) for ContainTreasure */
, (33285, 9, 110, 0, 0, 0, False) /* Create Platemail Tassets (110) for ContainTreasure */
, (33285, 9, 28609, 0, 0, 0, False) /* Create Vest (28609) for ContainTreasure */
, (33285, 9, 46881, 0, 0, 0, False) /* Create Aura of Heartseeker Other VII (46881) for ContainTreasure */
, (33285, 9, 2421, 1, 0, 0, False) /* Create Gem (2421) for ContainTreasure */
, (33285, 9, 31774, 0, 0, 0, False) /* Create Board with Nail (31774) for ContainTreasure */
, (33285, 9, 21150, 0, 0, 0, False) /* Create Covenant Sollerets (21150) for ContainTreasure */
, (33285, 9, 31787, 0, 0, 0, False) /* Create Flaming Claw (31787) for ContainTreasure */
, (33285, 9, 46879, 0, 0, 0, False) /* Create Aura of Blood Drinker Other VII (46879) for ContainTreasure */
, (33285, 9, 118, 0, 0, 0, False) /* Create Cloth Cap (118) for ContainTreasure */
, (33285, 9, 49313, 0, 0, 0, False) /* Create Acid Wisp Essence (125) (49313) for ContainTreasure */
, (33285, 9, 98, 0, 0, 0, False) /* Create Scalemail Shirt (98) for ContainTreasure */
, (33285, 9, 7771, 0, 0, 0, False) /* Create Naginata (7771) for ContainTreasure */
, (33285, 9, 45109, 0, 0, 0, False) /* Create Acid Schlager (45109) for ContainTreasure */
, (33285, 9, 20552, 0, 0, 0, False) /* Create Scroll of Wrath of Harlune (20552) for ContainTreasure */
, (33285, 9, 28611, 0, 0, 0, False) /* Create Viamontian Laced Boots (28611) for ContainTreasure */
, (33285, 9, 71, 0, 0, 0, False) /* Create Chainmail Hauberk (71) for ContainTreasure */
, (33285, 9, 31811, 0, 0, 0, False) /* Create Piercing Compound Crossbow (31811) for ContainTreasure */
, (33285, 9, 49548, 0, 0, 0, False) /* Create Lightning Phyntos Wasp Essence (125) (49548) for ContainTreasure */
, (33285, 9, 28624, 0, 0, 0, False) /* Create Tenassa Sleeves (28624) for ContainTreasure */
, (33285, 9, 104, 0, 0, 0, False) /* Create Scalemail Sleeves (104) for ContainTreasure */
, (33285, 9, 40698, 0, 0, 0, False) /* Create Covenant Gauntlets (40698) for ContainTreasure */
, (33285, 9, 22440, 0, 0, 0, False) /* Create Dirk (22440) for ContainTreasure */
, (33285, 9, 48945, 0, 0, 0, False) /* Create Fire Skeleton Minion Essence (100) (48945) for ContainTreasure */
, (33285, 9, 30569, 0, 0, 0, False) /* Create Frost Sabra (30569) for ContainTreasure */
, (33285, 9, 29204, 1, 0, 0, False) /* Create Tusker Spit (29204) for ContainTreasure */
, (33285, 9, 49369, 0, 0, 0, False) /* Create Acid Grievver Essence (125) (49369) for ContainTreasure */
, (33285, 9, 2595, 0, 0, 0, False) /* Create Baggy Tunic (2595) for ContainTreasure */
, (33285, 9, 20473, 0, 0, 0, False) /* Create Scroll of Tusker's Gift (20473) for ContainTreasure */
, (33285, 9, 49356, 0, 0, 0, False) /* Create Fire Moar Essence (150) (49356) for ContainTreasure */
, (33285, 9, 31805, 0, 0, 0, False) /* Create Slashing Compound Crossbow (31805) for ContainTreasure */
, (33285, 9, 96, 0, 0, 0, False) /* Create Chainmail Shirt (96) for ContainTreasure */
, (33285, 9, 45414, 0, 0, 0, False) /* Create Flaming Spada (45414) for ContainTreasure */
, (33285, 9, 20238, 0, 0, 0, False) /* Create Scroll of Anemia (20238) for ContainTreasure */
, (33285, 9, 42635, 1, 0, 0, False) /* Create Aetheria (42635) for ContainTreasure */
, (33285, 9, 22167, 0, 0, 0, False) /* Create Frost Quarter Staff (22167) for ContainTreasure */
, (33285, 9, 49446, 0, 0, 0, False) /* Create Frost Spectre Essence (150) (49446) for ContainTreasure */
, (33285, 9, 82, 0, 0, 0, False) /* Create Platemail Leggings (82) for ContainTreasure */
, (33285, 9, 2592, 0, 0, 0, False) /* Create Puffy Tunic (2592) for ContainTreasure */
, (33285, 9, 59, 0, 0, 0, False) /* Create Studded Leather Gauntlets (59) for ContainTreasure */
, (33285, 9, 49355, 0, 0, 0, False) /* Create Fire Moar Essence (125) (49355) for ContainTreasure */
, (33285, 9, 30587, 0, 0, 0, False) /* Create Acid Flanged Mace (30587) for ContainTreasure */
, (33285, 9, 43316, 0, 0, 0, False) /* Create Scroll of Nether Streak VII (43316) for ContainTreasure */
, (33285, 9, 41036, 0, 0, 0, False) /* Create Assagai (41036) for ContainTreasure */
, (33285, 9, 111, 0, 0, 0, False) /* Create Scalemail Tassets (111) for ContainTreasure */
, (33285, 9, 5901, 0, 0, 0, False) /* Create Kasa (5901) for ContainTreasure */
, (33285, 9, 7797, 0, 0, 0, False) /* Create Acid Naginata (7797) for ContainTreasure */
, (33285, 9, 20257, 0, 0, 0, False) /* Create Scroll of Mind Blossom (20257) for ContainTreasure */
, (33285, 9, 40639, 0, 0, 0, False) /* Create Frost Tetsubo (40639) for ContainTreasure */
, (33285, 9, 45395, 0, 0, 0, False) /* Create Rapier (45395) for ContainTreasure */
, (33285, 9, 49271, 0, 0, 0, False) /* Create Lightning Child Essence (125) (49271) for ContainTreasure */
, (33285, 9, 40635, 0, 0, 0, False) /* Create Tetsubo (40635) for ContainTreasure */
, (33285, 9, 21158, 0, 0, 0, False) /* Create Covenant Shield (21158) for ContainTreasure */
, (33285, 9, 20522, 0, 0, 0, False) /* Create Scroll of Hearts on Sleeves (20522) for ContainTreasure */
, (33285, 9, 108, 0, 0, 0, False) /* Create Chainmail Tassets (108) for ContainTreasure */
, (33285, 9, 130, 0, 0, 0, False) /* Create Shirt (130) for ContainTreasure */
, (33285, 9, 2425, 1, 0, 0, False) /* Create Gem (2425) for ContainTreasure */
, (33285, 9, 41060, 0, 0, 0, False) /* Create Flaming Great Star Mace (41060) for ContainTreasure */
, (33285, 9, 149, 0, 0, 0, False) /* Create Ewer (149) for ContainTreasure */
, (33285, 9, 46880, 0, 0, 0, False) /* Create Aura of Defender Other VII (46880) for ContainTreasure */
, (33285, 9, 29238, 0, 0, 0, False) /* Create Acid Bow (29238) for ContainTreasure */
, (33285, 9, 2596, 0, 0, 0, False) /* Create Doublet (2596) for ContainTreasure */
, (33285, 9, 49276, 0, 0, 0, False) /* Create Frost Elemental Essence (80) (49276) for ContainTreasure */
, (33285, 9, 41069, 0, 0, 0, False) /* Create Lightning Shashqa (41069) for ContainTreasure */
, (33285, 9, 42752, 0, 0, 0, False) /* Create Haebrean Greaves (42752) for ContainTreasure */
, (33285, 9, 49334, 0, 0, 0, False) /* Create Frost Wisp Essence (125) (49334) for ContainTreasure */
, (33285, 9, 99, 0, 0, 0, False) /* Create Studded Leather Shirt (99) for ContainTreasure */
, (33285, 9, 22161, 0, 0, 0, False) /* Create Flaming Nabut (22161) for ContainTreasure */
, (33285, 9, 31792, 0, 0, 0, False) /* Create Frost Stick (31792) for ContainTreasure */
, (33285, 9, 45419, 0, 0, 0, False) /* Create Flaming Knife (45419) for ContainTreasure */
, (33285, 9, 3845, 0, 0, 0, False) /* Create Frost Ono (3845) for ContainTreasure */
, (33285, 9, 20417, 0, 0, 0, False) /* Create Scroll of Cabalastic Ostracism (20417) for ContainTreasure */
, (33285, 9, 41062, 0, 0, 0, False) /* Create Khanda-handled Mace (41062) for ContainTreasure */
, (33285, 9, 49335, 0, 0, 0, False) /* Create Frost Wisp Essence (150) (49335) for ContainTreasure */
, (33285, 9, 20418, 0, 0, 0, False) /* Create Scroll of Brogard's Defiance (20418) for ContainTreasure */
, (33285, 9, 112, 0, 0, 0, False) /* Create Studded Leather Tassets (112) for ContainTreasure */
, (33285, 9, 133, 0, 0, 0, False) /* Create Slippers (133) for ContainTreasure */
, (33285, 9, 20487, 0, 0, 0, False) /* Create Scroll of Decrepitude's Grasp (20487) for ContainTreasure */
, (33285, 9, 2597, 0, 0, 0, False) /* Create Flared Pants (2597) for ContainTreasure */
, (33285, 9, 31026, 0, 0, 0, False) /* Create Tenassa Breastplate (31026) for ContainTreasure */
, (33285, 9, 20512, 0, 0, 0, False) /* Create Scroll of Morimoto's Blessing (20512) for ContainTreasure */
, (33285, 9, 296, 0, 0, 0, False) /* Create Crown (296) for ContainTreasure */
, (33285, 9, 2411, 1, 0, 0, False) /* Create Gem (2411) for ContainTreasure */
, (33285, 9, 87, 0, 0, 0, False) /* Create Platemail Pauldrons (87) for ContainTreasure */
, (33285, 9, 723, 0, 0, 0, False) /* Create Studded Leather Cowl (723) for ContainTreasure */
, (33285, 9, 2412, 1, 0, 0, False) /* Create Gem (2412) for ContainTreasure */
, (33285, 9, 41052, 0, 0, 0, False) /* Create Greataxe (41052) for ContainTreasure */
, (33285, 9, 49438, 0, 0, 0, False) /* Create Fire Spectre Essence (125) (49438) for ContainTreasure */
, (33285, 9, 2589, 0, 0, 0, False) /* Create Smock (2589) for ContainTreasure */
, (33285, 9, 2423, 1, 0, 0, False) /* Create Gem (2423) for ContainTreasure */
, (33285, 9, 28628, 0, 0, 0, False) /* Create Diforsa Breastplate (28628) for ContainTreasure */
, (33285, 9, 101, 0, 0, 0, False) /* Create Chainmail Sleeves (101) for ContainTreasure */
, (33285, 9, 40710, 0, 0, 0, False) /* Create Covenant Greaves (40710) for ContainTreasure */
, (33285, 9, 3904, 0, 0, 0, False) /* Create Frost Tungi (3904) for ContainTreasure */
, (33285, 9, 31773, 0, 0, 0, False) /* Create Frost Board with Nail (31773) for ContainTreasure */
, (33285, 9, 45434, 0, 0, 0, False) /* Create Flaming Khanjar (45434) for ContainTreasure */
, (33285, 9, 49291, 0, 0, 0, False) /* Create Lightning K'nath Essence (100) (49291) for ContainTreasure */
, (33285, 9, 40638, 0, 0, 0, False) /* Create Flaming Tetsubo (40638) for ContainTreasure */
, (33285, 9, 30599, 0, 0, 0, False) /* Create Frost Poniard (30599) for ContainTreasure */
, (33285, 9, 31800, 0, 0, 0, False) /* Create Blunt Compound Bow (31800) for ContainTreasure */
, (33285, 9, 124, 0, 0, 0, False) /* Create Jerkin (124) for ContainTreasure */
, (33285, 9, 6046, 0, 0, 0, False) /* Create Amuli Coat (6046) for ContainTreasure */
, (33285, 9, 6047, 0, 0, 0, False) /* Create Amuli Leggings (6047) for ContainTreasure */
, (33285, 9, 28630, 0, 0, 0, False) /* Create Diforsa Cuirass (28630) for ContainTreasure */
, (33285, 9, 44854, 0, 0, 0, False) /* Create Halved Cloak (44854) for ContainTreasure */
, (33285, 9, 43375, 0, 0, 0, False) /* Create Scroll of Void Magic Mastery Other VII (43375) for ContainTreasure */
, (33285, 9, 49368, 0, 0, 0, False) /* Create Acid Grievver Essence (100) (49368) for ContainTreasure */
, (33285, 9, 41068, 0, 0, 0, False) /* Create Acid Shashqa (41068) for ContainTreasure */
, (33285, 9, 45322, 0, 0, 0, False) /* Create Scroll of Shield Mastery Other VII (45322) for ContainTreasure */
, (33285, 9, 45290, 0, 0, 0, False) /* Create Scroll of Recklessness Ineptitude Other VII (45290) for ContainTreasure */
, (33285, 9, 20466, 0, 0, 0, False) /* Create Scroll of Caustic Blessing (20466) for ContainTreasure */
, (33285, 9, 43292, 0, 0, 0, False) /* Create Scroll of Corruption VII (43292) for ContainTreasure */
, (33285, 9, 31786, 0, 0, 0, False) /* Create Lightning Claw (31786) for ContainTreasure */
, (33285, 9, 31812, 0, 0, 0, False) /* Create Slashing Slingshot (31812) for ContainTreasure */
, (33285, 9, 413, 0, 0, 0, False) /* Create Chainmail Bracers (413) for ContainTreasure */
, (33285, 9, 7793, 0, 0, 0, False) /* Create Acid Trident (7793) for ContainTreasure */
, (33285, 9, 2594, 0, 0, 0, False) /* Create Flared Tunic (2594) for ContainTreasure */
, (33285, 9, 29254, 0, 0, 0, False) /* Create Electric Atlatl (29254) for ContainTreasure */
, (33285, 9, 5894, 0, 0, 0, False) /* Create Fez (5894) for ContainTreasure */
, (33285, 9, 354, 0, 0, 0, False) /* Create Takuba (354) for ContainTreasure */
, (33285, 9, 20246, 0, 0, 0, False) /* Create Scroll of Gossamer Flesh (20246) for ContainTreasure */
, (33285, 9, 49325, 0, 0, 0, False) /* Create Fire Wisp Essence (80) (49325) for ContainTreasure */
, (33285, 9, 20566, 0, 0, 0, False) /* Create Scroll of Nuhmudira's Blessing (20566) for ContainTreasure */
, (33285, 9, 25638, 0, 0, 0, False) /* Create Leather Vest (25638) for ContainTreasure */
, (33285, 9, 45417, 0, 0, 0, False) /* Create Acid Knife (45417) for ContainTreasure */
, (33285, 9, 353, 0, 0, 0, False) /* Create Tachi (353) for ContainTreasure */
, (33285, 9, 45122, 0, 0, 0, False) /* Create Frost Hand Wraps (45122) for ContainTreasure */
, (33285, 9, 25650, 0, 0, 0, False) /* Create Leather Shorts (25650) for ContainTreasure */
, (33285, 9, 3765, 0, 0, 0, False) /* Create Frost Budiaq (3765) for ContainTreasure */
, (33285, 9, 31788, 0, 0, 0, False) /* Create Stick (31788) for ContainTreasure */
, (33285, 9, 40701, 0, 0, 0, False) /* Create Covenant Helm (40701) for ContainTreasure */
, (33285, 9, 45105, 0, 0, 0, False) /* Create Lightning Rapier (45105) for ContainTreasure */
, (33285, 9, 632, 0, 0, 0, False) /* Create Peerless Healing Kit (632) for ContainTreasure */
, (33285, 9, 3694, 0, 0, 0, False) /* Create Swamp Stone (3694) for ContainTreasure */
, (33285, 9, 2599, 0, 0, 0, False) /* Create Trousers (2599) for ContainTreasure */
, (33285, 9, 294, 0, 0, 0, False) /* Create Amulet (294) for ContainTreasure */
, (33285, 9, 30949, 0, 0, 0, False) /* Create Diforsa Sleeves (30949) for ContainTreasure */
, (33285, 9, 20450, 0, 0, 0, False) /* Create Scroll of Icy Torment (20450) for ContainTreasure */
, (33285, 9, 29248, 0, 0, 0, False) /* Create Fire Crossbow (29248) for ContainTreasure */
, (33285, 9, 22443, 0, 0, 0, False) /* Create Flaming Dirk (22443) for ContainTreasure */
, (33285, 9, 31769, 0, 0, 0, False) /* Create Lugian Axe (31769) for ContainTreasure */
, (33285, 9, 49228, 0, 0, 0, False) /* Create Frost Skeleton Minion Essence (80) (49228) for ContainTreasure */
, (33285, 9, 416, 0, 0, 0, False) /* Create Chainmail Pauldrons (416) for ContainTreasure */
, (33285, 9, 49424, 0, 0, 0, False) /* Create Acid Spectre Essence (125) (49424) for ContainTreasure */
, (33285, 9, 350, 0, 0, 0, False) /* Create Broad Sword (350) for ContainTreasure */
, (33285, 9, 49485, 1, 0, 0, False) /* Create Encapsulated Spirit (49485) for ContainTreasure */
, (33285, 9, 67, 0, 0, 0, False) /* Create Scalemail Greaves (67) for ContainTreasure */
, (33285, 9, 20613, 0, 0, 0, False) /* Create Scroll of Energize Vigor (20613) for ContainTreasure */
, (33285, 9, 20545, 0, 0, 0, False) /* Create Scroll of Feat of Radaz (20545) for ContainTreasure */
, (33285, 9, 21322, 0, 0, 0, False) /* Create Scroll of Frost Arc VII (21322) for ContainTreasure */
, (33285, 9, 45101, 0, 0, 0, False) /* Create Lightning Epee (45101) for ContainTreasure */
, (33285, 9, 21153, 0, 0, 0, False) /* Create Covenant Gauntlets (21153) for ContainTreasure */
, (33285, 9, 49340, 0, 0, 0, False) /* Create Acid Moar Essence (100) (49340) for ContainTreasure */
, (33285, 9, 58, 0, 0, 0, False) /* Create Scalemail Gauntlets (58) for ContainTreasure */
, (33285, 9, 2422, 1, 0, 0, False) /* Create Gem (2422) for ContainTreasure */
, (33285, 9, 30586, 0, 0, 0, False) /* Create Flanged Mace (30586) for ContainTreasure */
, (33285, 9, 31820, 0, 0, 0, False) /* Create Acid Baton (31820) for ContainTreasure */
, (33285, 9, 2404, 1, 0, 0, False) /* Create Gem (2404) for ContainTreasure */
, (33285, 9, 55, 0, 0, 0, False) /* Create Chainmail Gauntlets (55) for ContainTreasure */
, (33285, 9, 44803, 0, 0, 0, False) /* Create Empyrean Over-robe (44803) for ContainTreasure */
, (33285, 9, 25649, 0, 0, 0, False) /* Create Leather Shirt (25649) for ContainTreasure */
, (33285, 9, 20601, 0, 0, 0, False) /* Create Scroll of Essence Void (20601) for ContainTreasure */
, (33285, 9, 2605, 0, 0, 0, False) /* Create Chainmail Greaves (2605) for ContainTreasure */
, (33285, 9, 49360, 0, 0, 0, False) /* Create Frost Moar Essence (80) (49360) for ContainTreasure */
, (33285, 9, 40697, 0, 0, 0, False) /* Create Covenant Breastplate (40697) for ContainTreasure */
, (33285, 9, 49376, 0, 0, 0, False) /* Create Lightning Grievver Essence (125) (49376) for ContainTreasure */
, (33285, 9, 20506, 0, 0, 0, False) /* Create Scroll of Light Weapon Mastery Self VII (20506) for ContainTreasure */
, (33285, 9, 41040, 0, 0, 0, False) /* Create Frost Assagai (41040) for ContainTreasure */
, (33285, 9, 43830, 0, 0, 0, False) /* Create Sedgemail Leather Gauntlets (43830) for ContainTreasure */
, (33285, 9, 2603, 0, 0, 0, False) /* Create Baggy Breeches (2603) for ContainTreasure */
, (33285, 9, 116, 0, 0, 0, False) /* Create Studded Leather Boots (116) for ContainTreasure */
, (33285, 9, 45282, 0, 0, 0, False) /* Create Scroll of Dual Wield Mastery Self VII (45282) for ContainTreasure */
, (33285, 9, 20431, 0, 0, 0, False) /* Create Scroll of Corrosive Flash (20431) for ContainTreasure */
, (33285, 9, 20509, 0, 0, 0, False) /* Create Scroll of Missile Weapon Mastery Self VII (20509) for ContainTreasure */
, (33285, 9, 78, 0, 0, 0, False) /* Create Kote (78) for ContainTreasure */
, (33285, 9, 42753, 0, 0, 0, False) /* Create Haebrean Helm (42753) for ContainTreasure */
, (33285, 9, 4196, 0, 0, 0, False) /* Create Flaming Nekode (4196) for ContainTreasure */
, (33285, 9, 20247, 0, 0, 0, False) /* Create Scroll of Void's Call (20247) for ContainTreasure */
, (33285, 9, 49445, 0, 0, 0, False) /* Create Frost Spectre Essence (125) (49445) for ContainTreasure */
, (33285, 9, 30950, 0, 0, 0, False) /* Create Alduressa Boots (30950) for ContainTreasure */
, (33285, 9, 95, 0, 0, 0, False) /* Create Tower Shield (95) for ContainTreasure */
, (33285, 9, 40821, 0, 0, 0, False) /* Create Flaming Corsesca (40821) for ContainTreasure */
, (33285, 9, 20617, 0, 0, 0, False) /* Create Scroll of Meditative Trance (20617) for ContainTreasure */
, (33285, 9, 25640, 0, 0, 0, False) /* Create Leather Cowl (25640) for ContainTreasure */
, (33285, 9, 41485, 0, 0, 0, False) /* Create Pocket Watch (41485) for ContainTreasure */
, (33285, 9, 49222, 0, 0, 0, False) /* Create Lightning Skeleton Minion Essence (100) (49222) for ContainTreasure */
, (33285, 9, 106, 0, 0, 0, False) /* Create Yoroi Sleeves (106) for ContainTreasure */
, (33285, 9, 45433, 0, 0, 0, False) /* Create Lightning Khanjar (45433) for ContainTreasure */
, (33285, 9, 6048, 0, 0, 0, False) /* Create Celdon Sleeves (6048) for ContainTreasure */
, (33285, 9, 45108, 0, 0, 0, False) /* Create Schlager (45108) for ContainTreasure */
, (33285, 9, 29257, 0, 0, 0, False) /* Create Piercing Atlatl (29257) for ContainTreasure */
, (33285, 9, 7897, 0, 0, 0, False) /* Create Steel Toed Boots (7897) for ContainTreasure */
, (33285, 9, 27229, 0, 0, 0, False) /* Create Nariyid Girth (27229) for ContainTreasure */
, (33285, 9, 28623, 0, 0, 0, False) /* Create Diforsa Pauldrons (28623) for ContainTreasure */
, (33285, 9, 44976, 0, 0, 0, False) /* Create Hood (44976) for ContainTreasure */
, (33285, 9, 8326, 1, 0, 0, False) /* Create Copper Pea (8326) for ContainTreasure */
, (33285, 9, 8328, 1, 0, 0, False) /* Create Iron Pea (8328) for ContainTreasure */
, (33285, 9, 49250, 0, 0, 0, False) /* Create Fire Zombie Essence (125) (49250) for ContainTreasure */
, (33285, 9, 134, 0, 0, 0, False) /* Create Tunic (134) for ContainTreasure */
, (33285, 9, 20608, 0, 0, 0, False) /* Create Scroll of Gift of Essence (20608) for ContainTreasure */
, (33285, 9, 45118, 0, 0, 0, False) /* Create Hand Wraps (45118) for ContainTreasure */
, (33285, 9, 27226, 0, 0, 0, False) /* Create Nariyid Boots (27226) for ContainTreasure */
, (33285, 9, 30615, 0, 0, 0, False) /* Create Acid Knuckles (30615) for ContainTreasure */
, (33285, 9, 3915, 0, 0, 0, False) /* Create Flaming Yari (3915) for ContainTreasure */
, (33285, 9, 107, 0, 0, 0, False) /* Create Sollerets (107) for ContainTreasure */
, (33285, 9, 4198, 0, 0, 0, False) /* Create Frost Nekode (4198) for ContainTreasure */
, (33285, 9, 20502, 0, 0, 0, False) /* Create Scroll of Jibril's Blessing (20502) for ContainTreasure */
, (33285, 9, 21157, 0, 0, 0, False) /* Create Covenant Pauldrons (21157) for ContainTreasure */
, (33285, 9, 20611, 0, 0, 0, False) /* Create Scroll of Energize Vitality (20611) for ContainTreasure */
, (33285, 9, 20424, 0, 0, 0, False) /* Create Scroll of Archer Bait (20424) for ContainTreasure */
, (33285, 9, 31785, 0, 0, 0, False) /* Create Acid Claw (31785) for ContainTreasure */
, (33285, 9, 29243, 0, 0, 0, False) /* Create Piercing Bow (29243) for ContainTreasure */
, (33285, 9, 2402, 1, 0, 0, False) /* Create Gem (2402) for ContainTreasure */
, (33285, 9, 43284, 0, 0, 0, False) /* Create Scroll of Corrosion VII (43284) for ContainTreasure */
, (33285, 9, 44850, 0, 0, 0, False) /* Create Chevron Cloak (44850) for ContainTreasure */
, (33285, 9, 31784, 0, 0, 0, False) /* Create Claw (31784) for ContainTreasure */
, (33285, 9, 29250, 0, 0, 0, False) /* Create Piercing Crossbow (29250) for ContainTreasure */
, (33285, 9, 49546, 0, 0, 0, False) /* Create Lightning Phyntos Wasp Essence (80) (49546) for ContainTreasure */
, (33285, 9, 20579, 0, 0, 0, False) /* Create Scroll of Saladur's Boon (20579) for ContainTreasure */
, (33285, 9, 89, 0, 0, 0, False) /* Create Studded Leather Pauldrons (89) for ContainTreasure */
, (33285, 9, 7791, 0, 0, 0, False) /* Create Frost Trident (7791) for ContainTreasure */
, (33285, 9, 49347, 0, 0, 0, False) /* Create Lightning Moar Essence (100) (49347) for ContainTreasure */
, (33285, 9, 45421, 0, 0, 0, False) /* Create Dagger (45421) for ContainTreasure */
, (33285, 9, 31810, 0, 0, 0, False) /* Create Frost Compound Crossbow (31810) for ContainTreasure */
, (33285, 9, 49304, 0, 0, 0, False) /* Create Frost K'nath Essence (80) (49304) for ContainTreasure */
, (33285, 9, 20557, 0, 0, 0, False) /* Create Scroll of Oswald's Blessing (20557) for ContainTreasure */
, (33285, 9, 49305, 0, 0, 0, False) /* Create Frost K'nath Essence (100) (49305) for ContainTreasure */
, (33285, 9, 48961, 0, 0, 0, False) /* Create Fire Elemental Essence (80) (48961) for ContainTreasure */
, (33285, 9, 25652, 0, 0, 0, False) /* Create Leather Tassets (25652) for ContainTreasure */
, (33285, 9, 20475, 0, 0, 0, False) /* Create Scroll of Icy Blessing (20475) for ContainTreasure */
, (33285, 9, 29261, 0, 0, 0, False) /* Create Electric Sceptre (29261) for ContainTreasure */
, (33285, 9, 20492, 0, 0, 0, False) /* Create Scroll of Robustify (20492) for ContainTreasure */
, (33285, 9, 49314, 0, 0, 0, False) /* Create Acid Wisp Essence (150) (49314) for ContainTreasure */
, (33285, 9, 7768, 0, 0, 0, False) /* Create Spiked Club (7768) for ContainTreasure */
, (33285, 9, 21156, 0, 0, 0, False) /* Create Covenant Helm (21156) for ContainTreasure */
, (33285, 9, 49437, 0, 0, 0, False) /* Create Fire Spectre Essence (100) (49437) for ContainTreasure */
, (33285, 9, 49257, 0, 0, 0, False) /* Create Frost Zombie Essence (125) (49257) for ContainTreasure */
, (33285, 9, 3881, 0, 0, 0, False) /* Create Acid Long Sword (3881) for ContainTreasure */
, (33285, 9, 22156, 0, 0, 0, False) /* Create Flaming Jo (22156) for ContainTreasure */
, (33285, 9, 43832, 0, 0, 0, False) /* Create Sedgemail Leather Shoes (43832) for ContainTreasure */
, (33285, 9, 40709, 0, 0, 0, False) /* Create Covenant Girth (40709) for ContainTreasure */
, (33285, 9, 21154, 0, 0, 0, False) /* Create Covenant Girth (21154) for ContainTreasure */
, (33285, 9, 4199, 0, 0, 0, False) /* Create Lightning Nekode (4199) for ContainTreasure */
, (33285, 9, 25651, 0, 0, 0, False) /* Create Leather Sleeves (25651) for ContainTreasure */
, (33285, 9, 31795, 0, 0, 0, False) /* Create Acid Lancet (31795) for ContainTreasure */
, (33285, 9, 44852, 0, 0, 0, False) /* Create Chevron Cloak (44852) for ContainTreasure */
, (33285, 9, 20463, 0, 0, 0, False) /* Create Scroll of Evisceration (20463) for ContainTreasure */
, (33285, 9, 31813, 0, 0, 0, False) /* Create Acid Slingshot (31813) for ContainTreasure */
, (33285, 9, 22444, 0, 0, 0, False) /* Create Frost Dirk (22444) for ContainTreasure */
, (33285, 9, 49243, 0, 0, 0, False) /* Create Lightning Zombie Essence (125) (49243) for ContainTreasure */
, (33285, 9, 2424, 1, 0, 0, False) /* Create Gem (2424) for ContainTreasure */
, (33285, 9, 29246, 0, 0, 0, False) /* Create Ultimate Singularity Crossbow (29246) for ContainTreasure */
, (33285, 9, 339, 0, 0, 0, False) /* Create Scimitar (339) for ContainTreasure */
, (33285, 9, 414, 0, 0, 0, False) /* Create Chainmail Breastplate (414) for ContainTreasure */
, (33285, 9, 41055, 0, 0, 0, False) /* Create Flaming Greataxe (41055) for ContainTreasure */
, (33285, 9, 31864, 0, 0, 0, False) /* Create Teardrop Crown (31864) for ContainTreasure */
, (33285, 9, 20571, 0, 0, 0, False) /* Create Scroll of Kaluhc's Boon (20571) for ContainTreasure */
, (33285, 9, 53, 0, 0, 0, False) /* Create Studded Leather Cuirass (53) for ContainTreasure */
, (33285, 9, 7604, 1, 0, 0, False) /* Create Yellow Jewel (7604) for ContainTreasure */
, (33285, 9, 30951, 0, 0, 0, False) /* Create Alduressa Gauntlets (30951) for ContainTreasure */
, (33285, 9, 20503, 0, 0, 0, False) /* Create Scroll of Jibril's Vitae (20503) for ContainTreasure */
, (33285, 9, 2430, 1, 0, 0, False) /* Create Gem (2430) for ContainTreasure */
, (33285, 9, 45423, 0, 0, 0, False) /* Create Lightning Dagger (45423) for ContainTreasure */
, (33285, 9, 3202, 0, 0, 0, False) /* Create Scroll of Creature Enchantment Mastery Self VI (3202) for ContainTreasure */
, (33285, 9, 8331, 1, 0, 0, False) /* Create Silver Pea (8331) for ContainTreasure */
, (33285, 9, 45360, 1, 0, 0, False) /* Create Rogue's Crystal (45360) for ContainTreasure */
, (33285, 9, 49390, 0, 0, 0, False) /* Create Frost Grievver Essence (125) (49390) for ContainTreasure */
, (33285, 9, 27234, 0, 0, 0, False) /* Create Scroll of Eradicate Creature Magic Self (27234) for ContainTreasure */
, (33285, 9, 31824, 0, 0, 0, False) /* Create Ice Wand (31824) for ContainTreasure */
, (33285, 9, 31821, 0, 0, 0, False) /* Create Staff of Aerfalle (31821) for ContainTreasure */
, (33285, 9, 20513, 0, 0, 0, False) /* Create Scroll of Wrath of Adja (20513) for ContainTreasure */
, (33285, 9, 25645, 0, 0, 0, False) /* Create Leather Leggings (25645) for ContainTreasure */
, (33285, 9, 3768, 0, 0, 0, False) /* Create Flaming Club (3768) for ContainTreasure */
, (33285, 9, 49236, 0, 0, 0, False) /* Create Acid Zombie Essence (125) (49236) for ContainTreasure */
, (33285, 9, 28008, 0, 0, 0, False) /* Create Aura of Infected Spirit Caress Scroll (28008) for ContainTreasure */
, (33285, 9, 20564, 0, 0, 0, False) /* Create Scroll of Futility (20564) for ContainTreasure */
, (33285, 9, 25639, 0, 0, 0, False) /* Create Leather Jerkin (25639) for ContainTreasure */
, (33285, 9, 22168, 0, 0, 0, False) /* Create Hefty Walking Cane (22168) for ContainTreasure */
, (33285, 9, 2408, 1, 0, 0, False) /* Create Gem (2408) for ContainTreasure */
, (33285, 9, 69, 0, 0, 0, False) /* Create Yoroi Greaves (69) for ContainTreasure */
, (33285, 9, 43052, 0, 0, 0, False) /* Create Knorr Academy Pauldrons (43052) for ContainTreasure */
, (33285, 9, 49214, 0, 0, 0, False) /* Create Acid Skeleton Minion Essence (80) (49214) for ContainTreasure */
, (33285, 9, 45427, 0, 0, 0, False) /* Create Acid Jambiya (45427) for ContainTreasure */
, (33285, 9, 49321, 0, 0, 0, False) /* Create Lightning Wisp Essence (150) (49321) for ContainTreasure */
, (33285, 9, 20422, 0, 0, 0, False) /* Create Scroll of Wi's Folly (20422) for ContainTreasure */
, (33285, 9, 30609, 0, 0, 0, False) /* Create Frost Bastone (30609) for ContainTreasure */
, (33285, 9, 30616, 0, 0, 0, False) /* Create Arbalest (30616) for ContainTreasure */
, (33285, 9, 20507, 0, 0, 0, False) /* Create Scroll of Missile Weapon Ineptitude Other VII (20507) for ContainTreasure */
, (33285, 9, 6044, 0, 0, 0, False) /* Create Celdon Breastplate (6044) for ContainTreasure */
, (33285, 9, 20521, 0, 0, 0, False) /* Create Scroll of Finesse Weapon Mastery Self VII (20521) for ContainTreasure */
, (33285, 9, 28605, 0, 0, 0, False) /* Create Beret (28605) for ContainTreasure */
, (33285, 9, 84, 0, 0, 0, False) /* Create Studded Leggings (84) for ContainTreasure */
, (33285, 9, 41071, 0, 0, 0, False) /* Create Frost Shashqa (41071) for ContainTreasure */
, (33285, 9, 40695, 0, 0, 0, False) /* Create Covenant Sollerets (40695) for ContainTreasure */
, (33285, 9, 45115, 0, 0, 0, False) /* Create Lightning Hammer (45115) for ContainTreasure */
, (33285, 9, 41041, 0, 0, 0, False) /* Create Magari Yari (41041) for ContainTreasure */
, (33285, 9, 3813, 0, 0, 0, False) /* Create Sword of Frozen Fury (3813) for ContainTreasure */
, (33285, 9, 29258, 0, 0, 0, False) /* Create Slashing Atlatl (29258) for ContainTreasure */
, (33285, 9, 336, 0, 0, 0, False) /* Create Ono (336) for ContainTreasure */
, (33285, 9, 49251, 0, 0, 0, False) /* Create Fire Zombie Essence (150) (49251) for ContainTreasure */
, (33285, 9, 20477, 0, 0, 0, False) /* Create Scroll of Fiery Boon (20477) for ContainTreasure */
, (33285, 9, 49430, 0, 0, 0, False) /* Create Lightning Spectre Essence (100) (49430) for ContainTreasure */
, (33285, 9, 27237, 0, 0, 0, False) /* Create Scroll of Eradicate Life Magic Self (27237) for ContainTreasure */
, (33285, 9, 49285, 0, 0, 0, False) /* Create Acid K'nath Essence (125) (49285) for ContainTreasure */
, (33285, 9, 27231, 0, 0, 0, False) /* Create Nariyid Leggings (27231) for ContainTreasure */
, (33285, 9, 45119, 0, 0, 0, False) /* Create Acid Hand Wraps (45119) for ContainTreasure */
, (33285, 9, 22159, 0, 0, 0, False) /* Create Acid Nabut (22159) for ContainTreasure */
, (33285, 9, 41057, 0, 0, 0, False) /* Create Great Star Mace (41057) for ContainTreasure */
, (33285, 9, 31815, 0, 0, 0, False) /* Create Electric Slingshot (31815) for ContainTreasure */
, (33285, 9, 49264, 0, 0, 0, False) /* Create Acid Child Essence (125) (49264) for ContainTreasure */
, (33285, 9, 20526, 0, 0, 0, False) /* Create Scroll of Sashi Mu's Kiss (20526) for ContainTreasure */
, (33285, 9, 45411, 0, 0, 0, False) /* Create Spada (45411) for ContainTreasure */
, (33285, 9, 68, 0, 0, 0, False) /* Create Studded Leather Greaves (68) for ContainTreasure */
, (33285, 9, 30566, 0, 0, 0, False) /* Create Sabra (30566) for ContainTreasure */
, (33285, 9, 7795, 0, 0, 0, False) /* Create Frost Naginata (7795) for ContainTreasure */
, (33285, 9, 3821, 0, 0, 0, False) /* Create Frost Katar (3821) for ContainTreasure */
, (33285, 9, 31809, 0, 0, 0, False) /* Create Fire Compound Crossbow (31809) for ContainTreasure */
, (33285, 9, 31802, 0, 0, 0, False) /* Create Fire Compound Bow (31802) for ContainTreasure */
, (33285, 9, 45330, 0, 0, 0, False) /* Create Scroll of Shield Mastery Self VII (45330) for ContainTreasure */
, (33285, 9, 3874, 0, 0, 0, False) /* Create Lightning Spear (3874) for ContainTreasure */
, (33285, 9, 2601, 0, 0, 0, False) /* Create Loose Pants (2601) for ContainTreasure */
, (33285, 9, 49436, 0, 0, 0, False) /* Create Fire Spectre Essence (80) (49436) for ContainTreasure */
, (33285, 9, 49432, 0, 0, 0, False) /* Create Lightning Spectre Essence (150) (49432) for ContainTreasure */
, (33285, 9, 3868, 0, 0, 0, False) /* Create Frost Silifi (3868) for ContainTreasure */
, (33285, 9, 85, 0, 0, 0, False) /* Create Chainmail Coif (85) for ContainTreasure */
, (33285, 9, 20499, 0, 0, 0, False) /* Create Scroll of Aliester's Boon (20499) for ContainTreasure */
, (33285, 9, 49547, 0, 0, 0, False) /* Create Lightning Phyntos Wasp Essence (100) (49547) for ContainTreasure */
, (33285, 9, 45354, 0, 0, 0, False) /* Create Scroll of Sneak Attack Mastery Self VII (45354) for ContainTreasure */
, (33285, 9, 80, 0, 0, 0, False) /* Create Chainmail Leggings (80) for ContainTreasure */
, (33285, 9, 31780, 0, 0, 0, False) /* Create Acid Spine Glaive (31780) for ContainTreasure */
, (33285, 9, 6045, 0, 0, 0, False) /* Create Celdon Leggings (6045) for ContainTreasure */
, (33285, 9, 31782, 0, 0, 0, False) /* Create Fire Spine Glaive (31782) for ContainTreasure */
, (33285, 9, 20410, 0, 0, 0, False) /* Create Scroll of Tattercoat (20410) for ContainTreasure */
, (33285, 9, 301, 0, 0, 0, False) /* Create Battle Axe (301) for ContainTreasure */
, (33285, 9, 49526, 0, 0, 0, False) /* Create Acid Phyntos Wasp Essence (100) (49526) for ContainTreasure */
, (33285, 9, 28622, 0, 0, 0, False) /* Create Tenassa Leggings (28622) for ContainTreasure */
, (33285, 9, 351, 0, 0, 0, False) /* Create Long Sword (351) for ContainTreasure */
, (33285, 9, 44857, 0, 0, 0, False) /* Create Quartered Cloak (44857) for ContainTreasure */
, (33285, 9, 20426, 0, 0, 0, False) /* Create Aura of Atlan's Alacrity (20426) for ContainTreasure */
, (33285, 9, 30614, 0, 0, 0, False) /* Create Frost Knuckles (30614) for ContainTreasure */
, (33285, 9, 20494, 0, 0, 0, False) /* Create Scroll of Unflinching Persistence (20494) for ContainTreasure */
, (33285, 9, 7792, 0, 0, 0, False) /* Create Fire Trident (7792) for ContainTreasure */
, (33285, 9, 20500, 0, 0, 0, False) /* Create Scroll of Aliester's Blessing (20500) for ContainTreasure */
, (33285, 9, 40700, 0, 0, 0, False) /* Create Covenant Greaves (40700) for ContainTreasure */
, (33285, 9, 20413, 0, 0, 0, False) /* Create Scroll of Inferno Bait (20413) for ContainTreasure */
, (33285, 9, 43068, 0, 0, 0, False) /* Create Knorr Academy Helm (43068) for ContainTreasure */
, (33285, 9, 43828, 0, 0, 0, False) /* Create Sedgemail Leather Vest (43828) for ContainTreasure */
, (33285, 9, 20519, 0, 0, 0, False) /* Create Scroll of Finesse Weapon Ineptitude Other VII (20519) for ContainTreasure */
, (33285, 9, 44975, 0, 0, 0, False) /* Create Hood (44975) for ContainTreasure */
, (33285, 9, 31825, 0, 0, 0, False) /* Create Piercing Baton (31825) for ContainTreasure */
, (33285, 9, 3938, 0, 0, 0, False) /* Create Frost Morning Star (3938) for ContainTreasure */
, (33285, 9, 20544, 0, 0, 0, False) /* Create Scroll of Unfortunate Appraisal (20544) for ContainTreasure */
, (33285, 9, 45099, 0, 0, 0, False) /* Create Epee (45099) for ContainTreasure */
, (33285, 9, 127, 0, 0, 0, False) /* Create Pants (127) for ContainTreasure */
, (33285, 9, 21301, 0, 0, 0, False) /* Create Scroll of Blade Arc VII (21301) for ContainTreasure */
, (33285, 9, 3756, 0, 0, 0, False) /* Create Flaming Hand Axe (3756) for ContainTreasure */
, (33285, 9, 20538, 0, 0, 0, False) /* Create Scroll of Aura of Defense (20538) for ContainTreasure */
, (33285, 9, 27219, 0, 0, 0, False) /* Create Chiran Sandals (27219) for ContainTreasure */
, (33285, 9, 22166, 0, 0, 0, False) /* Create Flaming Quarter Staff (22166) for ContainTreasure */
, (33285, 9, 28620, 0, 0, 0, False) /* Create Alduressa Leggings (28620) for ContainTreasure */
, (33285, 9, 20572, 0, 0, 0, False) /* Create Scroll of Kaluhc's Blessing (20572) for ContainTreasure */
, (33285, 9, 20489, 0, 0, 0, False) /* Create Scroll of Battlemage's Boon (20489) for ContainTreasure */
, (33285, 9, 27215, 0, 0, 0, False) /* Create Chiran Coat (27215) for ContainTreasure */
, (33285, 9, 45250, 0, 0, 0, False) /* Create Scroll of Dirty Fighting Mastery Other VII (45250) for ContainTreasure */
, (33285, 9, 4194, 0, 0, 0, False) /* Create Lightning Cestus (4194) for ContainTreasure */
, (33285, 9, 49354, 0, 0, 0, False) /* Create Fire Moar Essence (100) (49354) for ContainTreasure */
, (33285, 9, 31822, 0, 0, 0, False) /* Create Aerbax's Defeat (31822) for ContainTreasure */
, (33285, 9, 313, 0, 0, 0, False) /* Create Dabus (313) for ContainTreasure */
, (33285, 9, 27217, 0, 0, 0, False) /* Create Chiran Helm (27217) for ContainTreasure */
, (33285, 9, 41044, 0, 0, 0, False) /* Create Flaming Magari Yari (41044) for ContainTreasure */
, (33285, 9, 8488, 0, 0, 0, False) /* Create Armet (8488) for ContainTreasure */
, (33285, 9, 45121, 0, 0, 0, False) /* Create Flaming Hand Wraps (45121) for ContainTreasure */
, (33285, 9, 31794, 0, 0, 0, False) /* Create Lancet (31794) for ContainTreasure */
, (33285, 9, 31791, 0, 0, 0, False) /* Create Flaming Stick (31791) for ContainTreasure */
, (33285, 9, 21151, 0, 0, 0, False) /* Create Covenant Bracers (21151) for ContainTreasure */
, (33285, 9, 41066, 0, 0, 0, False) /* Create Frost Khanda-handled Mace (41066) for ContainTreasure */
, (33285, 9, 20553, 0, 0, 0, False) /* Create Scroll of Harlune's Boon (20553) for ContainTreasure */
, (33285, 9, 40818, 0, 0, 0, False) /* Create Corsesca (40818) for ContainTreasure */
, (33285, 9, 20423, 0, 0, 0, False) /* Create Scroll of Archer's Bane (20423) for ContainTreasure */
, (33285, 9, 46882, 0, 0, 0, False) /* Create Aura of Spirit Drinker Other VII (46882) for ContainTreasure */
, (33285, 9, 105, 0, 0, 0, False) /* Create Studded Leather Sleeves (105) for ContainTreasure */
, (33285, 9, 27220, 0, 0, 0, False) /* Create Lorica Boots (27220) for ContainTreasure */
, (33285, 9, 348, 0, 0, 0, False) /* Create Spear (348) for ContainTreasure */
, (33285, 9, 31775, 0, 0, 0, False) /* Create Acid Board with Nail (31775) for ContainTreasure */
, (33285, 9, 324, 0, 0, 0, False) /* Create Kaskara (324) for ContainTreasure */
, (33285, 9, 20550, 0, 0, 0, False) /* Create Scroll of Ar-Pei's Boon (20550) for ContainTreasure */
, (33285, 9, 2366, 0, 0, 0, False) /* Create Orb (2366) for ContainTreasure */
, (33285, 9, 30606, 0, 0, 0, False) /* Create Bastone (30606) for ContainTreasure */
, (33285, 9, 20597, 0, 0, 0, False) /* Create Scroll of Koga's Boon (20597) for ContainTreasure */
, (33285, 9, 45116, 0, 0, 0, False) /* Create Flaming Hammer (45116) for ContainTreasure */
, (33285, 9, 49223, 0, 0, 0, False) /* Create Lightning Skeleton Bushi Essence (125) (49223) for ContainTreasure */
, (33285, 9, 415, 0, 0, 0, False) /* Create Chainmail Girth (415) for ContainTreasure */
, (33285, 9, 20570, 0, 0, 0, False) /* Create Scroll of Ignorance's Bliss (20570) for ContainTreasure */
, (33285, 9, 43048, 0, 0, 0, False) /* Create Knorr Academy Breastplate (43048) for ContainTreasure */
, (33285, 9, 20242, 0, 0, 0, False) /* Create Scroll of Brittle Bones (20242) for ContainTreasure */
, (33285, 9, 331, 0, 0, 0, False) /* Create Mace (331) for ContainTreasure */
, (33285, 9, 49469, 0, 0, 0, False) /* Create Scroll of Summoning Mastery Other VII (49469) for ContainTreasure */
, (33285, 9, 27223, 0, 0, 0, False) /* Create Lorica Helm (27223) for ContainTreasure */
, (33285, 9, 3916, 0, 0, 0, False) /* Create Frost Yari (3916) for ContainTreasure */
, (33285, 9, 49542, 0, 0, 0, False) /* Create Frost Phyntos Wasp Essence (150) (49542) for ContainTreasure */
, (33285, 9, 20241, 0, 0, 0, False) /* Create Scroll of Inner Calm (20241) for ContainTreasure */
, (33285, 9, 45113, 0, 0, 0, False) /* Create Hammer (45113) for ContainTreasure */
, (33285, 9, 41042, 0, 0, 0, False) /* Create Acid Magari Yari (41042) for ContainTreasure */
, (33285, 9, 22164, 0, 0, 0, False) /* Create Acid Quarter Staff (22164) for ContainTreasure */
, (33285, 9, 3882, 0, 0, 0, False) /* Create Stormwood Sword (3882) for ContainTreasure */
, (33285, 9, 40696, 0, 0, 0, False) /* Create Covenant Bracers (40696) for ContainTreasure */
, (33285, 9, 45306, 0, 0, 0, False) /* Create Scroll of Recklessness Mastery Self VII (45306) for ContainTreasure */
, (33285, 9, 3777, 0, 0, 0, False) /* Create Frost Dabus (3777) for ContainTreasure */
, (33285, 9, 2598, 0, 0, 0, False) /* Create Baggy Pants (2598) for ContainTreasure */
, (33285, 9, 20493, 0, 0, 0, False) /* Create Scroll of Tenaciousness (20493) for ContainTreasure */
, (33285, 9, 6004, 0, 0, 0, False) /* Create Koujia Leggings (6004) for ContainTreasure */
, (33285, 9, 20411, 0, 0, 0, False) /* Create Aura of Cragstone's Will (20411) for ContainTreasure */
, (33285, 9, 35, 0, 0, 0, False) /* Create Chainmail Basinet (35) for ContainTreasure */
, (33285, 9, 45100, 0, 0, 0, False) /* Create Acid Epee (45100) for ContainTreasure */
, (33285, 9, 45428, 0, 0, 0, False) /* Create Lightning Jambiya (45428) for ContainTreasure */
, (33285, 9, 40622, 0, 0, 0, False) /* Create Frost Nodachi (40622) for ContainTreasure */
, (33285, 9, 49339, 0, 0, 0, False) /* Create Acid Moar Essence (80) (49339) for ContainTreasure */
, (33285, 9, 20525, 0, 0, 0, False) /* Create Scroll of Broadside of a Barn (20525) for ContainTreasure */
, (33285, 9, 49292, 0, 0, 0, False) /* Create Lightning K'nath Essence (125) (49292) for ContainTreasure */
, (33285, 9, 48963, 0, 0, 0, False) /* Create Fire Elemental Essence (100) (48963) for ContainTreasure */
, (33285, 9, 29252, 0, 0, 0, False) /* Create Acid Atlatl (29252) for ContainTreasure */
, (33285, 9, 49384, 0, 0, 0, False) /* Create Fire Grievver Essence (150) (49384) for ContainTreasure */
, (33285, 9, 20445, 0, 0, 0, False) /* Create Scroll of The Spike (20445) for ContainTreasure */
, (33285, 9, 21308, 0, 0, 0, False) /* Create Scroll of Flame Arc VII (21308) for ContainTreasure */
, (33285, 9, 46, 0, 0, 0, False) /* Create Metal Cap (46) for ContainTreasure */
, (33285, 9, 49318, 0, 0, 0, False) /* Create Lightning Wisp Essence (80) (49318) for ContainTreasure */
, (33285, 9, 31803, 0, 0, 0, False) /* Create Frost Compound Bow (31803) for ContainTreasure */
, (33285, 9, 29255, 0, 0, 0, False) /* Create Fire Atlatl (29255) for ContainTreasure */
, (33285, 9, 31823, 0, 0, 0, False) /* Create Fire Baton (31823) for ContainTreasure */
, (33285, 9, 40820, 0, 0, 0, False) /* Create Lightning Corsesca (40820) for ContainTreasure */
, (33285, 9, 31807, 0, 0, 0, False) /* Create Blunt Compound Crossbow (31807) for ContainTreasure */
, (33285, 9, 362, 0, 0, 0, False) /* Create Yari (362) for ContainTreasure */
, (33285, 9, 49342, 0, 0, 0, False) /* Create Acid Moar Essence (150) (49342) for ContainTreasure */
, (33285, 9, 44855, 0, 0, 0, False) /* Create Halved Cloak (44855) for ContainTreasure */
, (33285, 9, 45432, 0, 0, 0, False) /* Create Acid Khanjar (45432) for ContainTreasure */
, (33285, 9, 49541, 0, 0, 0, False) /* Create Frost Phyntos Wasp Essence (125) (49541) for ContainTreasure */
, (33285, 9, 45413, 0, 0, 0, False) /* Create Lightning Spada (45413) for ContainTreasure */
, (33285, 9, 30607, 0, 0, 0, False) /* Create Lightning Bastone (30607) for ContainTreasure */
, (33285, 9, 40714, 0, 0, 0, False) /* Create Covenant Tassets (40714) for ContainTreasure */
, (33285, 9, 30559, 0, 0, 0, False) /* Create Flaming Hatchet (30559) for ContainTreasure */
, (33285, 9, 27230, 0, 0, 0, False) /* Create Nariyid Helm (27230) for ContainTreasure */
, (33285, 9, 20451, 0, 0, 0, False) /* Create Scroll of Sudden Frost (20451) for ContainTreasure */
, (33285, 9, 20478, 0, 0, 0, False) /* Create Scroll of Fiery Blessing (20478) for ContainTreasure */;
INSERT INTO `weenie_properties_palette` (`object_Id`, `sub_Palette_Id`, `offset`, `length`)
VALUES (33285, 67114479, 0, 0);
|
agpl-3.0
|
decamp/photosort
|
src/main/java/bits/photosort/TimestampReader.java
|
8819
|
/*
* Copyright (c) 2015. Philip DeCamp
* Released under the BSD 2-Clause License
* http://opensource.org/licenses/BSD-2-Clause
*/
package bits.photosort;
import java.io.*;
import java.nio.*;
import java.nio.channels.FileChannel;
import java.text.*;
public class TimestampReader {
public static void main(String[] args) {
try{
test1();
}catch(Exception ex) {
ex.printStackTrace();
}
}
private static void test1() throws Exception {
//String path = "/Volumes/DATA2/hsp_data/forgeorge/living_pics/039.jpg";
String path = "/Users/decamp/Photos/FILE0001.JPG";
ByteBuffer buf = bufferFile(new File(path));
long timestamp = readJpegTimestampMicros(buf);
System.out.println(timestamp);
if(timestamp != Long.MIN_VALUE) {
System.out.println(new java.util.Date(timestamp / 1000L));
}
}
private static ByteBuffer bufferFile(File file) throws IOException {
long size = file.length();
ByteBuffer buf = ByteBuffer.allocate((int)(size & 0x7FFFFFFF));
FileChannel chan = new FileInputStream(file).getChannel();
while(buf.remaining() > 0) {
int n = chan.read(buf);
if(n <= 0)
throw new IOException("Read operation failed.");
}
chan.close();
buf.flip();
return buf;
}
/**
*
* Once we have the ExifMarker data, we need to delve into the where the timestamp
* should be kept. This is a fairly grueling process because we have to go three layers
* deep.
*
* JPEG Marker
* |
* -- TIFF Header
* |
* -- IFD0
* |
* -- SubIFD
* |
* -- MakerNote IFD
* |
* -- Timestamp
*/
public static long readJpegTimestampMicros(ByteBuffer buf) throws IOException {
buf = readExifSegment(buf);
if(buf == null)
return Long.MIN_VALUE;
buf = readTiffHeader(buf);
if(buf == null)
return Long.MIN_VALUE;
int offset = findIfdTagOffset(buf, 0x8769);
if(offset < 0)
return Long.MIN_VALUE;
int off2 = findIfdTagOffset(buf, 0x9003, offset);
if(off2 >= 0) {
if(buf.position() + off2 + 20 > buf.limit())
return -1;
DateFormat format = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
buf.position(buf.position() + off2);
byte[] bytes = new byte[20];
buf.get(bytes);
String dateString = new String(bytes);
try{
return format.parse(dateString).getTime() * 1000L;
}catch(ParseException ex) {
return Long.MIN_VALUE;
}
}
offset = findIfdTagOffset(buf, 0x927C, offset);
if(offset < 0)
return Long.MIN_VALUE;
offset = findIfdTagOffset(buf, 0xFDE8, offset);
if(offset < 0)
return Long.MIN_VALUE;
if(offset + 8 > buf.remaining())
return Long.MIN_VALUE;
buf.position(buf.position() + offset);
int sec = buf.getInt();
int usec = buf.getInt();
return sec * 1000000L + usec;
}
/**
* @param buf Buffer containing JPEG.
* @return buffer containing EXIF segment.
*/
private static ByteBuffer readExifSegment(ByteBuffer buf) {
buf = buf.duplicate();
//Loop through each byte in JPEG and find markers.
while(buf.remaining() >= 4) {
int b = (buf.get() & 0xFF);
//Markers always start with 0xFF. However, they may start with multiple 0xFFs.
while(b == 0xFF) {
if(buf.remaining() < 3)
return null;
b = (buf.get() & 0xFF);
//Another 0xFF means the marker is still starting.
//0x00 means the previous 0xFF was not a marker.
//0xD8 and 0xD9 indicate SOE and EOF (StartOfImage or EndOfImage), which are not segments.
if(b == 0xFF || b == 0x00 || b == 0xD8 || b == 0xD9)
continue;
//After the marker (0xFF + one-byte ID), the next two bytes indicate the segment length.
//The segment length includes itself (two bytes), but not the two-byte marker.
int length = (buf.getShort() & 0xFFFF) - 2;
//Check if we have all the data.
if(length > buf.remaining())
return null;
//Check if this is the exif segment.
if(b == 0xE1) {
buf.limit(buf.position() + length);
return buf;
}
buf.position(buf.position() + length);
}
}
return null;
}
/**
* @param buf Buffer containing EXIF segment.
* @return ByteBuffer containing IFD0.
*/
private static ByteBuffer readTiffHeader(ByteBuffer buf) {
if(buf.remaining() < 6)
return null;
buf = buf.duplicate();
if(buf.get() == 'E' && buf.get() == 'x' && buf.get() == 'i' && buf.get() == 'f' &&
buf.get() == 0 && buf.get() == 0)
{
return buf;
}
return null;
}
/**
* @param buf Buffer containing IFD0
* @return timestamp micros, or Long.MIN_VALUE if not found.
*/
private static long findTimestampMicros(ByteBuffer buf) {
int offset = findIfdTagOffset(buf, 0x8769);
if(offset < 0)
return Long.MIN_VALUE;
offset = findIfdTagOffset(buf, 0x927C, offset);
if(offset < 0)
return Long.MIN_VALUE;
offset = findIfdTagOffset(buf, 0xFDE8, offset);
if(offset < 0)
return Long.MIN_VALUE;
if(offset + 8 > buf.remaining())
return Long.MIN_VALUE;
buf = buf.duplicate();
buf.position(buf.position() + offset);
int sec = buf.getInt();
int usec = buf.getInt();
return sec * 1000000L + usec;
}
/**
* @param buf Buffer containing IFD0
* @param tag Tag of entry to locate.
* @return offset of entry, or -1 if not found.
*/
private static int findIfdTagOffset(ByteBuffer buf, int tag) {
return findIfdTagOffset(buf, tag, -1);
}
/**
* @param buf Buffer containing IFD0
* @param tag Tag of entry to locate.
* @param offset Offset of index to use, or -1 if first index should be used.
* @return offset to entry, or -1 if not found.
*/
private static int findIfdTagOffset(ByteBuffer buf, int tag, int offset) {
if(buf.remaining() < 8)
return -1;
buf = buf.duplicate();
int start = buf.position();
int length = buf.remaining();
//2-byte indicator of byte alignment indicator.
//MM means Motoral (Big-Endian).
//II means Intel (Little-Endian).
{
byte order = buf.get();
if(order != buf.get())
return -1;
if(order == (byte)0x4D) {
buf.order(ByteOrder.BIG_ENDIAN);
}else if(order == (byte)0x49) {
buf.order(ByteOrder.LITTLE_ENDIAN);
}else{
return -1;
}
}
//2-byte constant.
if((buf.getShort() & 0xFFFF) != 0x002A)
return -1;
//If no offset is given, use 4-byte offset to SubIFD tag.
if(offset < 0)
offset = buf.getInt();
//Check offset validity.
if(offset < 0 || length < offset + 2)
return -1;
//Get number of entries.
buf.position(start + offset);
int entryCount = (buf.getShort() & 0xFFFF);
//Check length validity.
if(length < offset + 2 + 12 * entryCount)
return -1;
//Find the entry.
for(int i = 0; i < entryCount; i++) {
buf.position(start + offset + 2 + i * 12);
if((buf.getShort() & 0xFFFF) == tag) {
buf.position(start + offset + 2 + i * 12 + 8);
return buf.getInt();
}
}
return -1;
}
}
|
agpl-3.0
|
vroland/SimpleAnalyzer
|
doc/html/search/enumvalues_75.js
|
306
|
var searchData=
[
['unknown',['UNKNOWN',['../classtetgenmesh.xhtml#a1d02bed7b59566d57b896776d78a6b25a51233a7db87ef44baab2026b0ebdf22f',1,'tetgenmesh']]],
['unusedvertex',['UNUSEDVERTEX',['../classtetgenmesh.xhtml#ad0458f823a5eef2de89c7fae067aa2aca1d0b671fcad449d30b826305df861a52',1,'tetgenmesh']]]
];
|
agpl-3.0
|
caleboau2012/edusupport
|
test/cache/smarty/templates_c/%%19^19B^19BA849F%%CasesDetailViewpriority.tpl.php
|
805
|
<?php /* Smarty version 2.6.11, created on 2015-06-17 13:35:10
compiled from cache/modules/AOW_WorkFlow/CasesDetailViewpriority.tpl */ ?>
<?php if (is_string ( $this->_tpl_vars['fields']['priority']['options'] )): ?>
<input type="hidden" class="sugar_field" id="<?php echo $this->_tpl_vars['fields']['priority']['name']; ?>
" value="<?php echo $this->_tpl_vars['fields']['priority']['options']; ?>
">
<?php echo $this->_tpl_vars['fields']['priority']['options']; ?>
<?php else: ?>
<input type="hidden" class="sugar_field" id="<?php echo $this->_tpl_vars['fields']['priority']['name']; ?>
" value="<?php echo $this->_tpl_vars['fields']['priority']['value']; ?>
">
<?php echo $this->_tpl_vars['fields']['priority']['options'][$this->_tpl_vars['fields']['priority']['value']]; ?>
<?php endif; ?>
|
agpl-3.0
|
mRokita/DPLib
|
docs_src/_build/html/source/modules.html
|
5090
|
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>dplib — DPLib 1.5 documentation</title>
<script type="text/javascript" src="../_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> DPLib
</a>
<div class="version">
1.5
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../includelicense.html">LICENSE</a></li>
<li class="toctree-l1"><a class="reference internal" href="../gettingstarted.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../includeme.html">README</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">DPLib</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> »</li>
<li>dplib</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/source/modules.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="dplib">
<h1>dplib<a class="headerlink" href="#dplib" title="Permalink to this headline">¶</a></h1>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="dplib.html">dplib package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="dplib.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="dplib.html#module-dplib.dplogin">dplib.dplogin module</a></li>
<li class="toctree-l2"><a class="reference internal" href="dplib.html#module-dplib.parse">dplib.parse module</a></li>
<li class="toctree-l2"><a class="reference internal" href="dplib.html#module-dplib.server">dplib.server module</a></li>
<li class="toctree-l2"><a class="reference internal" href="dplib.html#module-dplib">Module contents</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2017-2018, Michał Rokita
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>
|
agpl-3.0
|
ice1000/OI-codes
|
codewars/1-100/find-all-possible-number-combos-that-sum-to-a-number.hs-optimized.hs
|
168
|
module Codewars.Kata.Combos where
combos :: Int -> [[Int]]
combos n = f 1 n
where f u n = if u <= n then [n] : ([u .. n] >>= \x -> (x :) <$> f x (n - x)) else []
--
|
agpl-3.0
|
martinhoefling/go-dmarc-report
|
acquire/unpack.go
|
983
|
package acquire
import (
"archive/zip"
"bytes"
"compress/gzip"
"fmt"
"io/ioutil"
"strings"
)
func unpackReport(filename string, data []byte) ([]byte, error) {
dataBuffer := bytes.NewBuffer(data)
if strings.HasSuffix(filename, ".gz") {
file, err := gzip.NewReader(dataBuffer)
if err != nil {
return nil, err
}
return ioutil.ReadAll(file)
}
if strings.HasSuffix(filename, ".zip") {
bt, err := ioutil.ReadAll(dataBuffer)
if err != nil {
return nil, err
}
r, err := zip.NewReader(bytes.NewReader(bt), int64(len(bt)))
if err != nil {
return nil, err
}
if len(r.File) != 1 {
return nil, fmt.Errorf("Not exactly one file in zip %s", filename)
}
f := r.File[0]
if !strings.HasSuffix(f.Name, ".xml") {
return nil, fmt.Errorf("Not an xml file in zip %s", filename)
}
file, err3 := f.Open()
if err3 != nil {
return nil, err3
}
return ioutil.ReadAll(file)
}
return nil, fmt.Errorf("Unknown extension of file %s", filename)
}
|
agpl-3.0
|
lutris/website
|
tosec/models.py
|
1177
|
"""TOSEC models"""
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=256)
description = models.CharField(max_length=256)
category = models.CharField(max_length=256)
version = models.CharField(max_length=32)
author = models.CharField(max_length=128)
section = models.CharField(max_length=12, default='TOSEC')
def __str__(self):
return self.name
class Meta:
verbose_name_plural = 'Categories'
ordering = ('name', )
class Game(models.Model):
category = models.ForeignKey(Category, on_delete=models.CASCADE)
name = models.CharField(max_length=255)
description = models.CharField(max_length=255)
def __str__(self):
return self.name
class Meta:
ordering = ('category', 'name')
class Rom(models.Model):
game = models.ForeignKey(Game, related_name='roms', on_delete=models.CASCADE)
name = models.CharField(max_length=255)
size = models.IntegerField()
crc = models.CharField(max_length=16)
md5 = models.CharField(max_length=32)
sha1 = models.CharField(max_length=64)
def __str__(self):
return self.name
|
agpl-3.0
|
Implem/Implem.Pleasanter
|
Implem.Pleasanter/Styles/Plugins/themes/trontastic/custom.css
|
491
|
.nav-site {
background-color: white;
border: solid 2px silver;
}
.nav-site.sites {
background-color: white;
border: solid 2px #9fda58;
}
.nav-site .heading {
background-color: #9fda58;
border: solid 1px #9fda58;
}
#NavigationMenu .menu > li > a {
color: white;
}
.control-selectable .ui-selecting {
color: black;
background: #9fda58;
}
.control-selectable .ui-selected {
color: black;
background: #9fda58;
}
|
agpl-3.0
|
australiangreens/au.org.greens.raisely
|
tests/phpunit/CRM/Raisely/RaiselyTest.php
|
3652
|
<?php
use Civi\Test\HeadlessInterface;
use Civi\Test\HookInterface;
use Civi\Test\TransactionalInterface;
/**
* RaiselyTest - Unit tests for the CiviCRM-Raisely web callback extension
*
* Tips:
* - With HookInterface, you may implement CiviCRM hooks directly in the test class.
* Simply create corresponding functions (e.g. "hook_civicrm_post(...)" or similar).
* - With TransactionalInterface, any data changes made by setUp() or test****() functions will
* rollback automatically -- as long as you don't manipulate schema or truncate tables.
* If this test needs to manipulate schema or truncate tables, then either:
* a. Do all that using setupHeadless() and Civi\Test.
* b. Disable TransactionalInterface, and handle all setup/teardown yourself.
*
* @group headless
*/
class CRM_Raisely_RaiselyTest extends \PHPUnit_Framework_TestCase implements HeadlessInterface, HookInterface, TransactionalInterface {
public function setUpHeadless() {
// Civi\Test has many helpers, like install(), uninstall(), sql(), and sqlFile().
// See: https://github.com/civicrm/org.civicrm.testapalooza/blob/master/civi-test.md
return \Civi\Test::headless()
->installMe(__DIR__)
->apply();
}
public function setUp() {
parent::setUp();
}
public function tearDown() {
parent::tearDown();
}
// Define our test data for several tests
private $test_data = [
'data' => [
'result' => [
'metadata' => [
'first_name' => 'Wonder',
'last_name' => 'Woman',
'email' => 'wonderwoman@justice.league',
'street_address' => '1 Temple Way',
'postal_code' => '2000',
'city' => 'Themyscira',
'state_province' => 'Paradise Islands',
'country' => 'GR',
'contact_type' => 'Individual',
'profile_url' => 'https://themyscira.raisely.com/justiceleague',
'public.donation_amount' => '50.00',
],
'id' => 'ch_1ARxTvH4f1FCRwDmBcQn0iPC',
'status' => 'succeeded',
'description' => 'Donation (79082) of AUD50 from Wonder Woman (153242) to Dummy Person (80298) for Dummy Campaign (1364)',
'currency' => 'aud',
'created' => 1496816247,
'amount' => '5000',
],
],
/**
* Test: _parseDonor returns a well-formed donor array
*/
public function testSuccessfulParseDonor() {
$expected = $test_data['data']['result']['metadata'];
unset($expected['profile_url']);
unset($expected['public.donation_amount']);
$donor = CRM_Raisely_Page_Raisely::_parseDonor($test_data);
$this->assertEquals($expected, $donor);
}
/**
* Test: _parseDonor returns NULL when required fields are missing
*/
public function testParseDonorMissingFields() {
unset($test_data['data']['result']['metadata']['first_name'];
$donor = CRM_Raisely_Page_Raisely::_parseDonor($test_data);
$this->assertNull($donor);
}
/**
* Test: _parseContribution returns a well-formed donor array
*/
public function testSuccessfulParseContribution() {
$expected = $test_data['data']['result'];
unset($expected['metadata']);
$contribution = CRM_Raisely_Page_Raisely::_parseContribution($test_data);
$this->assertEquals($expected, $contribution);
}
/**
* Test: _parseContribution returns NULL when required fields are missing
*/
public function testParseContributionMissingFields() {
$expected = $test_data['data']['result'];
unset($expected['amount']);
$contribution = CRM_Raisely_Page_Raisely::_parseContribution($test_data);
$this->assertNull($contribution);
}
}
|
agpl-3.0
|
Oblady/web-task-runner-for-pentaho
|
config/routes.php
|
2500
|
<?php
/**
* Routes configuration
*
* In this file, you set up routes to your controllers and their actions.
* Routes are very important mechanism that allows you to freely connect
* different URLs to chosen controllers and their actions (functions).
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
use Cake\Core\Plugin;
use Cake\Routing\Router;
/**
* The default class to use for all routes
*
* The following route classes are supplied with CakePHP and are appropriate
* to set as the default:
*
* - Route
* - InflectedRoute
* - DashedRoute
*
* If no call is made to `Router::defaultRouteClass()`, the class used is
* `Route` (`Cake\Routing\Route\Route`)
*
* Note that `Route` does not do any inflections on URLs which will result in
* inconsistently cased URLs when used with `:plugin`, `:controller` and
* `:action` markers.
*
*/
Router::defaultRouteClass('DashedRoute');
Router::scope('/', function ($routes) {
$routes->connect('/', ['controller' => 'Migrations', 'action' => 'index']);
/**
* ...and connect the rest of 'Pages' controller's URLs.
*/
$routes->connect('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
/**
* Connect catchall routes for all controllers.
*
* Using the argument `DashedRoute`, the `fallbacks` method is a shortcut for
* `$routes->connect('/:controller', ['action' => 'index'], ['routeClass' => 'DashedRoute']);`
* `$routes->connect('/:controller/:action/*', [], ['routeClass' => 'DashedRoute']);`
*
* Any route class can be used with this method, such as:
* - DashedRoute
* - InflectedRoute
* - Route
* - Or your own route class
*
* You can remove these routes once you've connected the
* routes you want in your application.
*/
$routes->fallbacks('DashedRoute');
});
/**
* Load all plugin routes. See the Plugin documentation on
* how to customize the loading of plugin routes.
*/
Plugin::routes();
|
agpl-3.0
|
cris-iisc/mpc-primitives
|
crislib/libscapi/lib/boost_1_64_0/libs/geometry/doc/html/geometry/examples/example_source_code__adapting_a_legacy_geometry_object_model.html
|
70784
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Example source code: Adapting a legacy geometry object model</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Geometry">
<link rel="up" href="../examples.html" title="Examples">
<link rel="prev" href="example__adapting_a_legacy_geometry_object_model.html" title="Example: Adapting a legacy geometry object model">
<link rel="next" href="../release_notes.html" title="Release Notes">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="example__adapting_a_legacy_geometry_object_model.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../release_notes.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model"></a><a class="link" href="example_source_code__adapting_a_legacy_geometry_object_model.html" title="Example source code: Adapting a legacy geometry object model">Example
source code: Adapting a legacy geometry object model</a>
</h3></div></div></div>
<h3>
<a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.h0"></a>
<span class="phrase"><a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.adaption_of_qpoint"></a></span><a class="link" href="example_source_code__adapting_a_legacy_geometry_object_model.html#geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.adaption_of_qpoint">Adaption
of QPoint</a>
</h3>
<a name="adaption_of_qpoint_source_code"></a><pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">geometry</span>
<span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">traits</span>
<span class="special">{</span>
<span class="comment">// Adapt QPoint to Boost.Geometry</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">tag</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">></span>
<span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">point_tag</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">coordinate_type</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">></span>
<span class="special">{</span> <span class="keyword">typedef</span> <span class="keyword">double</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">coordinate_system</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">></span>
<span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">cs</span><span class="special">::</span><span class="identifier">cartesian</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">dimension</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">></span> <span class="special">:</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">mpl</span><span class="special">::</span><span class="identifier">int_</span><span class="special"><</span><span class="number">2</span><span class="special">></span> <span class="special">{};</span>
<span class="keyword">template</span><span class="special"><></span>
<span class="keyword">struct</span> <span class="identifier">access</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">,</span> <span class="number">0</span><span class="special">></span>
<span class="special">{</span>
<span class="keyword">static</span> <span class="identifier">QPoint</span><span class="special">::</span><span class="keyword">double</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">QPoint</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">p</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">x</span><span class="special">;</span>
<span class="special">}</span>
<span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">set</span><span class="special">(</span><span class="identifier">QPoint</span><span class="special">&</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">QPoint</span><span class="special">::</span><span class="keyword">double</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">value</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">p</span><span class="special">.</span><span class="identifier">x</span> <span class="special">=</span> <span class="identifier">value</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span>
<span class="keyword">struct</span> <span class="identifier">access</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">,</span> <span class="number">1</span><span class="special">></span>
<span class="special">{</span>
<span class="keyword">static</span> <span class="identifier">QPoint</span><span class="special">::</span><span class="keyword">double</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">QPoint</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">p</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">p</span><span class="special">.</span><span class="identifier">y</span><span class="special">;</span>
<span class="special">}</span>
<span class="keyword">static</span> <span class="keyword">void</span> <span class="identifier">set</span><span class="special">(</span><span class="identifier">QPoint</span><span class="special">&</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">QPoint</span><span class="special">::</span><span class="keyword">double</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">value</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">p</span><span class="special">.</span><span class="identifier">y</span> <span class="special">=</span> <span class="identifier">value</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">}</span> <span class="comment">// namespace boost::geometry::traits</span>
</pre>
<h3>
<a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.h1"></a>
<span class="phrase"><a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.adaption_of_qlinestring"></a></span><a class="link" href="example_source_code__adapting_a_legacy_geometry_object_model.html#geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.adaption_of_qlinestring">Adaption
of QLineString</a>
</h3>
<a name="adaption_of_qlinestring_source_code"></a><pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">geometry</span>
<span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">traits</span>
<span class="special">{</span>
<span class="keyword">template</span><span class="special"><></span>
<span class="keyword">struct</span> <span class="identifier">tag</span><span class="special"><</span><span class="identifier">QLineString</span><span class="special">></span>
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">linestring_tag</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">}</span> <span class="comment">// namespace boost::geometry::traits</span>
</pre>
<h4>
<a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.h2"></a>
<span class="phrase"><a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.boost_range_for_qlinestring"></a></span><a class="link" href="example_source_code__adapting_a_legacy_geometry_object_model.html#geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.boost_range_for_qlinestring">Boost.Range
for QLineString</a>
</h4>
<a name="adaption_of_qlinestring_range_source_code"></a><pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">range</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="keyword">template</span> <span class="special"><></span>
<span class="keyword">struct</span> <span class="identifier">range_iterator</span><span class="special"><</span><span class="identifier">QLineString</span><span class="special">></span>
<span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">*>::</span><span class="identifier">iterator</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span>
<span class="keyword">struct</span> <span class="identifier">range_const_iterator</span><span class="special"><</span><span class="identifier">QLineString</span><span class="special">></span>
<span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">*>::</span><span class="identifier">const_iterator</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="special">}</span>
<span class="keyword">inline</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">*>::</span><span class="identifier">iterator</span>
<span class="identifier">range_begin</span><span class="special">(</span><span class="identifier">QLineString</span><span class="special">&</span> <span class="identifier">qls</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">qls</span><span class="special">.</span><span class="identifier">points</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();}</span>
<span class="keyword">inline</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">*>::</span><span class="identifier">iterator</span>
<span class="identifier">range_end</span><span class="special">(</span><span class="identifier">QLineString</span><span class="special">&</span> <span class="identifier">qls</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">qls</span><span class="special">.</span><span class="identifier">points</span><span class="special">.</span><span class="identifier">end</span><span class="special">();}</span>
<span class="keyword">inline</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">*>::</span><span class="identifier">const_iterator</span>
<span class="identifier">range_begin</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">QLineString</span><span class="special">&</span> <span class="identifier">qls</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">qls</span><span class="special">.</span><span class="identifier">points</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();}</span>
<span class="keyword">inline</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">QPoint</span><span class="special">*>::</span><span class="identifier">const_iterator</span>
<span class="identifier">range_end</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">QLineString</span><span class="special">&</span> <span class="identifier">qls</span><span class="special">)</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">qls</span><span class="special">.</span><span class="identifier">points</span><span class="special">.</span><span class="identifier">end</span><span class="special">();}</span>
</pre>
<h3>
<a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.h3"></a>
<span class="phrase"><a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.adaption_of_qring"></a></span><a class="link" href="example_source_code__adapting_a_legacy_geometry_object_model.html#geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.adaption_of_qring">Adaption
of QRing</a>
</h3>
<a name="adaption_of_qring_source_code"></a><pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">geometry</span>
<span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">traits</span>
<span class="special">{</span>
<span class="keyword">template</span><span class="special"><></span>
<span class="keyword">struct</span> <span class="identifier">tag</span><span class="special"><</span><span class="identifier">QRing</span><span class="special">></span>
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="identifier">ring_tag</span> <span class="identifier">type</span><span class="special">;</span>
<span class="special">};</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">}</span> <span class="comment">// namespace boost::geometry::traits</span>
</pre>
<h4>
<a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.h4"></a>
<span class="phrase"><a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.boost_iterator_for_qring"></a></span><a class="link" href="example_source_code__adapting_a_legacy_geometry_object_model.html#geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.boost_iterator_for_qring">Boost.Iterator
for QRing</a>
</h4>
<a name="adaption_of_qring_iterator_source_code"></a><pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">iterator</span><span class="special">/</span><span class="identifier">iterator_facade</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="comment">/* Custom iterator type that flattens a 2D array into a 1D array */</span>
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">I</span><span class="special">,</span> <span class="comment">// Line iterator type</span>
<span class="keyword">class</span> <span class="identifier">R</span> <span class="comment">// Point reference type</span>
<span class="special">></span>
<span class="keyword">class</span> <span class="identifier">RingIteratorImpl</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">iterator_facade</span><span class="special"><</span>
<span class="identifier">RingIteratorImpl</span><span class="special"><</span><span class="identifier">I</span><span class="special">,</span><span class="identifier">R</span><span class="special">>,</span> <span class="identifier">R</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">random_access_iterator_tag</span><span class="special">,</span> <span class="identifier">R</span><span class="special">></span> <span class="comment">//new traversal tag boost::random_access_traversal_tag</span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="identifier">RingIteratorImpl</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">pointIndex_</span><span class="special">(</span><span class="number">0</span><span class="special">)</span>
<span class="special">{</span>
<span class="special">}</span>
<span class="keyword">explicit</span> <span class="identifier">RingIteratorImpl</span><span class="special">(</span><span class="identifier">I</span> <span class="identifier">lineStringIterCurrent</span><span class="special">)</span>
<span class="special">:</span> <span class="identifier">lineStringIterCurrent_</span><span class="special">(</span><span class="identifier">lineStringIterCurrent</span><span class="special">),</span> <span class="identifier">pointIndex_</span><span class="special">(</span><span class="number">0</span><span class="special">)</span>
<span class="special">{</span>
<span class="special">}</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">OtherI</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">OtherR</span><span class="special">></span>
<span class="identifier">RingIteratorImpl</span><span class="special">(</span><span class="identifier">RingIteratorImpl</span><span class="special"><</span><span class="identifier">OtherI</span><span class="special">,</span> <span class="identifier">OtherR</span><span class="special">></span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">other</span><span class="special">)</span> <span class="special">:</span>
<span class="identifier">lineStringIterCurrent_</span><span class="special">(</span><span class="identifier">other</span><span class="special">.</span><span class="identifier">getLineStrIt</span><span class="special">()),</span> <span class="identifier">pointIndex_</span><span class="special">(</span><span class="identifier">other</span><span class="special">.</span><span class="identifier">getPointIdx</span><span class="special">())</span>
<span class="special">{</span>
<span class="special">}</span>
<span class="identifier">I</span> <span class="identifier">getLineStrIt</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">lineStringIterCurrent_</span><span class="special">;}</span>
<span class="keyword">bool</span> <span class="identifier">isEmpty</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">isEmpty</span><span class="special">;}</span>
<span class="identifier">size_t</span> <span class="identifier">getPointIdx</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">pointIndex_</span><span class="special">;}</span>
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">iterator_facade</span><span class="special"><</span><span class="identifier">RingIteratorImpl</span><span class="special"><</span><span class="identifier">I</span><span class="special">,</span><span class="identifier">R</span><span class="special">>,</span> <span class="identifier">R</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">random_access_iterator_tag</span><span class="special">,</span> <span class="identifier">R</span><span class="special">>::</span><span class="identifier">difference_type</span> <span class="identifier">difference_type</span><span class="special">;</span>
<span class="keyword">private</span><span class="special">:</span>
<span class="keyword">friend</span> <span class="keyword">class</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">iterator_core_access</span><span class="special">;</span>
<span class="keyword">void</span> <span class="identifier">increment</span><span class="special">()</span>
<span class="special">{</span>
<span class="special">++</span><span class="identifier">pointIndex_</span><span class="special">;</span>
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">pointIndex_</span> <span class="special">>=</span> <span class="special">(*</span><span class="identifier">lineStringIterCurrent_</span><span class="special">)-></span><span class="identifier">points</span><span class="special">.</span><span class="identifier">size</span><span class="special">())</span>
<span class="special">{</span>
<span class="special">++</span><span class="identifier">lineStringIterCurrent_</span><span class="special">;</span>
<span class="identifier">pointIndex_</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="keyword">void</span> <span class="identifier">decrement</span><span class="special">()</span>
<span class="special">{</span>
<span class="keyword">if</span><span class="special">(</span><span class="identifier">pointIndex_</span><span class="special">></span><span class="number">0</span><span class="special">)</span>
<span class="special">{</span>
<span class="special">--</span><span class="identifier">pointIndex_</span><span class="special">;</span>
<span class="special">}</span>
<span class="keyword">else</span>
<span class="special">{</span>
<span class="special">--</span><span class="identifier">lineStringIterCurrent_</span><span class="special">;</span>
<span class="identifier">pointIndex_</span> <span class="special">=</span> <span class="special">(*</span><span class="identifier">lineStringIterCurrent_</span><span class="special">)-></span><span class="identifier">points</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="keyword">void</span> <span class="identifier">advance</span><span class="special">(</span><span class="identifier">difference_type</span> <span class="identifier">n</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">difference_type</span> <span class="identifier">counter</span> <span class="special">=</span> <span class="identifier">n</span><span class="special">;</span>
<span class="identifier">difference_type</span> <span class="identifier">maxPointIndex</span><span class="special">,</span> <span class="identifier">remainderPointIndex</span><span class="special">;</span>
<span class="keyword">while</span><span class="special">(</span><span class="identifier">counter</span><span class="special">></span><span class="number">0</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">maxPointIndex</span> <span class="special">=</span> <span class="special">(*</span><span class="identifier">lineStringIterCurrent_</span><span class="special">)-></span><span class="identifier">points</span><span class="special">.</span><span class="identifier">size</span><span class="special">(),</span>
<span class="identifier">remainderPointIndex</span> <span class="special">=</span> <span class="identifier">maxPointIndex</span> <span class="special">-</span> <span class="identifier">pointIndex_</span><span class="special">;</span>
<span class="keyword">if</span><span class="special">(</span><span class="identifier">counter</span><span class="special">></span><span class="identifier">remainderPointIndex</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">counter</span> <span class="special">-=</span> <span class="identifier">remainderPointIndex</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">lineStringIterCurrent_</span><span class="special">;</span>
<span class="special">}</span>
<span class="keyword">else</span> <span class="comment">// (counter<=remainderPointIndex)</span>
<span class="special">{</span>
<span class="identifier">counter</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
<span class="identifier">pointIndex_</span> <span class="special">=</span> <span class="identifier">remainderPointIndex</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="identifier">difference_type</span> <span class="identifier">distance_to</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">RingIteratorImpl</span><span class="special">&</span> <span class="identifier">other</span><span class="special">)</span> <span class="keyword">const</span>
<span class="special">{</span>
<span class="identifier">I</span> <span class="identifier">currentLineStringIter</span> <span class="special">=</span> <span class="identifier">getLineStrIt</span><span class="special">();</span>
<span class="identifier">I</span> <span class="identifier">otherLineStringIter</span> <span class="special">=</span> <span class="identifier">other</span><span class="special">.</span><span class="identifier">getLineStrIt</span><span class="special">();</span>
<span class="identifier">difference_type</span> <span class="identifier">count</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
<span class="identifier">difference_type</span> <span class="identifier">distance_to_other</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">currentLineStringIter</span><span class="special">,</span> <span class="identifier">otherLineStringIter</span><span class="special">);</span>
<span class="keyword">if</span><span class="special">(</span><span class="identifier">distance_to_other</span> <span class="special"><</span> <span class="number">0</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">count</span> <span class="special">+=</span> <span class="identifier">pointIndex_</span><span class="special">;</span>
<span class="keyword">while</span><span class="special">(</span><span class="identifier">distance_to_other</span> <span class="special"><</span> <span class="number">0</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">QLineString</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">ls</span> <span class="special">=</span> <span class="special">*</span><span class="identifier">otherLineStringIter</span><span class="special">;</span>
<span class="identifier">count</span> <span class="special">-=</span> <span class="identifier">ls</span><span class="special">-></span><span class="identifier">points</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span>
<span class="special">++</span><span class="identifier">otherLineStringIter</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">distance_to_other</span><span class="special">;</span>
<span class="special">}</span>
<span class="identifier">assert</span><span class="special">(</span><span class="identifier">otherLineStringIter</span><span class="special">==</span><span class="identifier">currentLineStringIter</span><span class="special">);</span>
<span class="special">}</span>
<span class="keyword">else</span> <span class="keyword">if</span><span class="special">(</span><span class="identifier">distance_to_other</span> <span class="special">></span> <span class="number">0</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">count</span> <span class="special">-=</span> <span class="identifier">pointIndex_</span><span class="special">;</span>
<span class="keyword">while</span><span class="special">(</span><span class="identifier">distance_to_other</span> <span class="special"><</span> <span class="number">0</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">QLineString</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">ls</span> <span class="special">=</span> <span class="special">*</span><span class="identifier">currentLineStringIter</span><span class="special">;</span>
<span class="identifier">count</span> <span class="special">+=</span> <span class="identifier">ls</span><span class="special">-></span><span class="identifier">points</span><span class="special">.</span><span class="identifier">size</span><span class="special">();</span>
<span class="special">++</span><span class="identifier">currentLineStringIter</span><span class="special">;</span>
<span class="special">--</span><span class="identifier">distance_to_other</span><span class="special">;</span>
<span class="special">}</span>
<span class="identifier">assert</span><span class="special">(</span><span class="identifier">otherLineStringIter</span><span class="special">==</span><span class="identifier">currentLineStringIter</span><span class="special">);</span>
<span class="special">}</span>
<span class="keyword">else</span>
<span class="special">{</span>
<span class="identifier">count</span> <span class="special">=</span> <span class="identifier">pointIndex_</span> <span class="special">-</span> <span class="identifier">other</span><span class="special">.</span><span class="identifier">getPointIdx</span><span class="special">();</span>
<span class="special">}</span>
<span class="keyword">return</span> <span class="identifier">count</span><span class="special">;</span>
<span class="special">}</span>
<span class="keyword">bool</span> <span class="identifier">equal</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">RingIteratorImpl</span><span class="special">&</span> <span class="identifier">other</span><span class="special">)</span> <span class="keyword">const</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="special">(</span><span class="identifier">lineStringIterCurrent_</span> <span class="special">==</span> <span class="identifier">other</span><span class="special">.</span><span class="identifier">getLineStrIt</span><span class="special">())</span> <span class="special">&&</span>
<span class="special">(</span><span class="identifier">pointIndex_</span> <span class="special">==</span> <span class="identifier">other</span><span class="special">.</span><span class="identifier">getPointIdx</span><span class="special">());</span>
<span class="special">}</span>
<span class="identifier">R</span> <span class="identifier">dereference</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="special">*(*</span><span class="identifier">lineStringIterCurrent_</span><span class="special">)-></span><span class="identifier">points</span><span class="special">[</span><span class="identifier">pointIndex_</span><span class="special">];}</span>
<span class="identifier">I</span> <span class="identifier">lineStringIterCurrent_</span><span class="special">;</span>
<span class="keyword">bool</span> <span class="identifier">empty</span><span class="special">;</span>
<span class="identifier">size_t</span> <span class="identifier">pointIndex_</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<h4>
<a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.h5"></a>
<span class="phrase"><a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.boost_range_for_qring"></a></span><a class="link" href="example_source_code__adapting_a_legacy_geometry_object_model.html#geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.boost_range_for_qring">Boost.Range
for QRing</a>
</h4>
<a name="adaption_of_qring_range_source_code"></a><pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">RingIteratorImpl</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">QLineString</span><span class="special">*>::</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">QPoint</span><span class="special">></span> <span class="identifier">RingIterator</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">RingIteratorImpl</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">QLineString</span><span class="special">*>::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">QPoint</span><span class="special">></span> <span class="identifier">ConstRingIterator</span><span class="special">;</span>
<span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="comment">// Specialize metafunctions. We must include the range.hpp header.</span>
<span class="comment">// We must open the 'boost' namespace.</span>
<span class="keyword">template</span> <span class="special"><></span>
<span class="keyword">struct</span> <span class="identifier">range_iterator</span><span class="special"><</span><span class="identifier">QRing</span><span class="special">></span>
<span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">RingIterator</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span>
<span class="keyword">struct</span> <span class="identifier">range_const_iterator</span><span class="special"><</span><span class="identifier">QRing</span><span class="special">></span>
<span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">ConstRingIterator</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="special">}</span> <span class="comment">// namespace 'boost'</span>
<span class="comment">// The required Range functions. These should be defined in the same namespace</span>
<span class="comment">// as Ring.</span>
<span class="keyword">inline</span> <span class="identifier">RingIterator</span> <span class="identifier">range_begin</span><span class="special">(</span><span class="identifier">QRing</span><span class="special">&</span> <span class="identifier">r</span><span class="special">)</span>
<span class="special">{</span><span class="keyword">return</span> <span class="identifier">RingIterator</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">lines</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());}</span>
<span class="keyword">inline</span> <span class="identifier">ConstRingIterator</span> <span class="identifier">range_begin</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">QRing</span><span class="special">&</span> <span class="identifier">r</span><span class="special">)</span>
<span class="special">{</span><span class="keyword">return</span> <span class="identifier">ConstRingIterator</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">lines</span><span class="special">.</span><span class="identifier">begin</span><span class="special">());}</span>
<span class="keyword">inline</span> <span class="identifier">RingIterator</span> <span class="identifier">range_end</span><span class="special">(</span><span class="identifier">QRing</span><span class="special">&</span> <span class="identifier">r</span><span class="special">)</span>
<span class="special">{</span><span class="keyword">return</span> <span class="identifier">RingIterator</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">lines</span><span class="special">.</span><span class="identifier">end</span><span class="special">());}</span>
<span class="keyword">inline</span> <span class="identifier">ConstRingIterator</span> <span class="identifier">range_end</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">QRing</span><span class="special">&</span> <span class="identifier">r</span><span class="special">)</span>
<span class="special">{</span><span class="keyword">return</span> <span class="identifier">ConstRingIterator</span><span class="special">(</span><span class="identifier">r</span><span class="special">.</span><span class="identifier">lines</span><span class="special">.</span><span class="identifier">end</span><span class="special">());}</span>
</pre>
<h3>
<a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.h6"></a>
<span class="phrase"><a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.adaption_of_qpolygon"></a></span><a class="link" href="example_source_code__adapting_a_legacy_geometry_object_model.html#geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.adaption_of_qpolygon">Adaption
of QPolygon</a>
</h3>
<a name="adaption_of_qpolygon_source_code"></a><pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">geometry</span> <span class="special">{</span>
<span class="keyword">namespace</span> <span class="identifier">traits</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">tag</span><span class="special"><</span><span class="identifier">QPolygon</span><span class="special">></span> <span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">polygon_tag</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">ring_const_type</span><span class="special"><</span><span class="identifier">QPolygon</span><span class="special">></span> <span class="special">{</span> <span class="keyword">typedef</span> <span class="keyword">const</span> <span class="identifier">QRing</span><span class="special">&</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">ring_mutable_type</span><span class="special"><</span><span class="identifier">QPolygon</span><span class="special">></span> <span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">QRing</span><span class="special">&</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">interior_const_type</span><span class="special"><</span><span class="identifier">QPolygon</span><span class="special">></span> <span class="special">{</span> <span class="keyword">typedef</span> <span class="keyword">const</span> <span class="identifier">CustomPolygonRingRange</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">interior_mutable_type</span><span class="special"><</span><span class="identifier">QPolygon</span><span class="special">></span> <span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">CustomPolygonRingRange</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">exterior_ring</span><span class="special"><</span><span class="identifier">QPolygon</span><span class="special">></span>
<span class="special">{</span>
<span class="keyword">static</span> <span class="identifier">QRing</span><span class="special">&</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">QPolygon</span><span class="special">&</span> <span class="identifier">p</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="special">(*</span><span class="identifier">p</span><span class="special">.</span><span class="identifier">exterior</span><span class="special">);</span>
<span class="special">}</span>
<span class="keyword">static</span> <span class="identifier">QRing</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">QPolygon</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">p</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="special">(*</span><span class="identifier">p</span><span class="special">.</span><span class="identifier">exterior</span><span class="special">);</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span> <span class="keyword">struct</span> <span class="identifier">interior_rings</span><span class="special"><</span><span class="identifier">QPolygon</span><span class="special">></span>
<span class="special">{</span>
<span class="keyword">static</span> <span class="identifier">CustomPolygonRingRange</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">QPolygon</span><span class="special">&</span> <span class="identifier">p</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">CustomPolygonRingRange</span><span class="special">(</span><span class="identifier">PolygonRingIterator</span><span class="special">(</span><span class="identifier">p</span><span class="special">.</span><span class="identifier">interiors</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()),</span> <span class="identifier">PolygonRingIterator</span><span class="special">(</span><span class="identifier">p</span><span class="special">.</span><span class="identifier">interiors</span><span class="special">.</span><span class="identifier">end</span><span class="special">()));</span>
<span class="special">}</span>
<span class="keyword">static</span> <span class="keyword">const</span> <span class="identifier">CustomPolygonRingRange</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">QPolygon</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">p</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">CustomPolygonRingRange</span><span class="special">(</span><span class="identifier">ConstPolygonRingIterator</span><span class="special">(</span><span class="identifier">p</span><span class="special">.</span><span class="identifier">interiors</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()),</span> <span class="identifier">ConstPolygonRingIterator</span><span class="special">(</span><span class="identifier">p</span><span class="special">.</span><span class="identifier">interiors</span><span class="special">.</span><span class="identifier">end</span><span class="special">()));</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="special">}</span>
<span class="special">}</span>
<span class="special">}</span> <span class="comment">// namespace boost::geometry::traits</span>
</pre>
<h4>
<a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.h7"></a>
<span class="phrase"><a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.boost_iterator_for_qrings_in_qpolygon"></a></span><a class="link" href="example_source_code__adapting_a_legacy_geometry_object_model.html#geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.boost_iterator_for_qrings_in_qpolygon">Boost.Iterator
for QRings in QPolygon</a>
</h4>
<a name="adaption_of_qpolygon_iterator_source_code"></a><pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">I</span><span class="special">,</span> <span class="comment">// Line iterator type</span>
<span class="keyword">class</span> <span class="identifier">R</span> <span class="comment">// Point reference type</span>
<span class="special">></span>
<span class="keyword">class</span> <span class="identifier">PolyRingIterator</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">iterator_facade</span><span class="special"><</span>
<span class="identifier">PolyRingIterator</span><span class="special"><</span><span class="identifier">I</span><span class="special">,</span><span class="identifier">R</span><span class="special">>,</span> <span class="identifier">R</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">random_access_iterator_tag</span><span class="special">,</span> <span class="identifier">R</span><span class="special">></span> <span class="comment">//new traversal tag</span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="identifier">PolyRingIterator</span><span class="special">()</span> <span class="special">{}</span>
<span class="keyword">explicit</span> <span class="identifier">PolyRingIterator</span><span class="special">(</span><span class="identifier">I</span> <span class="identifier">ringIter</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">_ringIter</span><span class="special">(</span><span class="identifier">ringIter</span><span class="special">)</span> <span class="special">{}</span>
<span class="keyword">template</span><span class="special"><</span><span class="keyword">class</span> <span class="identifier">OtherI</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">OtherR</span><span class="special">></span>
<span class="identifier">PolyRingIterator</span><span class="special">(</span><span class="identifier">PolyRingIterator</span><span class="special"><</span><span class="identifier">OtherI</span><span class="special">,</span> <span class="identifier">OtherR</span><span class="special">></span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">other</span><span class="special">)</span> <span class="special">:</span>
<span class="identifier">_ringIter</span><span class="special">(</span><span class="identifier">other</span><span class="special">.</span><span class="identifier">getRingIter</span><span class="special">())</span> <span class="special">{}</span>
<span class="identifier">I</span> <span class="identifier">getRingIter</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="identifier">_ringIter</span><span class="special">;}</span>
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">iterator_facade</span><span class="special"><</span><span class="identifier">PolyRingIterator</span><span class="special"><</span><span class="identifier">I</span><span class="special">,</span><span class="identifier">R</span><span class="special">>,</span> <span class="identifier">R</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">random_access_iterator_tag</span><span class="special">,</span> <span class="identifier">R</span><span class="special">>::</span><span class="identifier">difference_type</span> <span class="identifier">difference_type</span><span class="special">;</span>
<span class="keyword">private</span><span class="special">:</span>
<span class="keyword">friend</span> <span class="keyword">class</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">iterator_core_access</span><span class="special">;</span>
<span class="keyword">void</span> <span class="identifier">increment</span><span class="special">()</span>
<span class="special">{</span>
<span class="special">++</span><span class="identifier">_ringIter</span><span class="special">;</span>
<span class="special">}</span>
<span class="keyword">void</span> <span class="identifier">decrement</span><span class="special">()</span>
<span class="special">{</span>
<span class="special">--</span><span class="identifier">_ringIter</span><span class="special">;</span>
<span class="special">}</span>
<span class="keyword">void</span> <span class="identifier">advance</span><span class="special">(</span><span class="identifier">difference_type</span> <span class="identifier">n</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">advance</span><span class="special">(</span><span class="identifier">_ringIter</span><span class="special">,</span><span class="identifier">n</span><span class="special">);</span>
<span class="special">}</span>
<span class="identifier">difference_type</span> <span class="identifier">distance_to</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">PolyRingIterator</span><span class="special">&</span> <span class="identifier">other</span><span class="special">)</span> <span class="keyword">const</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">_ringIter</span><span class="special">,</span> <span class="identifier">other</span><span class="special">.</span><span class="identifier">getRingIter</span><span class="special">());</span>
<span class="special">}</span>
<span class="keyword">bool</span> <span class="identifier">equal</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">PolyRingIterator</span><span class="special">&</span> <span class="identifier">other</span><span class="special">)</span> <span class="keyword">const</span>
<span class="special">{</span>
<span class="keyword">return</span> <span class="identifier">_ringIter</span> <span class="special">==</span> <span class="identifier">other</span><span class="special">.</span><span class="identifier">getRingIter</span><span class="special">();</span>
<span class="special">}</span>
<span class="identifier">R</span> <span class="identifier">dereference</span><span class="special">()</span> <span class="keyword">const</span> <span class="special">{</span><span class="keyword">return</span> <span class="special">*(*</span><span class="identifier">_ringIter</span><span class="special">);}</span>
<span class="identifier">I</span> <span class="identifier">_ringIter</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<h4>
<a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.h8"></a>
<span class="phrase"><a name="geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.boost_range_for_polygonringiterator"></a></span><a class="link" href="example_source_code__adapting_a_legacy_geometry_object_model.html#geometry.examples.example_source_code__adapting_a_legacy_geometry_object_model.boost_range_for_polygonringiterator">Boost.Range
for PolygonRingIterator</a>
</h4>
<a name="adaption_of_qpolygon_range_source_code"></a><pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">PolyRingIterator</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">QRing</span><span class="special">*>::</span><span class="identifier">iterator</span><span class="special">,</span> <span class="identifier">QRing</span><span class="special">></span> <span class="identifier">PolygonRingIterator</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">PolyRingIterator</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="identifier">QRing</span><span class="special">*>::</span><span class="identifier">const_iterator</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">QRing</span><span class="special">></span> <span class="identifier">ConstPolygonRingIterator</span><span class="special">;</span>
<span class="keyword">class</span> <span class="identifier">CustomPolygonRingRange</span>
<span class="special">{</span>
<span class="identifier">PolygonRingIterator</span> <span class="identifier">_begin</span><span class="special">;</span>
<span class="identifier">PolygonRingIterator</span> <span class="identifier">_end</span><span class="special">;</span>
<span class="keyword">bool</span> <span class="identifier">isIterSet</span><span class="special">;</span>
<span class="identifier">ConstPolygonRingIterator</span> <span class="identifier">_cbegin</span><span class="special">;</span>
<span class="identifier">ConstPolygonRingIterator</span> <span class="identifier">_cend</span><span class="special">;</span>
<span class="keyword">bool</span> <span class="identifier">isCIterSet</span><span class="special">;</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="identifier">CustomPolygonRingRange</span><span class="special">(</span><span class="identifier">PolygonRingIterator</span> <span class="identifier">begin</span><span class="special">,</span> <span class="identifier">PolygonRingIterator</span> <span class="identifier">end</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">_begin</span><span class="special">(</span><span class="identifier">begin</span><span class="special">),</span> <span class="identifier">_end</span><span class="special">(</span><span class="identifier">end</span><span class="special">),</span> <span class="identifier">isIterSet</span><span class="special">(</span><span class="keyword">true</span><span class="special">)</span> <span class="special">{}</span>
<span class="identifier">CustomPolygonRingRange</span><span class="special">(</span><span class="identifier">ConstPolygonRingIterator</span> <span class="identifier">begin</span><span class="special">,</span> <span class="identifier">ConstPolygonRingIterator</span> <span class="identifier">end</span><span class="special">)</span> <span class="special">:</span> <span class="identifier">_cbegin</span><span class="special">(</span><span class="identifier">begin</span><span class="special">),</span> <span class="identifier">_cend</span><span class="special">(</span><span class="identifier">end</span><span class="special">),</span> <span class="identifier">isCIterSet</span><span class="special">(</span><span class="keyword">true</span><span class="special">)</span> <span class="special">{}</span>
<span class="identifier">PolygonRingIterator</span> <span class="identifier">begin</span><span class="special">()</span>
<span class="special">{</span>
<span class="identifier">assert</span><span class="special">(</span><span class="identifier">isIterSet</span><span class="special">);</span>
<span class="keyword">return</span> <span class="identifier">_begin</span><span class="special">;</span>
<span class="special">}</span>
<span class="identifier">ConstPolygonRingIterator</span> <span class="identifier">cbegin</span><span class="special">()</span> <span class="keyword">const</span>
<span class="special">{</span>
<span class="identifier">assert</span><span class="special">(</span><span class="identifier">isCIterSet</span><span class="special">);</span>
<span class="keyword">return</span> <span class="identifier">_cbegin</span><span class="special">;</span>
<span class="special">}</span>
<span class="identifier">PolygonRingIterator</span> <span class="identifier">end</span><span class="special">()</span>
<span class="special">{</span>
<span class="identifier">assert</span><span class="special">(</span><span class="identifier">isIterSet</span><span class="special">);</span>
<span class="keyword">return</span> <span class="identifier">_end</span><span class="special">;</span>
<span class="special">}</span>
<span class="identifier">ConstPolygonRingIterator</span> <span class="identifier">cend</span><span class="special">()</span> <span class="keyword">const</span>
<span class="special">{</span>
<span class="identifier">assert</span><span class="special">(</span><span class="identifier">isCIterSet</span><span class="special">);</span>
<span class="keyword">return</span> <span class="identifier">_cend</span><span class="special">;</span>
<span class="special">}</span>
<span class="special">};</span>
<span class="keyword">namespace</span> <span class="identifier">boost</span>
<span class="special">{</span>
<span class="comment">// Specialize metafunctions. We must include the range.hpp header.</span>
<span class="comment">// We must open the 'boost' namespace.</span>
<span class="keyword">template</span> <span class="special"><></span>
<span class="keyword">struct</span> <span class="identifier">range_iterator</span><span class="special"><</span><span class="identifier">CustomPolygonRingRange</span><span class="special">></span> <span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">PolygonRingIterator</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="keyword">template</span><span class="special"><></span>
<span class="keyword">struct</span> <span class="identifier">range_const_iterator</span><span class="special"><</span><span class="identifier">CustomPolygonRingRange</span><span class="special">></span> <span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">ConstPolygonRingIterator</span> <span class="identifier">type</span><span class="special">;</span> <span class="special">};</span>
<span class="special">}</span> <span class="comment">// namespace 'boost'</span>
<span class="comment">// The required Range functions. These should be defined in the same namespace</span>
<span class="comment">// as Ring.</span>
<span class="keyword">inline</span> <span class="identifier">PolygonRingIterator</span> <span class="identifier">range_begin</span><span class="special">(</span><span class="identifier">CustomPolygonRingRange</span><span class="special">&</span> <span class="identifier">r</span><span class="special">)</span>
<span class="special">{</span><span class="keyword">return</span> <span class="identifier">r</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();}</span>
<span class="keyword">inline</span> <span class="identifier">ConstPolygonRingIterator</span> <span class="identifier">range_begin</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">CustomPolygonRingRange</span><span class="special">&</span> <span class="identifier">r</span><span class="special">)</span>
<span class="special">{</span><span class="keyword">return</span> <span class="identifier">r</span><span class="special">.</span><span class="identifier">cbegin</span><span class="special">();}</span>
<span class="keyword">inline</span> <span class="identifier">PolygonRingIterator</span> <span class="identifier">range_end</span><span class="special">(</span><span class="identifier">CustomPolygonRingRange</span><span class="special">&</span> <span class="identifier">r</span><span class="special">)</span>
<span class="special">{</span><span class="keyword">return</span> <span class="identifier">r</span><span class="special">.</span><span class="identifier">end</span><span class="special">();}</span>
<span class="keyword">inline</span> <span class="identifier">ConstPolygonRingIterator</span> <span class="identifier">range_end</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">CustomPolygonRingRange</span><span class="special">&</span> <span class="identifier">r</span><span class="special">)</span>
<span class="special">{</span><span class="keyword">return</span> <span class="identifier">r</span><span class="special">.</span><span class="identifier">cend</span><span class="special">();}</span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2009-2017 Barend
Gehrels, Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz, Oracle and/or its
affiliates<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="example__adapting_a_legacy_geometry_object_model.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../examples.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../release_notes.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
|
agpl-3.0
|
cris-iisc/mpc-primitives
|
crislib/libscapi/lib/boost_1_64_0/doc/html/boost_asio/reference/windows__basic_handle/get_implementation.html
|
4317
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>windows::basic_handle::get_implementation</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../boost_asio.html" title="Boost.Asio">
<link rel="up" href="../windows__basic_handle.html" title="windows::basic_handle">
<link rel="prev" href="close/overload2.html" title="windows::basic_handle::close (2 of 2 overloads)">
<link rel="next" href="get_implementation/overload1.html" title="windows::basic_handle::get_implementation (1 of 2 overloads)">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="close/overload2.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../windows__basic_handle.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="get_implementation/overload1.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="boost_asio.reference.windows__basic_handle.get_implementation"></a><a class="link" href="get_implementation.html" title="windows::basic_handle::get_implementation">windows::basic_handle::get_implementation</a>
</h4></div></div></div>
<p>
<a class="indexterm" name="idp174571776"></a>
Get the underlying implementation
of the I/O object.
</p>
<pre class="programlisting"><span class="identifier">implementation_type</span> <span class="special">&</span> <a class="link" href="get_implementation/overload1.html" title="windows::basic_handle::get_implementation (1 of 2 overloads)">get_implementation</a><span class="special">();</span>
<span class="emphasis"><em>» <a class="link" href="get_implementation/overload1.html" title="windows::basic_handle::get_implementation (1 of 2 overloads)">more...</a></em></span>
<span class="keyword">const</span> <span class="identifier">implementation_type</span> <span class="special">&</span> <a class="link" href="get_implementation/overload2.html" title="windows::basic_handle::get_implementation (2 of 2 overloads)">get_implementation</a><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
<span class="emphasis"><em>» <a class="link" href="get_implementation/overload2.html" title="windows::basic_handle::get_implementation (2 of 2 overloads)">more...</a></em></span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003-2017 Christopher M. Kohlhoff<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="close/overload2.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../windows__basic_handle.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="get_implementation/overload1.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
|
agpl-3.0
|
Morik/WCF
|
wcfsetup/install/files/lib/data/user/online/UsersOnlineList.class.php
|
5464
|
<?php
namespace wcf\data\user\online;
use wcf\data\option\OptionAction;
use wcf\data\session\SessionList;
use wcf\data\user\group\UserGroup;
use wcf\data\user\User;
use wcf\system\event\EventHandler;
use wcf\system\WCF;
use wcf\util\StringUtil;
/**
* Represents a list of currently online users.
*
* @author Marcel Werk
* @copyright 2001-2018 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\Data\User\Online
*
* @method UserOnline current()
* @method UserOnline[] getObjects()
* @method UserOnline|null search($objectID)
* @property UserOnline[] $objects
*/
class UsersOnlineList extends SessionList {
/**
* @inheritDoc
*/
public $sqlOrderBy = 'user_table.username';
/**
* users online stats
* @var array
*/
public $stats = [
'total' => 0,
'invisible' => 0,
'members' => 0,
'guests' => 0
];
/**
* users online markings
* @var array
*/
public $usersOnlineMarkings = null;
/**
* @inheritDoc
*/
public function __construct() {
parent::__construct();
$this->sqlSelects .= "user_avatar.*, user_option_value.*, user_group.userOnlineMarking, user_table.*";
$this->sqlConditionJoins .= " LEFT JOIN wcf".WCF_N."_user user_table ON (user_table.userID = session.userID)";
$this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user user_table ON (user_table.userID = session.userID)";
$this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user_option_value user_option_value ON (user_option_value.userID = user_table.userID)";
$this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user_avatar user_avatar ON (user_avatar.avatarID = user_table.avatarID)";
$this->sqlJoins .= " LEFT JOIN wcf".WCF_N."_user_group user_group ON (user_group.groupID = user_table.userOnlineGroupID)";
$this->getConditionBuilder()->add('session.lastActivityTime > ?', [TIME_NOW - USER_ONLINE_TIMEOUT]);
}
/**
* @inheritDoc
*/
public function readObjects() {
parent::readObjects();
$objects = $this->objects;
$this->indexToObject = $this->objects = [];
foreach ($objects as $object) {
$object = new UserOnline(new User(null, null, $object));
if (!$object->userID || self::isVisible($object->userID, $object->canViewOnlineStatus)) {
$this->objects[$object->sessionID] = $object;
$this->indexToObject[] = $object->sessionID;
}
}
$this->objectIDs = $this->indexToObject;
$this->rewind();
}
/**
* Fetches users online stats.
*/
public function readStats() {
$conditionBuilder = clone $this->getConditionBuilder();
$conditionBuilder->add('session.spiderID IS NULL');
$sql = "SELECT user_option_value.userOption".User::getUserOptionID('canViewOnlineStatus')." AS canViewOnlineStatus, session.userID
FROM wcf".WCF_N."_session session
LEFT JOIN wcf".WCF_N."_user_option_value user_option_value
ON (user_option_value.userID = session.userID)
".$conditionBuilder;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditionBuilder->getParameters());
while ($row = $statement->fetchArray()) {
$this->stats['total']++;
if ($row['userID']) {
$this->stats['members']++;
if ($row['canViewOnlineStatus'] && !self::isVisible($row['userID'], $row['canViewOnlineStatus'])) {
$this->stats['invisible']++;
}
}
else {
$this->stats['guests']++;
}
}
}
/**
* Returns a list of the users online markings.
*
* @return array
*/
public function getUsersOnlineMarkings() {
if ($this->usersOnlineMarkings === null) {
$this->usersOnlineMarkings = $priorities = [];
// get groups
foreach (UserGroup::getGroupsByType() as $group) {
if ($group->userOnlineMarking != '%s') {
$priorities[] = $group->priority;
$this->usersOnlineMarkings[] = str_replace('%s', StringUtil::encodeHTML(WCF::getLanguage()->get($group->groupName)), $group->userOnlineMarking);
}
}
// sort list
array_multisort($priorities, SORT_DESC, $this->usersOnlineMarkings);
}
return $this->usersOnlineMarkings;
}
/**
* Checks the users online record.
*/
public function checkRecord() {
$usersOnlineTotal = (USERS_ONLINE_RECORD_NO_GUESTS ? $this->stats['members'] : $this->stats['total']);
if ($usersOnlineTotal > USERS_ONLINE_RECORD) {
// save new record
$optionAction = new OptionAction([], 'import', ['data' => [
'users_online_record' => $usersOnlineTotal,
'users_online_record_time' => TIME_NOW
]]);
$optionAction->executeAction();
}
}
/**
* Checks the 'canViewOnlineStatus' setting.
*
* @param integer $userID
* @param integer $canViewOnlineStatus
* @return boolean
*/
public static function isVisible($userID, $canViewOnlineStatus) {
if (WCF::getSession()->getPermission('admin.user.canViewInvisible') || $userID == WCF::getUser()->userID) return true;
$data = ['result' => false, 'userID' => $userID, 'canViewOnlineStatus' => $canViewOnlineStatus];
switch ($canViewOnlineStatus) {
case 0: // everyone
$data['result'] = true;
break;
case 1: // registered
if (WCF::getUser()->userID) $data['result'] = true;
break;
case 2: // following
/** @noinspection PhpUndefinedMethodInspection */
if (WCF::getUserProfileHandler()->isFollower($userID)) $data['result'] = true;
break;
}
EventHandler::getInstance()->fireAction(get_called_class(), 'isVisible', $data);
return $data['result'];
}
}
|
lgpl-2.1
|
kobolabs/qt-everywhere-4.8.0
|
doc/html/qsignaltransition-members.html
|
11502
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qsignaltransition.cpp -->
<title>Qt 4.8: List of All Members for QSignalTransition</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtcore.html">QtCore</a></li>
<li>QSignalTransition</li>
</ul>
</div>
</div>
<div class="content mainContent">
<h1 class="title">List of All Members for QSignalTransition</h1>
<p>This is the complete list of members for <a href="qsignaltransition.html">QSignalTransition</a>, including inherited members.</p>
<table class="propsummary">
<tr><td class="topAlign"><ul>
<li class="fn"><span class="name"><b><a href="qsignaltransition.html#QSignalTransition">QSignalTransition</a></b></span> ( QState * )</li>
<li class="fn"><span class="name"><b><a href="qsignaltransition.html#QSignalTransition-2">QSignalTransition</a></b></span> ( QObject *, const char *, QState * )</li>
<li class="fn"><span class="name"><b><a href="qsignaltransition.html#dtor.QSignalTransition">~QSignalTransition</a></b></span> ()</li>
<li class="fn"><span class="name"><b><a href="qabstracttransition.html#addAnimation">addAnimation</a></b></span> ( QAbstractAnimation * )</li>
<li class="fn"><span class="name"><b><a href="qabstracttransition.html#animations">animations</a></b></span> () const : QList<QAbstractAnimation *></li>
<li class="fn"><span class="name"><b><a href="qobject.html#blockSignals">blockSignals</a></b></span> ( bool ) : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#childEvent">childEvent</a></b></span> ( QChildEvent * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#children">children</a></b></span> () const : const QObjectList &</li>
<li class="fn"><span class="name"><b><a href="qobject.html#connect">connect</a></b></span> ( const QObject *, const char *, const QObject *, const char *, Qt::ConnectionType ) : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#connect-2">connect</a></b></span> ( const QObject *, const QMetaMethod &, const QObject *, const QMetaMethod &, Qt::ConnectionType ) : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#connect-3">connect</a></b></span> ( const QObject *, const char *, const char *, Qt::ConnectionType ) const : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#connectNotify">connectNotify</a></b></span> ( const char * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#customEvent">customEvent</a></b></span> ( QEvent * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#d_ptr-var">d_ptr</a></b></span> : QScopedPointer<QObjectData></li>
<li class="fn"><span class="name"><b><a href="qobject.html#deleteLater">deleteLater</a></b></span> ()</li>
<li class="fn"><span class="name"><b><a href="qobject.html#destroyed">destroyed</a></b></span> ( QObject * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#disconnect">disconnect</a></b></span> ( const QObject *, const char *, const QObject *, const char * ) : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#disconnect-2">disconnect</a></b></span> ( const QObject *, const QMetaMethod &, const QObject *, const QMetaMethod & ) : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#disconnect-3">disconnect</a></b></span> ( const char *, const QObject *, const char * ) : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#disconnect-4">disconnect</a></b></span> ( const QObject *, const char * ) : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#disconnectNotify">disconnectNotify</a></b></span> ( const char * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#dumpObjectInfo">dumpObjectInfo</a></b></span> ()</li>
<li class="fn"><span class="name"><b><a href="qobject.html#dumpObjectTree">dumpObjectTree</a></b></span> ()</li>
<li class="fn"><span class="name"><b><a href="qobject.html#dynamicPropertyNames">dynamicPropertyNames</a></b></span> () const : QList<QByteArray></li>
<li class="fn"><span class="name"><b><a href="qsignaltransition.html#event">event</a></b></span> ( QEvent * ) : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#eventFilter">eventFilter</a></b></span> ( QObject *, QEvent * ) : bool</li>
<li class="fn"><span class="name"><b><a href="qsignaltransition.html#eventTest">eventTest</a></b></span> ( QEvent * ) : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#findChild">findChild</a></b></span> ( const QString & ) const : T</li>
<li class="fn"><span class="name"><b><a href="qobject.html#findChildren">findChildren</a></b></span> ( const QString & ) const : QList<T></li>
<li class="fn"><span class="name"><b><a href="qobject.html#findChildren-2">findChildren</a></b></span> ( const QRegExp & ) const : QList<T></li>
<li class="fn"><span class="name"><b><a href="qobject.html#inherits">inherits</a></b></span> ( const char * ) const : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#installEventFilter">installEventFilter</a></b></span> ( QObject * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#isWidgetType">isWidgetType</a></b></span> () const : bool</li>
<li class="fn"><span class="name"><b><a href="qobject.html#killTimer">killTimer</a></b></span> ( int )</li>
</ul></td><td class="topAlign"><ul>
<li class="fn"><span class="name"><b><a href="qabstracttransition.html#machine">machine</a></b></span> () const : QStateMachine *</li>
<li class="fn"><span class="name"><b><a href="qobject.html#metaObject">metaObject</a></b></span> () const : const QMetaObject *</li>
<li class="fn"><span class="name"><b><a href="qobject.html#moveToThread">moveToThread</a></b></span> ( QThread * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#objectName-prop">objectName</a></b></span> () const : QString</li>
<li class="fn"><span class="name"><b><a href="qsignaltransition.html#onTransition">onTransition</a></b></span> ( QEvent * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#parent">parent</a></b></span> () const : QObject *</li>
<li class="fn"><span class="name"><b><a href="qobject.html#property">property</a></b></span> ( const char * ) const : QVariant</li>
<li class="fn"><span class="name"><b><a href="qobject.html#receivers">receivers</a></b></span> ( const char * ) const : int</li>
<li class="fn"><span class="name"><b><a href="qabstracttransition.html#removeAnimation">removeAnimation</a></b></span> ( QAbstractAnimation * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#removeEventFilter">removeEventFilter</a></b></span> ( QObject * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#sender">sender</a></b></span> () const : QObject *</li>
<li class="fn"><span class="name"><b><a href="qsignaltransition.html#senderObject-prop">senderObject</a></b></span> () const : QObject *</li>
<li class="fn"><span class="name"><b><a href="qobject.html#senderSignalIndex">senderSignalIndex</a></b></span> () const : int</li>
<li class="fn"><span class="name"><b><a href="qobject.html#objectName-prop">setObjectName</a></b></span> ( const QString & )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#setParent">setParent</a></b></span> ( QObject * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#setProperty">setProperty</a></b></span> ( const char *, const QVariant & ) : bool</li>
<li class="fn"><span class="name"><b><a href="qsignaltransition.html#senderObject-prop">setSenderObject</a></b></span> ( QObject * )</li>
<li class="fn"><span class="name"><b><a href="qsignaltransition.html#signal-prop">setSignal</a></b></span> ( const QByteArray & )</li>
<li class="fn"><span class="name"><b><a href="qabstracttransition.html#targetState-prop">setTargetState</a></b></span> ( QAbstractState * )</li>
<li class="fn"><span class="name"><b><a href="qabstracttransition.html#targetStates-prop">setTargetStates</a></b></span> ( const QList<QAbstractState *> & )</li>
<li class="fn"><span class="name"><b><a href="qsignaltransition.html#signal-prop">signal</a></b></span> () const : QByteArray</li>
<li class="fn"><span class="name"><b><a href="qobject.html#signalsBlocked">signalsBlocked</a></b></span> () const : bool</li>
<li class="fn"><span class="name"><b><a href="qabstracttransition.html#sourceState-prop">sourceState</a></b></span> () const : QState *</li>
<li class="fn"><span class="name"><b><a href="qobject.html#startTimer">startTimer</a></b></span> ( int ) : int</li>
<li class="fn"><span class="name"><b><a href="qobject.html#staticMetaObject-var">staticMetaObject</a></b></span> : const QMetaObject</li>
<li class="fn"><span class="name"><b><a href="qobject.html#staticQtMetaObject-var">staticQtMetaObject</a></b></span> : const QMetaObject</li>
<li class="fn"><span class="name"><b><a href="qabstracttransition.html#targetState-prop">targetState</a></b></span> () const : QAbstractState *</li>
<li class="fn"><span class="name"><b><a href="qabstracttransition.html#targetStates-prop">targetStates</a></b></span> () const : QList<QAbstractState *></li>
<li class="fn"><span class="name"><b><a href="qobject.html#thread">thread</a></b></span> () const : QThread *</li>
<li class="fn"><span class="name"><b><a href="qobject.html#timerEvent">timerEvent</a></b></span> ( QTimerEvent * )</li>
<li class="fn"><span class="name"><b><a href="qobject.html#tr">tr</a></b></span> ( const char *, const char *, int ) : QString</li>
<li class="fn"><span class="name"><b><a href="qobject.html#trUtf8">trUtf8</a></b></span> ( const char *, const char *, int ) : QString</li>
<li class="fn"><span class="name"><b><a href="qabstracttransition.html#triggered">triggered</a></b></span> ()</li>
</ul>
</td></tr>
</table>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2008-2011 Nokia Corporation and/or its
subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide.</p>
<p>
All other trademarks are property of their respective owners. <a title="Privacy Policy"
href="http://qt.nokia.com/about/privacy-policy">Privacy Policy</a></p>
<br />
<p>
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.</p>
<p>
Alternatively, this document may be used under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU
Free Documentation License version 1.3</a>
as published by the Free Software Foundation.</p>
</div>
</body>
</html>
|
lgpl-2.1
|
jiangbo212/netty-init
|
html-docs/contents/29bfa1b155d1811a61b44c39ac267acb.html
|
7185
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<!-- <script src="http://use.edgefonts.net/source-sans-pro;source-code-pro.js"></script> -->
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic|Source+Code+Pro:300,400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../assets/css/bootstrap.css">
<link rel="stylesheet" href="../assets/css/jquery.bonsai.css">
<link rel="stylesheet" href="../assets/css/main.css">
<link rel="stylesheet" href="../assets/css/icons.css">
<script type="text/javascript" src="../assets/js/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="../assets/js/bootstrap.js"></script>
<script type="text/javascript" src="../assets/js/jquery.bonsai.js"></script>
<!-- <script type="text/javascript" src="../assets/js/main.js"></script> -->
</head>
<body>
<div>
<!-- Name Title -->
<h1>(unnamed)</h1>
<!-- Type and Stereotype -->
<section style="margin-top: .5em;">
<span class="alert alert-info">
<span class="node-icon _icon-UMLParameter"></span>
UMLParameter
</span>
</section>
<!-- Path -->
<section style="margin-top: 10px">
<span class="label label-info"><a href='cf9c8b720f3815adeccaf3ef6e48c6c4.html'><span class='node-icon _icon-Project'></span>Untitled</a></span>
<span>::</span>
<span class="label label-info"><a href='6550300e57d7fc770bd2e9afbcdb3ecb.html'><span class='node-icon _icon-UMLModel'></span>JavaReverse</a></span>
<span>::</span>
<span class="label label-info"><a href='7ff2d96ca3eb7f62f48c1a30b3c7c990.html'><span class='node-icon _icon-UMLPackage'></span>net</a></span>
<span>::</span>
<span class="label label-info"><a href='7adc4be4f2e4859086f068fc27512d85.html'><span class='node-icon _icon-UMLPackage'></span>gleamynode</a></span>
<span>::</span>
<span class="label label-info"><a href='bb15307bdbbaf31bfef4f71be74150ae.html'><span class='node-icon _icon-UMLPackage'></span>netty</a></span>
<span>::</span>
<span class="label label-info"><a href='13ebeea6c90c35d72f303d2d478d584e.html'><span class='node-icon _icon-UMLPackage'></span>buffer</a></span>
<span>::</span>
<span class="label label-info"><a href='cb2e81bf6fa08af090f5bd728f5884e7.html'><span class='node-icon _icon-UMLClass'></span>DynamicChannelBuffer</a></span>
<span>::</span>
<span class="label label-info"><a href='a2cd9b43d596a671300e4cf58dcaa9fa.html'><span class='node-icon _icon-UMLOperation'></span>getBytes</a></span>
<span>::</span>
<span class="label label-info"><a href='29bfa1b155d1811a61b44c39ac267acb.html'><span class='node-icon _icon-UMLParameter'></span>(Parameter)</a></span>
</section>
<!-- Diagram -->
<!-- Description -->
<section>
<h3>Description</h3>
<div>
<span class="label label-info">none</span>
</div>
</section>
<!-- Specification -->
<!-- Directed Relationship -->
<!-- Undirected Relationship -->
<!-- Classifier -->
<!-- Interface -->
<!-- Component -->
<!-- Node -->
<!-- Actor -->
<!-- Use Case -->
<!-- Template Parameters -->
<!-- Literals -->
<!-- Attributes -->
<!-- Operations -->
<!-- Receptions -->
<!-- Extension Points -->
<!-- Parameters -->
<!-- Diagrams -->
<!-- Behavior -->
<!-- Action -->
<!-- Interaction -->
<!-- CombinedFragment -->
<!-- Activity -->
<!-- State Machine -->
<!-- State Machine -->
<!-- State -->
<!-- Vertex -->
<!-- Transition -->
<!-- Properties -->
<section>
<h3>Properties</h3>
<table class="table table-striped table-bordered">
<tr>
<th width="50%">Name</th>
<th width="50%">Value</th>
</tr>
<tr>
<td>name</td>
<td></td>
</tr>
<tr>
<td>stereotype</td>
<td><span class='label label-info'>null</span></td>
</tr>
<tr>
<td>visibility</td>
<td>public</td>
</tr>
<tr>
<td>isStatic</td>
<td><span class='label label-info'>false</span></td>
</tr>
<tr>
<td>isLeaf</td>
<td><span class='label label-info'>false</span></td>
</tr>
<tr>
<td>type</td>
<td>int</td>
</tr>
<tr>
<td>multiplicity</td>
<td></td>
</tr>
<tr>
<td>isReadOnly</td>
<td><span class='label label-info'>false</span></td>
</tr>
<tr>
<td>isOrdered</td>
<td><span class='label label-info'>false</span></td>
</tr>
<tr>
<td>isUnique</td>
<td><span class='label label-info'>false</span></td>
</tr>
<tr>
<td>defaultValue</td>
<td></td>
</tr>
<tr>
<td>direction</td>
<td>return</td>
</tr>
</table>
</section>
<!-- Tags -->
<!-- Constraints, Dependencies, Dependants -->
<!-- Relationships -->
<!-- Owned Elements -->
</div>
</body>
</html>
|
lgpl-2.1
|
cytoscape/cytoscape-impl
|
core-task-impl/src/main/java/org/cytoscape/task/internal/network/DestroyNetworkTaskFactoryImpl.java
|
1942
|
package org.cytoscape.task.internal.network;
import java.util.ArrayList;
import java.util.Collection;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.service.util.CyServiceRegistrar;
import org.cytoscape.task.AbstractNetworkCollectionTaskFactory;
import org.cytoscape.task.destroy.DestroyNetworkTaskFactory;
import org.cytoscape.work.TaskFactory;
import org.cytoscape.work.TaskIterator;
/*
* #%L
* Cytoscape Core Task Impl (core-task-impl)
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2006 - 2021 The Cytoscape Consortium
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 2.1 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/lgpl-2.1.html>.
* #L%
*/
public class DestroyNetworkTaskFactoryImpl extends AbstractNetworkCollectionTaskFactory
implements DestroyNetworkTaskFactory, TaskFactory {
private final CyServiceRegistrar serviceRegistrar;
public DestroyNetworkTaskFactoryImpl(CyServiceRegistrar serviceRegistrar) {
this.serviceRegistrar = serviceRegistrar;
}
@Override
public TaskIterator createTaskIterator(Collection<CyNetwork> networks) {
return new TaskIterator(new DestroyNetworkTask(networks, serviceRegistrar));
}
@Override
public TaskIterator createTaskIterator() {
return new TaskIterator(new DestroyNetworkTask(new ArrayList<>(), serviceRegistrar));
}
@Override
public boolean isReady() {
return true;
}
}
|
lgpl-2.1
|
jinshana/kajonacms
|
module_system/system/class_root.php
|
70858
|
<?php
/*"******************************************************************************************************
* (c) 2004-2006 by MulchProductions, www.mulchprod.de *
* (c) 2007-2015 by Kajona, www.kajona.de *
* Published under the GNU LGPL v2.1, see /system/licence_lgpl.txt *
*-------------------------------------------------------------------------------------------------------*
* $Id$ *
********************************************************************************************************/
/**
* The top-level class for models, installers and top-level files
* An instance of this class is used by the admin & portal object to invoke common database based methods.
* Change with care!
*
* @package module_system
* @author sidler@mulchprod.de
*/
abstract class class_root {
const STR_MODULE_ANNOTATION = "@module";
const STR_MODULEID_ANNOTATION = "@moduleId";
/**
* Instance of class_config
*
* @var class_config
*/
protected $objConfig = null; //Object containing config-data
/**
* Instance of class_db
*
* @var class_db
*/
protected $objDB = null; //Object to the database
/**
* Instance of class_session
*
* @var class_session
*/
protected $objSession = null; //Object containing the session-management
/**
* Instance of class_lang
*
* @var class_lang
*/
private $objLang = null; //Object managing the langfiles
/**
* @var interface_sortmanager
*/
protected $objSortManager = null;
private $strAction; //current action to perform (GET/POST)
protected $arrModule = array(); //Array containing information about the current module
private $arrInitRow = null; //array to be used when loading details from the database. could reduce the amount of queries if populated.
//--- fields to be synchronized with the database ---
/**
* The records current systemid
* @var string
* @templateExport
*
* @tableColumn system.system_id
*/
private $strSystemid = "";
/**
* The records internal parent-id
* @var string
* @versionable
*
* @tableColumn system.system_prev_id
*/
private $strPrevId = -1;
/**
* The old prev-id, used to track hierarchical changes -> requires a rebuild of the rights-table
* @var string
*/
private $strOldPrevId = -1;
/**
* The records module-number
* @var int
* @tableColumn system.system_module_nr
*/
private $intModuleNr = 0;
/**
* The records sort-position relative to the parent record
* @var int
* @tableColumn system.system_sort
*/
private $intSort = -1;
/**
* The id of the user who created the record initially
* @var string
* @versionable
* @templateExport
* @templateMapper user
* @tableColumn system.system_owner
*/
private $strOwner = "";
/**
* The id of the user last who did the last changes to the current record
* @var string
* @tableColumn system.system_lm_user
*/
private $strLmUser = "";
/**
* Timestamp of the last modification
* ATTENTION: time() based, so 32 bit integer
* @todo migrate to long-timestamp
* @var int
* @templateExport
* @templateMapper datetime
* @tableColumn system.system_lm_time
*/
private $intLmTime = 0;
/**
* The id of the user locking the current record, empty otherwise
* @var string
* @tableColumn system.system_lock_id
*/
private $strLockId = "";
/**
* Time the current locking was triggered
* ATTENTION: time() based, so 32 bit integer
* @todo migrate to long-timestamp
* @var int
* @tableColumn system.system_lock_time
*/
private $intLockTime = 0;
/**
* The records status
* @var int
* @versionable
* @tableColumn system.system_status
*/
private $intRecordStatus = 1;
/**
* The records previous status, used to trigger status changed events
* @var int
*/
private $intOldRecordStatus = 1;
/**
* Indicates whether the object is deleted, or not
* @var int
* @versionable
* @tableColumn system.system_deleted
*/
private $intRecordDeleted = 0;
/**
* Human readable comment describing the current record
* @var string
* @tableColumn system.system_comment
*/
private $strRecordComment = "";
/**
* Holds the current objects' class
* @var string
* @tableColumn system.system_class
*/
private $strRecordClass = "";
/**
* Long-based representation of the timestamp the record was created initially
* @var int
* @templateExport
* @templateMapper datetime
* @tableColumn system.system_create_date
*/
private $longCreateDate = 0;
/**
* The start-date of the date-table
* @var class_date
* @versionable
* @templateExport
* @templateMapper datetime
*
* @tableColumn system_date.system_date_start
*/
private $objStartDate = null;
/**
* The end date of the date-table
* @var class_date
* @versionable
* @templateExport
* @templateMapper datetime
*
* @tableColumn system_date.system_date_end
*/
private $objEndDate = null;
/**
* The special-date of the date-table
* @var class_date
* @versionable
* @templateExport
* @templateMapper datetime
*
* @tableColumn system_date.system_date_special
*/
private $objSpecialDate = null;
private $bitDatesChanges = false;
/**
* Constructor
*
* @param string $strSystemid
*
* @return class_root
*/
public function __construct($strSystemid = "") {
//Generating all the needed objects. For this we use our cool cool carrier-object
//take care of loading just the necessary objects
$objCarrier = class_carrier::getInstance();
$this->objConfig = $objCarrier->getObjConfig();
$this->objDB = $objCarrier->getObjDB();
$this->objSession = $objCarrier->getObjSession();
$this->objLang = $objCarrier->getObjLang();
$this->objSortManager = new class_common_sortmanager($this);
//And keep the action
$this->strAction = $this->getParam("action");
$this->strSystemid = $strSystemid;
$this->setStrRecordClass(get_class($this));
//try to load the current module-name and the moduleId by reflection
$objReflection = new class_reflection($this);
if(!isset($this->arrModule["modul"])) {
$arrAnnotationValues = $objReflection->getAnnotationValuesFromClass(self::STR_MODULE_ANNOTATION);
if(count($arrAnnotationValues) > 0) {
$this->setArrModuleEntry("modul", trim($arrAnnotationValues[0]));
$this->setArrModuleEntry("module", trim($arrAnnotationValues[0]));
}
}
if(!isset($this->arrModule["moduleId"])) {
$arrAnnotationValues = $objReflection->getAnnotationValuesFromClass(self::STR_MODULEID_ANNOTATION);
if(count($arrAnnotationValues) > 0) {
$this->setArrModuleEntry("moduleId", constant(trim($arrAnnotationValues[0])));
$this->setIntModuleNr(constant(trim($arrAnnotationValues[0])));
}
}
if($strSystemid != "") {
$this->initObject();
}
}
/**
* Method to invoke object initialization.
* In nearly all cases, this is triggered by the framework itself.
* @return void
*/
public final function initObject() {
$this->initObjectInternal();
$this->internalInit();
//if given, read versioning information
if($this instanceof interface_versionable) {
$objChangelog = new class_module_system_changelog();
$objChangelog->readOldValues($this);
}
}
/**
* InitObjectInternal is called during an objects instantiation.
* The default implementation tries to map all database-fields to the objects fields
* and sets the values automatically.
*
* If you have a different column-property mapping or additional
* setters to call, overwrite this method.
* The row loaded from the database is available by calling $this->getArrInitRow().
* @return void
*/
protected function initObjectInternal() {
$objORM = new class_orm_objectinit($this);
$objORM->initObjectFromDb();
}
/**
* Init the current record with the system-fields
* @return void
*/
private final function internalInit() {
if(validateSystemid($this->getSystemid())) {
if(is_array($this->arrInitRow)) {
$arrRow = $this->arrInitRow;
}
else {
$strQuery = "SELECT *
FROM "._dbprefix_."system
LEFT JOIN "._dbprefix_."system_date
ON system_id = system_date_id
WHERE system_id = ? ";
$arrRow = $this->objDB->getPRow($strQuery, array($this->getSystemid()));
}
if(count($arrRow) > 3) {
//$this->setStrSystemid($arrRow["system_id"]);
$this->strPrevId =$arrRow["system_prev_id"];
$this->intModuleNr = $arrRow["system_module_nr"];
$this->intSort = $arrRow["system_sort"];
$this->strOwner = $arrRow["system_owner"];
$this->strLmUser = $arrRow["system_lm_user"];
$this->intLmTime = $arrRow["system_lm_time"];
$this->strLockId = $arrRow["system_lock_id"];
$this->intLockTime = $arrRow["system_lock_time"];
$this->intRecordStatus = $arrRow["system_status"];
$this->strRecordComment = $arrRow["system_comment"];
$this->longCreateDate = $arrRow["system_create_date"];
if(isset($arrRow["system_class"]))
$this->strRecordClass = $arrRow["system_class"];
if(isset($arrRow["system_deleted"]))
$this->intRecordDeleted = $arrRow["system_deleted"];
$this->strOldPrevId = $this->strPrevId;
$this->intOldRecordStatus = $this->intRecordStatus;
if($arrRow["system_date_start"] > 0)
$this->objStartDate = new class_date($arrRow["system_date_start"]);
if($arrRow["system_date_end"] > 0)
$this->objEndDate = new class_date($arrRow["system_date_end"]);
if($arrRow["system_date_special"] > 0)
$this->objSpecialDate = new class_date($arrRow["system_date_special"]);
}
$this->bitDatesChanges = false;
}
}
/**
* A generic approach to count the number of object currently available.
* This method is only a simple approach to determine the number of instances in the
* database, if you need more specific counts, overwrite this method or add your own
* implementation to the derived class.
*
* @param string $strPrevid
*
* @return int
*/
public static function getObjectCount($strPrevid = "") {
$objORM = new class_orm_objectlist();
return $objORM->getObjectCount(get_called_class(), $strPrevid);
}
/**
* A generic approach to load a list of objects currently available.
* This method is only a simple approach to determine the instances in the
* database, if you need more specific loaders, overwrite this method or add your own
* implementation to the derived class.
*
* @param string $strPrevid
* @param null|int $intStart
* @param null|int $intEnd
*
* @return self[]
*/
public static function getObjectList($strPrevid = "", $intStart = null, $intEnd = null) {
$objORM = new class_orm_objectlist();
return $objORM->getObjectList(get_called_class(), $strPrevid, $intStart, $intEnd);
}
/**
* Validates if the current record may be restored
* @return bool
*/
public function isRestorable() {
//validate the parent nodes' id
$objParent = class_objectfactory::getInstance()->getObject($this->getStrPrevId());
return $objParent != null && $objParent->getIntRecordDeleted() == 0;
}
public function restoreObject() {
/** @var $this class_root|interface_model */
$this->objDB->transactionBegin();
$this->intRecordDeleted = 0;
$this->intSort = $this->getNextSortValue($this->getStrPrevId());
$bitReturn = $this->updateObjectToDb();
class_objectfactory::getInstance()->removeFromCache($this->getSystemid());
class_orm_rowcache::removeSingleRow($this->getSystemid());
$this->objDB->flushQueryCache();
$this->objSortManager->fixSortOnPrevIdChange($this->strPrevId, $this->strPrevId);
$bitReturn = $bitReturn && class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_RECORDRESTORED_LOGICALLY, array($this->getSystemid(), get_class($this), $this));
if($bitReturn) {
class_logger::getInstance()->addLogRow("successfully restored record ".$this->getSystemid()." / ".$this->getStrDisplayName(), class_logger::$levelInfo);
$this->objDB->transactionCommit();
return true;
}
else {
class_logger::getInstance()->addLogRow("error restoring record ".$this->getSystemid()." / ".$this->getStrDisplayName(), class_logger::$levelInfo);
$this->objDB->transactionRollback();
return false;
}
}
/**
* Triggers the logical delete of the current object.
* This means the object itself is not deleted, but marked as deleted. Restoring the object is
* possible.
*
* @throws class_exception
* @return bool
*/
public function deleteObject() {
if(!$this->getLockManager()->isAccessibleForCurrentUser())
return false;
/** @var $this class_root|interface_model */
$this->objDB->transactionBegin();
//validate, if there are subrecords, so child nodes to be deleted
$arrChilds = $this->objDB->getPArray("SELECT system_id FROM "._dbprefix_."system where system_prev_id = ?", array($this->getSystemid()));
foreach($arrChilds as $arrOneChild) {
if(validateSystemid($arrOneChild["system_id"])) {
$objInstance = class_objectfactory::getInstance()->getObject($arrOneChild["system_id"]);
if($objInstance !== null)
$objInstance->deleteObject();
}
}
$this->intRecordDeleted = 1;
$this->intSort = -1;
$bitReturn = $this->updateObjectToDb();
class_objectfactory::getInstance()->removeFromCache($this->getSystemid());
class_orm_rowcache::removeSingleRow($this->getSystemid());
$this->objDB->flushQueryCache();
$this->objSortManager->fixSortOnDelete();
$bitReturn = $bitReturn && class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED_LOGICALLY, array($this->getSystemid(), get_class($this)));
if($bitReturn) {
class_logger::getInstance()->addLogRow("successfully deleted record ".$this->getSystemid()." / ".$this->getStrDisplayName(), class_logger::$levelInfo);
$this->objDB->transactionCommit();
return true;
}
else {
class_logger::getInstance()->addLogRow("error deleting record ".$this->getSystemid()." / ".$this->getStrDisplayName(), class_logger::$levelInfo);
$this->objDB->transactionRollback();
return false;
}
}
/**
* Deletes the object from the database. The record is removed in total, so no restoring will be possible.
*
* @return bool
* @throws class_exception
*/
public function deleteObjectFromDatabase() {
if(!$this->getLockManager()->isAccessibleForCurrentUser())
return false;
if($this instanceof interface_versionable) {
$objChanges = new class_module_system_changelog();
$objChanges->createLogEntry($this, class_module_system_changelog::$STR_ACTION_DELETE);
}
/** @var $this class_root|interface_model */
$this->objDB->transactionBegin();
//validate, if there are subrecords, so child nodes to be deleted
$arrChilds = $this->objDB->getPArray("SELECT system_id FROM "._dbprefix_."system where system_prev_id = ?", array($this->getSystemid()));
foreach($arrChilds as $arrOneChild) {
if(validateSystemid($arrOneChild["system_id"])) {
$objInstance = class_objectfactory::getInstance()->getObject($arrOneChild["system_id"]);
if($objInstance !== null)
$objInstance->deleteObjectFromDatabase();
}
}
$objORM = new class_orm_objectdelete($this);
$bitReturn = $objORM->deleteObject();
$this->objSortManager->fixSortOnDelete();
$bitReturn = $bitReturn && $this->deleteSystemRecord($this->getSystemid());
class_objectfactory::getInstance()->removeFromCache($this->getSystemid());
class_orm_rowcache::removeSingleRow($this->getSystemid());
//try to call other modules, maybe wanting to delete anything in addition, if the current record
//is going to be deleted
$bitReturn = $bitReturn && class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_RECORDDELETED, array($this->getSystemid(), get_class($this)));
if($bitReturn) {
class_logger::getInstance()->addLogRow("successfully deleted record ".$this->getSystemid()." / ".$this->getStrDisplayName(), class_logger::$levelInfo);
$this->objDB->transactionCommit();
$this->objDB->flushQueryCache();
return true;
}
else {
class_logger::getInstance()->addLogRow("error deleting record ".$this->getSystemid()." / ".$this->getStrDisplayName(), class_logger::$levelInfo);
$this->objDB->transactionRollback();
$this->objDB->flushQueryCache();
return false;
}
}
// --- DATABASE-SYNCHRONIZATION -------------------------------------------------------------------------
/**
* Saves the current object to the database. Determines, whether the current object has to be inserted
* or updated to the database.
* In case of an update, the objects' updateStateToDb() method is being called (as required by class_model).
* In the case of a new object, a blank record is being created. Therefore, all tables returned by class' doc comment
* will be filled with a new record (using the same new systemid as the primary key).
* The newly created systemid is being set as the current objects' one and can be used in the afterwards
* called updateStateToDb() method to reference the correct rows.
*
* @param string|bool $strPrevId The prev-id of the records, either to be used for the insert or to be used during the update of the record
* @return bool
* @since 3.3.0
* @throws class_exception
* @see interface_model
*
* @todo move to class_orm_objectupdate completely
*/
public function updateObjectToDb($strPrevId = false) {
$bitCommit = true;
/** @var $this class_root|interface_model */
if(!$this instanceof interface_model)
throw new class_exception("current object must implemented interface_model", class_exception::$level_FATALERROR);
if(!$this->getLockManager()->isAccessibleForCurrentUser()) {
$objUser = new class_module_user_user($this->getLockManager()->getLockId());
throw new class_exception("current object is locked by user ".$objUser->getStrDisplayName(), class_exception::$level_ERROR);
}
if(is_object($strPrevId) && $strPrevId instanceof class_root)
$strPrevId = $strPrevId->getSystemid();
$this->objDB->transactionBegin();
//current systemid given? if not, create a new record.
$bitRecordCreated = false;
if(!validateSystemid($this->getSystemid())) {
$bitRecordCreated = true;
if($strPrevId === false || $strPrevId === "" || $strPrevId === null) {
//try to find the current modules-one
if(isset($this->arrModule["modul"])) {
$strPrevId = class_module_system_module::getModuleByName($this->getArrModule("modul"), true)->getSystemid();
if(!validateSystemid($strPrevId))
throw new class_exception("automatic determination of module-id failed ", class_exception::$level_FATALERROR);
}
else
throw new class_exception("insert with no previd ", class_exception::$level_FATALERROR);
}
if(!validateSystemid($strPrevId) && $strPrevId !== "0") {
throw new class_exception("insert with erroneous prev-id ", class_exception::$level_FATALERROR);
}
//create the new systemrecord
//store date-bit temporary
$bitDates = $this->bitDatesChanges;
$this->createSystemRecord($strPrevId, $this->getStrDisplayName());
$this->bitDatesChanges = $bitDates;
if(validateSystemid($this->getStrSystemid())) {
//Create the foreign records
$objAnnotations = new class_reflection($this);
$arrTargetTables = $objAnnotations->getAnnotationValuesFromClass("@targetTable");
if(count($arrTargetTables) > 0) {
foreach($arrTargetTables as $strOneConfig) {
$arrSingleTable = explode(".", $strOneConfig);
$strQuery = "INSERT INTO ".$this->objDB->encloseTableName(_dbprefix_.$arrSingleTable[0])."
(".$this->objDB->encloseColumnName($arrSingleTable[1]).") VALUES
(?) ";
if(!$this->objDB->_pQuery($strQuery, array($this->getStrSystemid())))
$bitCommit = false;
}
}
if(!$this->onInsertToDb())
$bitCommit = false;
}
else
throw new class_exception("creation of systemrecord failed", class_exception::$level_FATALERROR);
//all updates are done, start the "real" update
class_carrier::getInstance()->flushCache(class_carrier::INT_CACHE_TYPE_DBQUERIES);
}
//new prev-id?
if($strPrevId !== false && $this->getSystemid() != $strPrevId && (validateSystemid($strPrevId) || $strPrevId == "0")) {
//validate the new prev id - it is not allowed to set a parent-node as a sub-node of its own child
if(!$this->isSystemidChildNode($this->getSystemid(), $strPrevId))
$this->setStrPrevId($strPrevId);
}
//new comment?
$this->setStrRecordComment($this->getStrDisplayName());
//Keep old and new status here, status changed event is being fired after record is completely updated (so after updateStateToDb())
$intOldStatus = $this->intOldRecordStatus;
$intNewStatus = $this->intRecordStatus;
//save back to the database
$bitCommit = $bitCommit && $this->updateSystemrecord();
//update ourselves to the database
if($bitCommit && !$this->updateStateToDb())
$bitCommit = false;
//now fire the status changed event
if($intOldStatus != $intNewStatus && $intOldStatus != -1) {
class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_STATUSCHANGED, array($this->getSystemid(), $this, $intOldStatus, $intNewStatus));
}
if($bitCommit) {
$this->objDB->transactionCommit();
//unlock the record
$this->getLockManager()->unlockRecord();
class_logger::getInstance()->addLogRow("updateObjectToDb() succeeded for systemid ".$this->getSystemid()." (".$this->getRecordComment().")", class_logger::$levelInfo);
}
else {
$this->objDB->transactionRollback();
class_logger::getInstance()->addLogRow("updateObjectToDb() failed for systemid ".$this->getSystemid()." (".$this->getRecordComment().")", class_logger::$levelWarning);
}
//call the recordUpdated-Listeners
class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_RECORDUPDATED, array($this, $bitRecordCreated));
class_carrier::getInstance()->flushCache(class_carrier::INT_CACHE_TYPE_DBQUERIES);
return $bitCommit;
}
/**
* A default implementation for copy-operations.
* Overwrite this method if you want to execute additional statements.
* Please be aware that you are working on the new object afterwards!
*
* @param string $strNewPrevid
* @param bool $bitChangeTitle
* @param bool $bitCopyChilds
*
* @throws class_exception
* @return bool
*/
public function copyObject($strNewPrevid = "", $bitChangeTitle = true, $bitCopyChilds = true) {
$this->objDB->transactionBegin();
$strOldSysid = $this->getSystemid();
if($strNewPrevid == "")
$strNewPrevid = $this->strPrevId;
//any date-objects to copy?
if($this->objStartDate != null || $this->objEndDate != null || $this->objSpecialDate != null)
$this->bitDatesChanges = true;
//check if there's a title field, in most cases that could be used to change the title
if($bitChangeTitle) {
$objReflection = new class_reflection($this);
$strGetter = $objReflection->getGetter("strTitle");
$strSetter = $objReflection->getSetter("strTitle");
if($strGetter != null && $strSetter != null) {
$strTitle = call_user_func(array($this, $strGetter));
if($strTitle != "") {
call_user_func(array($this, $strSetter), $strTitle."_copy");
}
}
}
//prepare the current object
$this->unsetSystemid();
$this->arrInitRow = null;
$bitReturn = $this->updateObjectToDb($strNewPrevid);
//call event listeners
$bitReturn = $bitReturn && class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_RECORDCOPIED, array($strOldSysid, $this->getSystemid(), $this));
if($bitCopyChilds) {
//process subrecords
//validate, if there are subrecords, so child nodes to be copied to the current record
$arrChilds = $this->objDB->getPArray("SELECT system_id FROM "._dbprefix_."system where system_prev_id = ? ORDER BY system_sort ASC", array($strOldSysid));
foreach($arrChilds as $arrOneChild) {
if(validateSystemid($arrOneChild["system_id"])) {
$objInstance = class_objectfactory::getInstance()->getObject($arrOneChild["system_id"]);
if($objInstance !== null)
$objInstance->copyObject($this->getSystemid(), false);
}
}
}
if($bitReturn)
$this->objDB->transactionCommit();
else
$this->objDB->transactionRollback();
$this->objDB->flushQueryCache();
$bitReturn = $bitReturn && class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_RECORDCOPYFINISHED, array($strOldSysid, $this->getSystemid(), $this));
return $bitReturn;
}
/**
* Internal helper, checks if a child-node is the descendant of a given base-node
*
* @param string $strBaseId
* @param string $strChildId
*
* @return bool
*/
private function isSystemidChildNode($strBaseId, $strChildId) {
while(validateSystemid($strChildId)) {
$objCommon = new class_module_system_common($strChildId);
if($objCommon->getSystemid() == $strBaseId)
return true;
else
return $this->isSystemidChildNode($strBaseId, $objCommon->getPrevId());
}
return false;
}
/**
* Called whenever a update-request was fired.
* Use this method to synchronize the current object with the database.
* Use only updates, inserts are not required to be implemented.
* Provides a default implementation based on the current objects column mappings.
* Override this method whenever you want to perform additional actions or escaping.
*
* @throws class_exception
* @return bool
*/
protected function updateStateToDb() {
$objORMMapper = new class_orm_objectupdate($this);
return $objORMMapper->updateStateToDb();
}
/**
* Overwrite this method if you want to trigger additional commands during the insert
* of an object, e.g. to create additional objects / relations
*
* @return bool
*/
protected function onInsertToDb() {
return true;
}
/**
* Updates the current record to the database and saves all relevant fields.
* Please note that this method is triggered internally.
*
* @return bool
* @final
* @since 3.4.1
*
* @todo find ussages and make private
*/
protected final function updateSystemrecord() {
if(!validateSystemid($this->getSystemid()))
return true;
class_logger::getInstance()->addLogRow("updated systemrecord ".$this->getStrSystemid()." data", class_logger::$levelInfo);
if(class_module_system_module::getModuleByName("system") != null && version_compare(class_module_system_module::getModuleByName("system")->getStrVersion(), 4.5, "lt")) {
$strQuery = "UPDATE "._dbprefix_."system
SET system_prev_id = ?,
system_module_nr = ?,
system_sort = ?,
system_owner = ?,
system_lm_user = ?,
system_lm_time = ?,
system_lock_id = ?,
system_lock_time = ?,
system_status = ?,
system_comment = ?,
system_class = ?,
system_create_date = ?
WHERE system_id = ? ";
$bitReturn = $this->objDB->_pQuery(
$strQuery,
array(
$this->getStrPrevId(),
(int)$this->getIntModuleNr(),
(int)$this->getIntSort(),
$this->getStrOwner(),
$this->objSession->getUserID(),
time(),
$this->getStrLockId(),
(int)$this->getIntLockTime(),
(int)$this->getIntRecordStatus(),
uniStrTrim($this->getStrRecordComment(), 245),
$this->getStrRecordClass(),
$this->getLongCreateDate(),
$this->getSystemid()
)
);
}
else {
$strQuery = "UPDATE "._dbprefix_."system
SET system_prev_id = ?,
system_module_nr = ?,
system_sort = ?,
system_owner = ?,
system_lm_user = ?,
system_lm_time = ?,
system_lock_id = ?,
system_lock_time = ?,
system_status = ?,
system_comment = ?,
system_class = ?,
system_create_date = ?,
system_deleted = ?
WHERE system_id = ? ";
$bitReturn = $this->objDB->_pQuery(
$strQuery,
array(
$this->getStrPrevId(),
(int)$this->getIntModuleNr(),
(int)$this->getIntSort(),
$this->getStrOwner(),
$this->objSession->getUserID(),
time(),
$this->getStrLockId(),
(int)$this->getIntLockTime(),
(int)$this->getIntRecordStatus(),
uniStrTrim($this->getStrRecordComment(), 245),
$this->getStrRecordClass(),
$this->getLongCreateDate(),
$this->getIntRecordDeleted(),
$this->getSystemid()
)
);
}
if($this->bitDatesChanges) {
$this->processDateChanges();
}
class_carrier::getInstance()->flushCache(class_carrier::INT_CACHE_TYPE_DBQUERIES | class_carrier::INT_CACHE_TYPE_ORMCACHE);
if($this->strOldPrevId != $this->strPrevId && $this->strOldPrevId != -1) {
class_carrier::getInstance()->getObjRights()->rebuildRightsStructure($this->getSystemid());
class_core_eventdispatcher::getInstance()->notifyGenericListeners(class_system_eventidentifier::EVENT_SYSTEM_PREVIDCHANGED, array($this->getSystemid(), $this->strOldPrevId, $this->strPrevId));
}
if($this->strOldPrevId != $this->strPrevId) {
$this->objSortManager->fixSortOnPrevIdChange($this->strOldPrevId, $this->strPrevId);
}
$this->strOldPrevId = $this->strPrevId;
$this->intOldRecordStatus = $this->intRecordStatus;
return $bitReturn;
}
/**
* Internal helper to fetch the next sort-id
* @param string $strPrevId
*
* @return int
*/
private function getNextSortValue($strPrevId) {
//determine the correct new sort-id - append by default
if(class_module_system_module::getModuleByName("system") != null && version_compare(class_module_system_module::getModuleByName("system")->getStrVersion(), "4.7.5", "lt")) {
$strQuery = "SELECT COUNT(*) FROM "._dbprefix_."system WHERE system_prev_id = ? AND system_id != '0'";
}
else {
$strQuery = "SELECT COUNT(*) FROM "._dbprefix_."system WHERE system_prev_id = ? AND system_id != '0' AND system_deleted = 0";
}
$arrRow = $this->objDB->getPRow($strQuery, array($strPrevId), 0, false);
$intSiblings = $arrRow["COUNT(*)"];
return (int)($intSiblings+1);
}
/**
* Generates a new SystemRecord and, if needed, the corresponding record in the rights-table (here inheritance is default)
* Returns the systemID used for this record
*
* @param string $strPrevId Previous ID in the tree-structure
* @param string $strComment Comment to identify the record
* @return string The ID used/generated
*
* * @todo find ussages and make private
*/
private function createSystemRecord($strPrevId, $strComment) {
$strSystemId = generateSystemid();
$this->setStrSystemid($strSystemId);
//Correct prevID
if($strPrevId == "")
$strPrevId = 0;
$this->setStrPrevId($strPrevId);
//determine the correct new sort-id - append by default
if(class_module_system_module::getModuleByName("system") != null && version_compare(class_module_system_module::getModuleByName("system")->getStrVersion(), "4.7.5", "lt")) {
$strQuery = "SELECT COUNT(*) FROM "._dbprefix_."system WHERE system_prev_id = ? AND system_id != '0'";
}
else {
$strQuery = "SELECT COUNT(*) FROM "._dbprefix_."system WHERE system_prev_id = ? AND system_id != '0' AND system_deleted = 0";
}
$arrRow = $this->objDB->getPRow($strQuery, array($strPrevId), 0, false);
$intSiblings = $arrRow["COUNT(*)"];
$strComment = uniStrTrim(strip_tags($strComment), 240);
if(class_module_system_module::getModuleByName("system") != null && version_compare(class_module_system_module::getModuleByName("system")->getStrVersion(), "4.7.5", "lt")) {
//So, lets generate the record
$strQuery = "INSERT INTO "._dbprefix_."system
( system_id, system_prev_id, system_module_nr, system_owner, system_create_date, system_lm_user,
system_lm_time, system_status, system_comment, system_sort, system_class) VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
//Send the query to the db
$this->objDB->_pQuery(
$strQuery,
array(
$strSystemId,
$strPrevId,
$this->getIntModuleNr(),
$this->objSession->getUserID(),
class_date::getCurrentTimestamp(),
$this->objSession->getUserID(),
time(),
(int)$this->getIntRecordStatus(),
$strComment,
$this->getNextSortValue($strPrevId),
$this->getStrRecordClass()
)
);
}
else {
//So, lets generate the record
$strQuery = "INSERT INTO "._dbprefix_."system
( system_id, system_prev_id, system_module_nr, system_owner, system_create_date, system_lm_user,
system_lm_time, system_status, system_comment, system_sort, system_class, system_deleted) VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
//Send the query to the db
$this->objDB->_pQuery(
$strQuery,
array(
$strSystemId,
$strPrevId,
$this->getIntModuleNr(),
$this->objSession->getUserID(),
class_date::getCurrentTimestamp(),
$this->objSession->getUserID(),
time(),
(int)$this->getIntRecordStatus(),
$strComment,
(int)($intSiblings + 1),
$this->getStrRecordClass(),
$this->getIntRecordDeleted()
)
);
}
//we need a Rights-Record
$this->objDB->_pQuery("INSERT INTO "._dbprefix_."system_right (right_id, right_inherit) VALUES (?, 1)", array($strSystemId));
//update rights to inherit
class_carrier::getInstance()->getObjRights()->setInherited(true, $strSystemId);
class_logger::getInstance()->addLogRow("new system-record created: ".$strSystemId ." (".$strComment.")", class_logger::$levelInfo);
$this->objDB->flushQueryCache();
$this->internalInit();
//reset the old values since we're having a new record
$this->strOldPrevId = -1;
$this->intOldRecordStatus = -1;
return $strSystemId;
}
/**
* Process date changes handles the insert and update of date-objects.
* It replaces the old createDate and updateDate methods
* @return bool
*/
private function processDateChanges() {
$intStart = 0;
$intEnd = 0;
$intSpecial = 0;
if($this->objStartDate != null && $this->objStartDate instanceof class_date)
$intStart = $this->objStartDate->getLongTimestamp();
if($this->objEndDate != null && $this->objEndDate instanceof class_date)
$intEnd = $this->objEndDate->getLongTimestamp();
if($this->objSpecialDate != null && $this->objSpecialDate instanceof class_date)
$intSpecial = $this->objSpecialDate->getLongTimestamp();
$arrRow = $this->objDB->getPRow("SELECT COUNT(*) FROM "._dbprefix_."system_date WHERE system_date_id = ?", array($this->getSystemid()));
if($arrRow["COUNT(*)"] == 0) {
//insert
$strQuery = "INSERT INTO "._dbprefix_."system_date
(system_date_id, system_date_start, system_date_end, system_date_special) VALUES
(?, ?, ?, ?)";
return $this->objDB->_pQuery($strQuery, array($this->getSystemid(), $intStart, $intEnd, $intSpecial));
}
else {
$strQuery = "UPDATE "._dbprefix_."system_date
SET system_date_start = ?,
system_date_end = ?,
system_date_special = ?
WHERE system_date_id = ?";
return $this->objDB->_pQuery($strQuery, array($intStart, $intEnd, $intSpecial, $this->getSystemid()));
}
}
/**
* Creates a record in the date table. Make sure to use a proper system-id!
* Up from Kajona V3.3, the signature changed. Pass instances of class_date instead of
* int-values.
*
* @param string $strSystemid
* @param class_date $objStartDate
* @param class_date $objEndDate
* @param class_date $objSpecialDate
* @deprecated use the internal date-objects to have all dates handled automatically
* @return bool
*/
public function createDateRecord($strSystemid, class_date $objStartDate = null, class_date $objEndDate = null, class_date $objSpecialDate = null) {
$intStart = 0;
$intEnd = 0;
$intSpecial = 0;
if($objStartDate != null && $objStartDate instanceof class_date)
$intStart = $objStartDate->getLongTimestamp();
if($objEndDate != null && $objEndDate instanceof class_date)
$intEnd = $objEndDate->getLongTimestamp();
if($objSpecialDate != null && $objSpecialDate instanceof class_date)
$intSpecial = $objSpecialDate->getLongTimestamp();
$strQuery = "INSERT INTO "._dbprefix_."system_date
(system_date_id, system_date_start, system_date_end, system_date_special) VALUES
(?, ?, ?, ?)";
return $this->objDB->_pQuery($strQuery, array($strSystemid, $intStart, $intEnd, $intSpecial));
}
/**
* Updates a record in the date table. Make sure to use a proper system-id!
* Up from Kajona V3.3, the signature changed. Pass instances of class_date instead of
* int-values.
*
* @param string $strSystemid
* @param class_date $objStartDate
* @param class_date $objEndDate
* @param class_date $objSpecialDate
* @deprecated use the internal date-objects to have all dates handled automatically
* @return bool
*/
public function updateDateRecord($strSystemid, class_date $objStartDate = null, class_date $objEndDate = null, class_date $objSpecialDate = null) {
$intStart = 0;
$intEnd = 0;
$intSpecial = 0;
if($objStartDate != null && $objStartDate instanceof class_date)
$intStart = $objStartDate->getLongTimestamp();
if($objEndDate != null && $objEndDate instanceof class_date)
$intEnd = $objEndDate->getLongTimestamp();
if($objSpecialDate != null && $objSpecialDate instanceof class_date)
$intSpecial = $objSpecialDate->getLongTimestamp();
$strQuery = "UPDATE "._dbprefix_."system_date
SET system_date_start = ?,
system_date_end = ?,
system_date_special = ?
WHERE system_date_id = ?";
return $this->objDB->_pQuery($strQuery, array($intStart, $intEnd, $intSpecial, $strSystemid));
}
/**
* Returns the bool-value for the right to view this record,
* Systemid MUST be given, otherwise false
*
* @return bool
*/
public function rightView() {
return class_carrier::getInstance()->getObjRights()->rightView($this->getSystemid());
}
/**
* Returns the bool-value for the right to edit this record,
* Systemid MUST be given, otherwise false
*
* @return bool
*/
public function rightEdit() {
return class_carrier::getInstance()->getObjRights()->rightEdit($this->getSystemid());
}
/**
* Returns the bool-value for the right to delete this record,
* Systemid MUST be given, otherwise false
*
* @return bool
*/
public function rightDelete() {
return class_carrier::getInstance()->getObjRights()->rightDelete($this->getSystemid());
}
/**
* Returns the bool-value for the right to change rights of this record,
* Systemid MUST be given, otherwise false
*
* @return bool
*/
public function rightRight() {
return class_carrier::getInstance()->getObjRights()->rightRight($this->getSystemid());
}
/**
* Returns the bool-value for the right1 of this record,
* Systemid MUST be given, otherwise false
*
* @return bool
*/
public function rightRight1() {
return class_carrier::getInstance()->getObjRights()->rightRight1($this->getSystemid());
}
/**
* Returns the bool-value for the right2 of this record,
* Systemid MUST be given, otherwise false
*
* @return bool
*/
public function rightRight2() {
return class_carrier::getInstance()->getObjRights()->rightRight2($this->getSystemid());
}
/**
* Returns the bool-value for the right3 of this record,
* Systemid MUST be given, otherwise false
*
* @return bool
*/
public function rightRight3() {
return class_carrier::getInstance()->getObjRights()->rightRight3($this->getSystemid());
}
/**
* Returns the bool-value for the right4 of this record,
* Systemid MUST be given, otherwise false
*
* @return bool
*/
public function rightRight4() {
return class_carrier::getInstance()->getObjRights()->rightRight4($this->getSystemid());
}
/**
* Returns the bool-value for the right5 of this record,
* Systemid MUST be given, otherwise false
*
* @return bool
*/
public function rightRight5() {
return class_carrier::getInstance()->getObjRights()->rightRight5($this->getSystemid());
}
/**
* Returns the bool-value for the changelog permissions of this record,
* Systemid MUST be given, otherwise false
*
* @return bool
*/
public function rightChangelog() {
return class_carrier::getInstance()->getObjRights()->rightChangelog($this->getSystemid());
}
// --- SystemID & System-Table Methods ------------------------------------------------------------------
/**
* Fetches the number of siblings belonging to the passed systemid
*
* @param string $strSystemid
* @param bool $bitUseCache
* @return int
* @deprecated
*/
public function getNumberOfSiblings($strSystemid = "", $bitUseCache = true) {
if($strSystemid == "")
$strSystemid = $this->getSystemid();
$strQuery = "SELECT COUNT(*)
FROM "._dbprefix_."system as sys1,
"._dbprefix_."system as sys2
WHERE sys1.system_id=?
AND sys2.system_prev_id = sys1.system_prev_id";
$arrRow = $this->objDB->getPRow($strQuery, array($strSystemid), 0, $bitUseCache);
return $arrRow["COUNT(*)"];
}
/**
* Fetches the records placed as child nodes of the current / passed id.
* <b> Only the IDs are fetched since the current object-context is not available!!! </b>
*
* @param string $strSystemid
* @return string[]
* @deprecated
*/
public function getChildNodesAsIdArray($strSystemid = "") {
if($strSystemid == "")
$strSystemid = $this->getSystemid();
$objORM = new class_orm_objectlist();
$strQuery = "SELECT system_id
FROM "._dbprefix_."system
WHERE system_prev_id=?
AND system_id != '0'
".$objORM->getDeletedWhereRestriction()."
ORDER BY system_sort ASC";
$arrReturn = array();
$arrTemp = $this->objDB->getPArray($strQuery, array($strSystemid));
if(count($arrTemp) > 0)
foreach($arrTemp as $arrOneRow)
$arrReturn[] = $arrOneRow["system_id"];
return $arrReturn;
}
/**
* Fetches all child nodes recusrsively of the current / passed id.
* <b> Only the IDs are fetched since the current object-context is not available!!! </b>
*
* @param string $strSystemid
* @return string[]
* @deprecated
*/
public function getAllSubChildNodesAsIdArray($strSystemid = "") {
$arrReturn = $this->getChildNodesAsIdArray($strSystemid);
if(count($arrReturn) > 0) {
foreach($arrReturn as $strId) {
$arrReturn = array_merge($arrReturn, $this->getAllSubChildNodesAsIdArray($strId));
}
}
return $arrReturn;
}
/**
* Sets the Position of a SystemRecord in the currect level one position upwards or downwards
*
* @param string $strDirection upwards || downwards
* @return void
* @deprecated
*/
public function setPosition($strDirection = "upwards") {
$this->objSortManager->setPosition($strDirection);
}
/**
* Sets the position of systemid using a given value.
*
* @param int $intNewPosition
* @param array|bool $arrRestrictionModules If an array of module-ids is passed, the determination of siblings will be limited to the module-records matching one of the module-ids
*
* @return void
*/
public function setAbsolutePosition($intNewPosition, $arrRestrictionModules = false) {
$this->objSortManager->setAbsolutePosition($intNewPosition, $arrRestrictionModules);
}
/**
* Return a complete SystemRecord
*
* @param string $strSystemid
* @return mixed
*/
public function getSystemRecord($strSystemid = "") {
if($strSystemid == "")
$strSystemid = $this->getSystemid();
$strQuery = "SELECT * FROM "._dbprefix_."system
LEFT JOIN "._dbprefix_."system_right
ON system_id = right_id
LEFT JOIN "._dbprefix_."system_date
ON system_id = system_date_id
WHERE system_id = ?";
return $this->objDB->getPRow($strQuery, array($strSystemid));
}
/**
* Returns the data for a registered module
*
* @param string $strName
* @param bool $bitCache
* @return mixed
* @deprecated
* @see class_module_system_module::getPlainModuleData($strName, $bitCache)
*/
public function getModuleData($strName, $bitCache = true) {
return class_module_system_module::getPlainModuleData($strName, $bitCache);
}
/**
* Deletes a record from the SystemTable
*
* @param string $strSystemid
* @param bool $bitRight
* @param bool $bitDate
* @return bool
* @todo: remove first params, is always the current systemid. maybe mark as protected, currently only called by the test-classes
*
* * @todo find ussages and make private
*
*/
public final function deleteSystemRecord($strSystemid, $bitRight = true, $bitDate = true) {
$bitResult = true;
//Start a tx before deleting anything
$this->objDB->transactionBegin();
$strQuery = "DELETE FROM "._dbprefix_."system WHERE system_id = ?";
$bitResult = $bitResult && $this->objDB->_pQuery($strQuery, array($strSystemid));
if($bitRight) {
$strQuery = "DELETE FROM "._dbprefix_."system_right WHERE right_id = ?";
$bitResult = $bitResult && $this->objDB->_pQuery($strQuery, array($strSystemid));
}
if($bitDate) {
$strQuery = "DELETE FROM "._dbprefix_."system_date WHERE system_date_id = ?";
$bitResult = $bitResult && $this->objDB->_pQuery($strQuery, array($strSystemid));
}
//end tx
if($bitResult) {
$this->objDB->transactionCommit();
class_logger::getInstance()->addLogRow("deleted system-record with id ".$strSystemid, class_logger::$levelInfo);
}
else {
$this->objDB->transactionRollback();;
class_logger::getInstance()->addLogRow("deletion of system-record with id ".$strSystemid." failed", class_logger::$levelWarning);
}
//flush the cache
$this->flushCompletePagesCache();
return $bitResult;
}
/**
* Deletes a record from the rights-table
*
* @param string $strSystemid
* @return bool
*/
public function deleteRight($strSystemid) {
$strQuery = "DELETE FROM "._dbprefix_."system_right WHERE right_id = ?";
return $this->objDB->_pQuery($strQuery, array($strSystemid));
}
/**
* Generates a sorted array of systemids, reaching from the passed systemid up
* until the assigned module-id
*
* @param string $strSystemid
* @param string $strStopSystemid
* @return mixed
*/
public function getPathArray($strSystemid = "", $strStopSystemid = "0") {
$arrReturn = array();
if($strSystemid == "") {
$strSystemid = $this->getSystemid();
}
//loop over all parent-records
$strTempId = $strSystemid;
while($strTempId != "0" && $strTempId != "" && $strTempId != -1 && $strTempId != $strStopSystemid) {
$arrReturn[] = $strTempId;
$objCommon = class_objectfactory::getInstance()->getObject($strTempId);
if($objCommon === null) {
break;
}
$strTempId = $objCommon->getPrevId();
}
$arrReturn = array_reverse($arrReturn);
return $arrReturn;
}
/**
* Returns a value from the $arrModule array.
* If the requested key not exists, returns ""
*
* @param string $strKey
* @return string
*/
public function getArrModule($strKey) {
if(isset($this->arrModule[$strKey]))
return $this->arrModule[$strKey];
else
return "";
}
// --- TextMethods --------------------------------------------------------------------------------------
/**
* Used to load a property.
* If you want to provide a list of parameters but no module (automatic loading), pass
* the parameters array as the second argument (an array). In this case the module is resolved
* internally.
*
* @param string $strName
* @param string|array $strModule Either the module name (if required) or an array of parameters
* @param array $arrParameters
*
* @return string
*/
public function getLang($strName, $strModule = "", $arrParameters = array()) {
if(is_array($strModule))
$arrParameters = $strModule;
if($strModule == "" || is_array($strModule)) {
$strModule = $this->getArrModule("modul");
}
//Now we have to ask the Text-Object to return the text
return $this->objLang->getLang($strName, $strModule, $arrParameters);
}
/**
* Returns the current Text-Object Instance
*
* @return class_lang
*/
protected function getObjLang() {
return $this->objLang;
}
// --- PageCache Features -------------------------------------------------------------------------------
/**
* Deletes the complete Pages-Cache
*
* @return bool
*/
public function flushCompletePagesCache() {
return class_cache::flushCache("class_element_portal");
}
/**
* Removes one page from the cache
*
* @param string $strPagename
* @return bool
*/
public function flushPageFromPagesCache($strPagename) {
return class_cache::flushCache("class_element_portal", $strPagename);
}
// --- Portal-Language ----------------------------------------------------------------------------------
/**
* Returns the language to display contents on the portal
*
* @return string
*/
public final function getStrPortalLanguage() {
$objLanguage = new class_module_languages_language();
return $objLanguage->getPortalLanguage();
}
// --- Admin-Language ----------------------------------------------------------------------------------
/**
* Returns the language to display contents or to edit contents on adminside
* NOTE: THIS ARE THE CONTENTS, NOT THE TEXTS
*
* @return string
*/
public final function getStrAdminLanguageToWorkOn() {
$objLanguage = new class_module_languages_language();
return $objLanguage->getAdminLanguage();
}
// --- GETTERS / SETTERS ----------------------------------------------------------------------------
/**
* Sets the current SystemID
*
* @param string $strID
* @return bool
*/
public function setSystemid($strID) {
if(validateSystemid($strID)) {
$this->strSystemid = $strID;
return true;
}
else
return false;
}
/**
* Resets the current systemid
* @return void
*/
public function unsetSystemid() {
$this->strSystemid = "";
}
/**
* Returns the current SystemID
*
* @return string
*/
public function getSystemid() {
return $this->strSystemid;
}
/**
* @return string
*/
public function getStrSystemid() {
return $this->strSystemid;
}
/**
* @param string $strSystemid
* @return void
*/
public function setStrSystemid($strSystemid) {
if(validateSystemid($strSystemid)) {
$this->strSystemid = $strSystemid;
}
}
/**
* Gets the Prev-ID of a record
*
* @param string $strSystemid
*
* @throws class_exception
* @return string
*/
public function getPrevId($strSystemid = "") {
if($strSystemid != "")
throw new class_exception("unsupported param @ ".__METHOD__, class_exception::$level_FATALERROR);
return $this->getStrPrevId();
}
/**
* @return string
*/
public function getStrPrevId() {
return $this->strPrevId;
}
/**
* @param string $strPrevId
* @return void
*/
public function setStrPrevId($strPrevId) {
if(validateSystemid($strPrevId) || $strPrevId === "0") {
$this->strPrevId = $strPrevId;
}
}
/**
* Gets the module id / module nr of a systemRecord
*
* @param string $strSystemid
*
* @throws class_exception
* @return int
*/
public function getRecordModuleNr($strSystemid = "") {
if($strSystemid != "")
throw new class_exception("unsupported param @ ".__METHOD__, class_exception::$level_FATALERROR);
return $this->getIntModuleNr();
}
/**
* @return int
*/
public function getIntModuleNr() {
return $this->intModuleNr;
}
/**
* @param int $intModuleNr
* @return void
*/
public function setIntModuleNr($intModuleNr) {
$this->intModuleNr = $intModuleNr;
}
/**
* @return int
*/
public function getIntSort() {
return $this->intSort;
}
/**
* @param int $intSort
* @return void
*/
public function setIntSort($intSort) {
$this->intSort = $intSort;
}
/**
* Returns the name of the user who last edited the record
*
* @param string $strSystemid
*
* @throws class_exception
* @return string
*/
public function getLastEditUser($strSystemid = "") {
if($strSystemid != "")
throw new class_exception("unsupported param @ ".__METHOD__, class_exception::$level_FATALERROR);
if(validateSystemid($this->getStrLmUser())) {
$objUser = new class_module_user_user($this->getStrLmUser());
return $objUser->getStrDisplayName();
}
else
return "System";
}
/**
* @return string string
*/
public function getStrLmUser() {
return $this->strLmUser;
}
/**
* Returns the id of the user who last edited the record
*
* @return string
*/
public function getLastEditUserId() {
return $this->getStrLmUser();
}
/**
* @param string $strLmUser
* @return void
*/
public function setStrLmUser($strLmUser) {
$this->strLmUser = $strLmUser;
}
/**
* @return int
*/
public function getIntLmTime() {
return $this->intLmTime;
}
/**
* @param int $strLmTime
* @return void
*/
public function setIntLmTime($strLmTime) {
$this->intLmTime = $strLmTime;
}
/**
* @return string
*/
public function getStrLockId() {
return $this->strLockId;
}
/**
* @param string $strLockId
* @return void
*/
public function setStrLockId($strLockId) {
$this->strLockId = $strLockId;
}
/**
* @return int
*/
public function getIntLockTime() {
return $this->intLockTime;
}
/**
* @param int $intLockTime
* @return void
*/
public function setIntLockTime($intLockTime) {
$this->intLockTime = $intLockTime;
}
/**
* @return int
*/
public function getLongCreateDate() {
return $this->longCreateDate;
}
/**
* Returns the creation-date of the current record
*
* @param string $strSystemid
*
* @throws class_exception
* @return class_date
*/
public function getObjCreateDate($strSystemid = "") {
if($strSystemid != "")
throw new class_exception("unsupported param @ ".__METHOD__, class_exception::$level_FATALERROR);
return new class_date($this->getLongCreateDate());
}
/**
* @param int $longCreateDate
* @return void
*/
public function setLongCreateDate($longCreateDate) {
$this->longCreateDate = $longCreateDate;
}
/**
* @return string
*/
public function getStrOwner() {
return $this->strOwner;
}
/**
* @param string $strOwner
* @return void
*/
public function setStrOwner($strOwner) {
$this->strOwner = $strOwner;
}
/**
* Gets the id of the user currently being the owner of the record
*
* @param string $strSystemid
*
* @throws class_exception
* @return string
*/
public final function getOwnerId($strSystemid = "") {
if($strSystemid != "")
throw new class_exception("unsupported param @ ".__METHOD__, class_exception::$level_FATALERROR);
return $this->getStrOwner();
}
/**
* Sets the id of the user who owns this record.
* Please note that since 4.4, setting an owner-id no longer fires an updateObjectToDb()!
*
* @param string $strOwner
* @param string $strSystemid
* @deprecated
*
* @throws class_exception
* @return bool
*/
public final function setOwnerId($strOwner, $strSystemid = "") {
if($strSystemid != "")
throw new class_exception("unsupported param @ ".__METHOD__, class_exception::$level_FATALERROR);
$this->setStrOwner($strOwner);
return true;
}
/**
* @return int
*/
public function getIntRecordStatus() {
return $this->intRecordStatus;
}
/**
* @return int
*/
public function getIntRecordDeleted() {
return $this->intRecordDeleted;
}
/**
* Gets the status of a systemRecord
*
* @param string $strSystemid
*
* @throws class_exception
* @return int
* @deprecated use class_root::getIntRecordStatus() instead
* @see class_root::getIntRecordStatus()
*/
public function getStatus($strSystemid = "") {
if($strSystemid != "")
throw new class_exception("unsupported param @ ".__METHOD__, class_exception::$level_FATALERROR);
return $this->getIntRecordStatus();
}
/**
* Sets the internal status. Fires a status-changed event.
*
* @param int $intRecordStatus
*/
public function setIntRecordStatus($intRecordStatus) {
$this->intRecordStatus = $intRecordStatus;
}
/**
* Gets comment saved with the record
*
* @param string $strSystemid
*
* @throws class_exception
* @return string
*/
public function getRecordComment($strSystemid = "") {
if($strSystemid != "")
throw new class_exception("unsupported param @ ".__METHOD__, class_exception::$level_FATALERROR);
return $this->getStrRecordComment();
}
/**
* @return string
*/
public function getStrRecordComment() {
return $this->strRecordComment;
}
/**
* @param string $strRecordComment
* @return void
*/
public function setStrRecordComment($strRecordComment) {
if(uniStrlen($strRecordComment) > 254)
$strRecordComment = uniStrTrim($strRecordComment, 250);
$this->strRecordComment = $strRecordComment;
}
/**
* @param string $strRecordClass
* @return void
*/
public function setStrRecordClass($strRecordClass) {
$this->strRecordClass = $strRecordClass;
}
/**
* @return string
* @return void
*/
public function getStrRecordClass() {
return $this->strRecordClass;
}
/**
* Writes a value to the params-array
*
* @param string $strKey
* @param mixed $mixedValue Value
* @return void
*/
public function setParam($strKey, $mixedValue) {
class_carrier::getInstance()->setParam($strKey, $mixedValue);
}
/**
* Returns a value from the params-Array
*
* @param string $strKey
* @return string else ""
*/
public function getParam($strKey) {
return class_carrier::getInstance()->getParam($strKey);
}
/**
* Returns the complete Params-Array
*
* @return mixed
*/
public final function getAllParams() {
return class_carrier::getAllParams();
}
/**
* returns the action used for the current request
*
* @return string
*/
public final function getAction() {
return (string)$this->strAction;
}
/**
* Returns an instance of the lockmanager, initialized
* with the current systemid.
*
* @return class_lockmanager
*/
public function getLockManager() {
return new class_lockmanager($this->getSystemid(), $this);
}
/**
* Writes a key-value-pair to the arrModule
*
* @param string $strKey
* @param mixed $strValue
* @return void
*/
public function setArrModuleEntry($strKey, $strValue) {
$this->arrModule[$strKey] = $strValue;
}
/**
* Use this method to set an array of values, e.g. fetched by your own init-method.
* If given, the root-class uses this array to set the internal fields instead of
* triggering another query to the database.
* On high-performance systems or large object-nets, this could reduce the amount of database-queries
* fired drastically.
* For best performance, include the matching row of the tables system, system_date and system_rights
*
* @param array $arrInitRow
* @return void
*/
public function setArrInitRow($arrInitRow) {
if(isset($arrInitRow["system_id"])) {
$this->arrInitRow = $arrInitRow;
}
}
/**
* Returns the set of internal values marked as init-values
* @return null|array
*/
public function getArrInitRow() {
return $this->arrInitRow;
}
/**
* @param \class_date $objEndDate
* @return void
*/
public function setObjEndDate($objEndDate = null) {
if($objEndDate === 0)
$objEndDate = null;
if(!$objEndDate instanceof class_date && $objEndDate != "" && $objEndDate != null)
$objEndDate = new class_date($objEndDate);
$this->objEndDate = $objEndDate;
$this->bitDatesChanges = true;
}
/**
* @return class_date
*/
public function getObjEndDate() {
return $this->objEndDate;
}
/**
* @param \class_date $objSpecialDate
* @return void
*/
public function setObjSpecialDate($objSpecialDate = null) {
if($objSpecialDate === 0)
$objSpecialDate = null;
if(!$objSpecialDate instanceof class_date && $objSpecialDate != "" && $objSpecialDate != null)
$objSpecialDate = new class_date($objSpecialDate);
$this->objSpecialDate = $objSpecialDate;
$this->bitDatesChanges = true;
}
/**
* @return class_date
*/
public function getObjSpecialDate() {
return $this->objSpecialDate;
}
/**
* @param class_date $objStartDate
* @return void
*/
public function setObjStartDate($objStartDate = null) {
if($objStartDate === 0)
$objStartDate = null;
if(!$objStartDate instanceof class_date && $objStartDate != "" && $objStartDate != null)
$objStartDate = new class_date($objStartDate);
$this->bitDatesChanges = true;
$this->objStartDate = $objStartDate;
}
/**
* @return class_date
*/
public function getObjStartDate() {
return $this->objStartDate;
}
}
|
lgpl-2.1
|
MenoData/Time4J
|
base/src/test/java/net/time4j/range/YearsTest.java
|
9209
|
package net.time4j.range;
import net.time4j.CalendarUnit;
import net.time4j.Duration;
import net.time4j.PlainDate;
import net.time4j.PlainTimestamp;
import net.time4j.Weekcycle;
import net.time4j.engine.TimeSpan;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.text.ParseException;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
@RunWith(JUnit4.class)
public class YearsTest {
@Test
public void integer_MIN_VALUE() {
assertThat(
Years.ofGregorian(Integer.MIN_VALUE).getPartialAmount(CalendarUnit.YEARS),
is(-2147483648L));
assertThat(
Years.ofGregorian(Integer.MIN_VALUE).getAmount(),
is(-2147483648));
assertThat(
Years.ofGregorian(Integer.MIN_VALUE).getTotalLength().size(),
is(1));
assertThat(
Years.ofGregorian(Integer.MIN_VALUE).getTotalLength().get(0),
is(TimeSpan.Item.of(-((long) Integer.MIN_VALUE), CalendarUnit.YEARS)));
assertThat(
Years.ofGregorian(Integer.MIN_VALUE).isNegative(),
is(true));
assertThat(
Years.ofGregorian(Integer.MIN_VALUE).toString(),
is("-P2147483648Y"));
}
@Test
public void zero() {
assertThat(
Years.ZERO == Years.ofGregorian(0),
is(true));
assertThat(
Years.ZERO.getPartialAmount(CalendarUnit.YEARS),
is(0L));
assertThat(
Years.ZERO.getAmount(),
is(0));
assertThat(
Years.ZERO.getTotalLength().size(),
is(0));
assertThat(
Years.ZERO.isEmpty(),
is(true));
assertThat(
Years.ZERO.toString(),
is("P0Y"));
}
@Test
public void one() {
assertThat(
Years.ONE == Years.ofGregorian(1),
is(true));
assertThat(
Years.ONE.getPartialAmount(CalendarUnit.YEARS),
is(1L));
assertThat(
Years.ONE.getAmount(),
is(1));
assertThat(
Years.ONE.getTotalLength().size(),
is(1));
assertThat(
Years.ONE.isPositive(),
is(true));
assertThat(
Years.ONE.toString(),
is("P1Y"));
}
@Test
public void signQuery() {
assertThat(
Years.ofGregorian(2).isPositive(),
is(true));
assertThat(
Years.ofGregorian(2).isEmpty(),
is(false));
assertThat(
Years.ofGregorian(2).isNegative(),
is(false));
assertThat(
Years.ofGregorian(-2).isNegative(),
is(true));
assertThat(
Years.ofGregorian(-2).isEmpty(),
is(false));
assertThat(
Years.ofGregorian(-2).isPositive(),
is(false));
}
@Test
public void contains() {
assertThat(Years.ZERO.contains(CalendarUnit.YEARS), is(false));
assertThat(Years.ONE.contains(CalendarUnit.YEARS), is(true));
}
@Test
public void addToPlainDate() {
assertThat(
PlainDate.of(1984, 2, 29).plus(Years.ofGregorian(5)),
is(PlainDate.of(1989, 2, 28)));
assertThat(
Years.ofGregorian(5).addTo(PlainDate.of(1984, 2, 29)),
is(PlainDate.of(1989, 2, 28)));
}
@Test
public void subtractFromPlainDate() {
assertThat(
PlainDate.of(1984, 2, 29).minus(Years.ofGregorian(5)),
is(PlainDate.of(1979, 2, 28)));
assertThat(
Years.ofGregorian(5).subtractFrom(PlainDate.of(1984, 2, 29)),
is(PlainDate.of(1979, 2, 28)));
}
@Test
public void betweenPlainDatesOrTimestamps() {
assertThat(
Years.between(PlainDate.of(1979, 2, 28), PlainDate.of(1985, 2, 27)),
is(Years.ofGregorian(5)));
assertThat(
Years.between(PlainTimestamp.of(1979, 2, 28, 9, 15), PlainTimestamp.of(1985, 2, 28, 9, 15)),
is(Years.ofGregorian(6)));
}
@Test
public void betweenCalendarYears() {
CalendarYear y1 = CalendarYear.of(2013);
CalendarYear y2 = CalendarYear.of(2017);
assertThat(Years.between(y1, y2), is(Years.ofGregorian(4)));
}
@Test
public void abs() {
assertThat(
Years.ofGregorian(-24).abs(),
is(Years.ofGregorian(24)));
assertThat(
Years.ofGregorian(24).abs(),
is(Years.ofGregorian(24)));
assertThat(
Years.ZERO.abs(),
is(Years.ofGregorian(0)));
}
@Test(expected=ArithmeticException.class)
public void absOverflow() {
Years.ofGregorian(Integer.MIN_VALUE).abs();
}
@Test
public void inverse() {
assertThat(
Years.ofGregorian(-24).inverse(),
is(Years.ofGregorian(24)));
assertThat(
Years.ofGregorian(24).inverse(),
is(Years.ofGregorian(-24)));
assertThat(
Years.ZERO.inverse(),
is(Years.ofGregorian(0)));
}
@Test(expected=ArithmeticException.class)
public void inverseOverflow() {
Years.ofGregorian(Integer.MIN_VALUE).inverse();
}
@Test
public void plus() {
assertThat(
Years.ofGregorian(-24).plus(Years.ofGregorian(3)),
is(Years.ofGregorian(-21)));
assertThat(
Years.ofGregorian(24).plus(3),
is(Years.ofGregorian(27)));
assertThat(
Years.ZERO.plus(0),
is(Years.ofGregorian(0)));
}
@Test(expected=ArithmeticException.class)
public void plusOverflow() {
Years.ofGregorian(2).plus(Integer.MAX_VALUE);
}
@Test
public void minus() {
assertThat(
Years.ofGregorian(-24).minus(Years.ofGregorian(3)),
is(Years.ofGregorian(-27)));
assertThat(
Years.ofGregorian(24).minus(3),
is(Years.ofGregorian(21)));
assertThat(
Years.ZERO.minus(0),
is(Years.ofGregorian(0)));
}
@Test(expected=ArithmeticException.class)
public void minusOverflow() {
Years.ofGregorian(-2).minus(Integer.MAX_VALUE);
}
@Test
public void multipliedBy() {
assertThat(
Years.ofGregorian(-24).multipliedBy(-3),
is(Years.ofGregorian(72)));
assertThat(
Years.ZERO.multipliedBy(10),
is(Years.ofGregorian(0)));
}
@Test(expected=ArithmeticException.class)
public void multipliedByOverflow() {
Years.ofGregorian(-2).multipliedBy(Integer.MAX_VALUE);
}
@Test
public void parse() throws ParseException {
assertThat(
Years.parseGregorian("-P35Y"),
is(Years.ofGregorian(-35)));
assertThat(
Years.parseGregorian("P35Y"),
is(Years.ofGregorian(35)));
assertThat(
Years.parseGregorian("P0Y"),
is(Years.ZERO));
}
@Test(expected=ParseException.class)
public void parseNoLiteralP() throws ParseException {
Years.parseGregorian("-35Y");
}
@Test(expected=ParseException.class)
public void parseNoUnitY() throws ParseException {
Years.parseGregorian("P35");
}
@Test(expected=ParseException.class)
public void parseNoDigits() throws ParseException {
Years.parseGregorian("PY");
}
@Test(expected=ParseException.class)
public void parseTrailingChars() throws ParseException {
Years.parseGregorian("P2Yx");
}
@Test
public void parseWeekBased() throws ParseException {
assertThat(
Years.parseWeekBased("-P35Y"),
is(Years.ofWeekBased(-35)));
assertThat(
Years.parseWeekBased("P35Y"),
is(Years.ofWeekBased(35)));
}
@Test
public void compareTo() throws ParseException {
assertThat(
Years.parseWeekBased("-P35Y").compareTo(Years.parseWeekBased("-P35Y")),
is(0));
assertThat(
Years.parseWeekBased("-P35Y").compareTo(Years.parseWeekBased("-P34Y")),
is(-1));
assertThat(
Years.parseWeekBased("-P35Y").compareTo(Years.parseWeekBased("-P36Y")),
is(1));
}
@Test(expected=ClassCastException.class)
@SuppressWarnings("unchecked")
public void compareToGregorianWeekBased() throws ParseException {
Years y1 = Years.parseGregorian("-P35Y");
Years y2 = Years.parseWeekBased("-P35Y");
y1.compareTo(y2);
}
@Test
public void getUnit() {
assertThat(Years.ofGregorian(15).getUnit(), is(CalendarUnit.YEARS));
assertThat(Years.ofWeekBased(15).getUnit(), is(CalendarUnit.weekBasedYears()));
}
@Test
public void toDuration() {
assertThat(Years.ofGregorian(15).toStdDuration(), is(Duration.ofCalendarUnits(15, 0, 0)));
assertThat(Years.ofWeekBased(-15).toStdDuration(), is(Duration.of(-15, Weekcycle.YEARS)));
}
}
|
lgpl-2.1
|
QuickServerLab/QuickServer-Main
|
setDocsCP.bat
|
164
|
set CLASSPATH=%CLASSPATH%;.\dist\commons-beanutils.jar;.\dist\commons-collections.jar;.\dist\commons-pool.jar;.\dist\commons-digester.jar;.\dist\commons-logging.jar
|
lgpl-2.1
|
Copix/Copix3
|
utils/copix/taglib/confirm.templatetag.php
|
1308
|
<?php
/**
* @package copix
* @subpackage taglib
* @author Salleyron Julien
* @copyright 2000-2006 CopixTeam
* @link http://www.copix.org
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
*/
/**
* Génération de fenetre confirm
* @package copix
* @subpackage taglib
*/
class TemplateTagConfirm extends CopixTemplateTag {
public function process ($pParams, $pContent=null){
$toReturn = ' '.$pContent.'<br /><br />';
$toReturn .= ' <a href="'.CopixUrl::get($pParams['yes']).'">'._i18n('copix:common.buttons.yes').'</a>';
$toReturn .= ' <a href="'.CopixUrl::get($pParams['no']).'">'._i18n('copix:common.buttons.no').'</a>';
_tag('mootools');
CopixHTMLHeader::addJsCode ("
window.addEvent('domready', function () {
var elem = new Element('div');
elem.setStyles({'z-index':99999,'background-color':'white','border':'1px solid black','width':'200px','height':'100px','top': window.getScrollTop().toInt()+window.getHeight ().toInt()/2-100+'px','left':window.getScrollLeft().toInt()+window.getWidth ().toInt()/2-100+'px','position':'absolute','text-align':'center'});
elem.setHTML ('$toReturn');
elem.injectInside(document.body);
});
");
return null;
}
}
?>
|
lgpl-2.1
|
jstedfast/spruce
|
spruce/search.c
|
44926
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* Spruce
* Copyright (C) 1999-2009 Jeffrey Stedfast
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "search.h"
#define _(x) x
struct _SearchStack {
SearchStack *parent;
GHashTable *symbols;
GPtrArray *argv;
int scope;
};
static SearchResult *search_term_and (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data);
static SearchResult *search_term_or (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data);
static SearchResult *search_term_not (SearchContext *ctx, int argc, SearchResult **argv, void *user_data);
static SearchResult *search_term_lt (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data);
static SearchResult *search_term_gt (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data);
static SearchResult *search_term_eq (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data);
static SearchResult *search_term_add (SearchContext *ctx, int argc, SearchResult **argv, void *user_data);
static SearchResult *search_term_sub (SearchContext *ctx, int argc, SearchResult **argv, void *user_data);
static SearchResult *search_term_mult (SearchContext *ctx, int argc, SearchResult **argv, void *user_data);
static SearchResult *search_term_div (SearchContext *ctx, int argc, SearchResult **argv, void *user_data);
static SearchResult *search_term_if (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data);
static SearchResult *search_term_begin (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data);
static SearchResult *search_term_cast_bool (SearchContext *ctx, int argc, SearchResult **argv, void *user_data);
static SearchResult *search_term_cast_int (SearchContext *ctx, int argc, SearchResult **argv, void *user_data);
static SearchResult *search_term_cast_float (SearchContext *ctx, int argc, SearchResult **argv, void *user_data);
static SearchResult *search_term_cast_string (SearchContext *ctx, int argc, SearchResult **argv, void *user_data);
struct {
char *name;
SearchFunc func;
int type; /* 0 is SearchFunc; 1 is SearchIFunc */
} symbols[] = {
{ "and", (SearchFunc) search_term_and, 1 },
{ "or", (SearchFunc) search_term_or, 1 },
{ "not", (SearchFunc) search_term_not, 0 },
{ "<", (SearchFunc) search_term_lt, 1 },
{ ">", (SearchFunc) search_term_gt, 1 },
{ "=", (SearchFunc) search_term_eq, 1 },
{ "+", (SearchFunc) search_term_add, 0 },
{ "-", (SearchFunc) search_term_sub, 0 },
{ "*", (SearchFunc) search_term_mult, 0 },
{ "/", (SearchFunc) search_term_div, 0 },
{ "if", (SearchFunc) search_term_if, 1 },
{ "begin", (SearchFunc) search_term_begin, 1 },
{ "cast-bool", (SearchFunc) search_term_cast_bool, 0 },
{ "cast-int", (SearchFunc) search_term_cast_int, 0 },
{ "cast-float", (SearchFunc) search_term_cast_float, 0 },
{ "cast-string", (SearchFunc) search_term_cast_string, 0 },
};
static void
search_symbol_free (SearchSymbol *sym)
{
if (sym->type == SEARCH_SYMBOL_VARIABLE)
search_result_free (sym->value.var);
g_free (sym->name);
g_free (sym);
}
static SearchStack *
search_stack_new (void)
{
SearchStack *stack;
stack = g_new (SearchStack, 1);
stack->symbols = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) search_symbol_free);
stack->parent = NULL;
stack->argv = NULL;
stack->scope = 0;
return stack;
}
static void
search_stack_free (SearchStack *stack)
{
g_hash_table_destroy (stack->symbols);
g_free (stack);
}
static void
search_stack_push (SearchContext *ctx)
{
SearchStack *stack;
stack = search_stack_new ();
if (ctx->stack) {
stack->scope = ctx->stack->scope + 1;
stack->parent = ctx->stack;
}
ctx->stack = stack;
}
static void
search_stack_pop (SearchContext *ctx)
{
SearchStack *stack;
stack = ctx->stack;
if (stack == NULL) {
fprintf (stderr, "Search stack underflow!\n");
return;
}
ctx->stack = stack->parent;
search_stack_free (stack);
}
static SearchSymbol *
search_stack_find_symbol (SearchContext *ctx, const char *name)
{
SearchStack *stack;
SearchSymbol *sym;
stack = ctx->stack;
while (stack) {
if ((sym = g_hash_table_lookup (stack->symbols, name)))
return sym;
stack = stack->parent;
}
return NULL;
}
SearchContext *
search_context_new (void)
{
SearchContext *ctx;
int i;
ctx = g_new (SearchContext, 1);
ctx->exception = NULL;
ctx->ref_count = 1;
ctx->stack = NULL;
ctx->tree = NULL;
for (i = 0; i < G_N_ELEMENTS (symbols); i++) {
if (symbols[i].type == 1)
search_context_add_ifunction (ctx, symbols[i].name,
(SearchIFunc) symbols[i].func);
else
search_context_add_function (ctx, symbols[i].name, symbols[i].func);
}
return ctx;
}
void
search_context_ref (SearchContext *ctx)
{
ctx->ref_count++;
}
static SearchTerm *
search_term_new (void)
{
return g_new (SearchTerm, 1);
}
static void
search_term_free (SearchTerm *term)
{
int i;
switch (term->type) {
case SEARCH_TERM_STRING:
g_free (term->value.string);
break;
case SEARCH_TERM_ARRAY:
g_ptr_array_free (term->value.array, TRUE);
break;
case SEARCH_TERM_FUNCTION:
case SEARCH_TERM_IFUNCTION:
search_symbol_free (term->value.func.sym);
for (i = 0; i < term->value.func.argc; i++)
search_term_free (term->value.func.argv[i]);
g_free (term->value.func.argv);
break;
case SEARCH_TERM_VARIABLE:
search_symbol_free (term->value.var);
break;
default:
break;
}
g_free (term);
}
void
search_context_unref (SearchContext *ctx)
{
ctx->ref_count--;
if (ctx->ref_count == 0) {
while (ctx->stack)
search_stack_pop (ctx);
search_term_free (ctx->tree);
g_free (ctx->exception);
g_free (ctx);
}
}
static SearchSymbol *
search_symbol_new (void)
{
return g_new (SearchSymbol, 1);
}
void
search_context_add_function (SearchContext *ctx, const char *name, SearchFunc func)
{
SearchStack *stack = ctx->stack;
SearchSymbol *sym;
if (!ctx->stack)
stack = ctx->stack = search_stack_new ();
sym = search_symbol_new ();
sym->type = SEARCH_SYMBOL_FUNCTION;
sym->name = g_strdup (name);
sym->value.func = func;
g_hash_table_insert (stack->symbols, sym->name, sym);
}
void
search_context_add_ifunction (SearchContext *ctx, const char *name, SearchIFunc ifunc)
{
SearchStack *stack = ctx->stack;
SearchSymbol *sym;
if (!ctx->stack)
stack = ctx->stack = search_stack_new ();
sym = g_new (SearchSymbol, 1);
sym->type = SEARCH_SYMBOL_IFUNCTION;
sym->name = g_strdup (name);
sym->value.ifunc = ifunc;
g_hash_table_insert (stack->symbols, sym->name, sym);
}
static SearchResult *
search_result_copy (SearchResult *result)
{
SearchResult *res, *r;
int i;
res = search_result_new (result->type);
switch (result->type) {
case SEARCH_RESULT_BOOL:
res->value.bool = result->value.bool;
break;
case SEARCH_RESULT_INT:
res->value.integer = result->value.integer;
break;
case SEARCH_RESULT_TIME:
res->value.time = result->value.time;
break;
case SEARCH_RESULT_FLOAT:
res->value.decimal = result->value.decimal;
break;
case SEARCH_RESULT_STRING:
res->value.string = g_strdup (result->value.string);
break;
case SEARCH_RESULT_ARRAY:
res->value.array = g_ptr_array_new ();
for (i = 0; i < result->value.array->len; i++)
g_ptr_array_add (res->value.array, result->value.array->pdata[i]);
break;
case SEARCH_RESULT_LIST:
res->value.array = g_ptr_array_new ();
for (i = 0; i < result->value.array->len; i++) {
r = search_result_copy (result->value.array->pdata[i]);
g_ptr_array_add (res->value.array, r);
}
break;
case SEARCH_RESULT_VOID:
break;
}
return res;
}
void
search_context_add_variable (SearchContext *ctx, const char *name, SearchResult *var)
{
SearchStack *stack = ctx->stack;
SearchSymbol *sym;
if (!ctx->stack)
search_stack_push (ctx);
sym = search_symbol_new ();
sym->type = SEARCH_SYMBOL_VARIABLE;
sym->name = g_strdup (name);
sym->value.var = search_result_copy (var);
g_hash_table_insert (stack->symbols, sym->name, sym);
}
void
search_context_remove_symbol (SearchContext *ctx, const char *name)
{
SearchSymbol *sym = NULL;
SearchStack *stack;
stack = ctx->stack;
while (stack) {
if ((sym = g_hash_table_lookup (stack->symbols, name)))
break;
stack = stack->parent;
}
if (stack && sym) {
g_hash_table_remove (stack->symbols, name);
search_symbol_free (sym);
}
}
static void
decode_lwsp (const char **in)
{
register const unsigned char *inptr;
inptr = (const unsigned char *) *in;
while (isspace ((int) *inptr))
inptr++;
*in = (const char *) inptr;
}
static char *
unescape (char *string)
{
char *d, *s;
s = string;
while (*s && *s != '\\')
s++;
d = s;
s++;
while (*s) {
*d = *s++;
if (*s == '\\')
s++;
}
*d = '\0';
return string;
}
static char *
decode_quoted_string (const char **in)
{
const char *start, *inptr = *in;
if (*inptr == '"') {
start = inptr;
inptr++;
while (*inptr && *inptr != '"') {
if (*inptr == '\\')
inptr++;
if (*inptr)
inptr++;
}
if (*inptr == '"')
*in = inptr + 1;
start++;
return unescape (g_strndup (start, inptr - start));
}
return NULL;
}
static char *
decode_token (const char **in, search_term_t *type)
{
register const char *inptr = *in;
const char *start;
*type = -1;
if (*inptr == '"') {
*type = SEARCH_TERM_STRING;
return decode_quoted_string (in);
} else {
start = inptr;
while (*inptr && *inptr != ')' && !isspace ((unsigned char) *inptr))
inptr++;
*in = inptr;
if (inptr > start)
return g_strndup (start, inptr - start);
else
return NULL;
}
}
static SearchSymbol *
decode_symbol (SearchContext *ctx, const char **in)
{
SearchSymbol *symbol, *sym;
char *token, *tend;
search_term_t type;
SearchResult *res;
double decimal;
int integer;
if (!(token = decode_token (in, &type)))
return NULL;
if (type == SEARCH_TERM_STRING) {
sym = search_symbol_new ();
sym->type = SEARCH_SYMBOL_VARIABLE;
sym->name = NULL;
res = search_result_new (SEARCH_RESULT_STRING);
res->value.string = token;
sym->value.var = res;
} else {
sym = search_symbol_new ();
if ((symbol = search_stack_find_symbol (ctx, token))) {
/* we have a function or variable */
sym->type = symbol->type;
sym->name = token;
if (symbol->type == SEARCH_SYMBOL_FUNCTION)
sym->value.func = symbol->value.func;
else if (symbol->type == SEARCH_SYMBOL_IFUNCTION)
sym->value.ifunc = symbol->value.ifunc;
else
sym->value.var = search_result_copy (symbol->value.var);
} else {
sym->type = SEARCH_SYMBOL_VARIABLE;
sym->name = NULL;
integer = strtol (token, &tend, 10);
if (*tend == '.') {
/* oops, it looks like a floating point value */
decimal = g_ascii_strtod (token, &tend);
res = search_result_new (SEARCH_RESULT_FLOAT);
res->value.decimal = decimal;
} else if (*tend == '\0') {
/* integer value */
res = search_result_new (SEARCH_RESULT_INT);
res->value.integer = integer;
} else if (!strcmp (token, "true") || !strcmp (token, "#t")) {
res = search_result_new (SEARCH_RESULT_BOOL);
res->value.bool = TRUE;
} else if (!strcmp (token, "false") || !strcmp (token, "#f")) {
res = search_result_new (SEARCH_RESULT_BOOL);
res->value.bool = FALSE;
} else {
g_warning ("Unknown token encountered: %s", token);
res = search_result_new (SEARCH_RESULT_VOID);
}
sym->value.var = res;
g_free (token);
}
}
return sym;
}
static SearchTerm *
decode_term (SearchContext *ctx, const char **in)
{
const char *inptr = *in;
SearchSymbol *sym;
SearchResult *res;
SearchTerm *term;
decode_lwsp (&inptr);
if (!(sym = decode_symbol (ctx, &inptr)))
return NULL;
*in = inptr;
term = search_term_new ();
if (sym->type == SEARCH_SYMBOL_VARIABLE) {
if (sym->name) {
term->type = SEARCH_TERM_VARIABLE;
term->value.var = sym;
} else {
res = sym->value.var;
/* we faked a symbol */
switch (res->type) {
case SEARCH_RESULT_BOOL:
term->type = SEARCH_TERM_BOOL;
term->value.bool = res->value.bool;
break;
case SEARCH_RESULT_INT:
term->type = SEARCH_TERM_INT;
term->value.integer = res->value.integer;
break;
case SEARCH_RESULT_TIME:
term->type = SEARCH_TERM_TIME;
term->value.time = res->value.time;
break;
case SEARCH_RESULT_FLOAT:
term->type = SEARCH_TERM_FLOAT;
term->value.decimal = res->value.decimal;
break;
case SEARCH_RESULT_STRING:
term->type = SEARCH_TERM_STRING;
term->value.string = res->value.string;
res->value.string = NULL;
break;
default:
break;
}
search_symbol_free (sym);
}
} else if (sym->type == SEARCH_SYMBOL_FUNCTION) {
term->type = SEARCH_TERM_FUNCTION;
term->value.func.sym = sym;
} else {
term->type = SEARCH_TERM_IFUNCTION;
term->value.func.sym = sym;
}
return term;
}
/* if a term is a variable, returns the type of the value it holds */
static search_term_t
term_type (SearchTerm *term)
{
SearchResult *res;
SearchSymbol *sym;
if (term->type != SEARCH_TERM_VARIABLE)
return term->type;
sym = term->value.var;
g_assert (sym->type == SEARCH_SYMBOL_VARIABLE);
res = sym->value.var;
switch (res->type) {
case SEARCH_RESULT_BOOL:
return SEARCH_TERM_BOOL;
case SEARCH_RESULT_INT:
return SEARCH_TERM_INT;
case SEARCH_RESULT_TIME:
return SEARCH_TERM_TIME;
case SEARCH_RESULT_FLOAT:
return SEARCH_TERM_FLOAT;
case SEARCH_RESULT_STRING:
return SEARCH_TERM_STRING;
case SEARCH_RESULT_ARRAY:
return SEARCH_TERM_ARRAY;
default:
g_assert_not_reached ();
return -1;
}
}
/* finds a common value type for 2 terms */
static search_term_t
term_type_best (search_term_t t1, search_term_t t2)
{
search_term_t best;
if (t1 == t2)
return t1;
if (t1 == SEARCH_TERM_TIME || t2 == SEARCH_TERM_TIME)
return SEARCH_TERM_STRING;
best = MAX (t1, t2);
/* arrays are not compatable with anything but arrays */
if (best == SEARCH_TERM_ARRAY)
return -1;
else if (best == SEARCH_TERM_FUNCTION)
return -1;
else if (best == SEARCH_TERM_IFUNCTION)
return -1;
else if (best == SEARCH_TERM_VARIABLE)
return -1;
return best;
}
static SearchTerm *
decode_tree (SearchContext *ctx, const char **in)
{
SearchTerm *term, *root = NULL;
GPtrArray *terms, *array;
const char *inptr = *in;
search_term_t best;
int i;
decode_lwsp (&inptr);
if (*inptr == '(') {
inptr++;
root = decode_tree (ctx, &inptr);
decode_lwsp (&inptr);
if (*inptr != ')') {
search_term_free (root);
root = NULL;
} else
inptr++;
} else
root = decode_term (ctx, &inptr);
if (root == NULL) {
g_warning ("failed parsing search expression: %s", inptr);
*in = inptr;
return NULL;
}
decode_lwsp (&inptr);
terms = g_ptr_array_new ();
while (*inptr && *inptr != ')') {
if (*inptr == '(') {
inptr++;
term = decode_tree (ctx, &inptr);
decode_lwsp (&inptr);
if (*inptr != ')') {
g_warning ("Invalid search term encountered: expected ')'");
goto exception;
}
inptr++;
} else {
if (!(term = decode_term (ctx, &inptr))) {
g_warning ("Could not decode term");
goto exception;
}
}
/* we can have empty search terms */
if (term)
g_ptr_array_add (terms, term);
decode_lwsp (&inptr);
}
if (root->type == SEARCH_TERM_FUNCTION || root->type == SEARCH_TERM_IFUNCTION) {
root->value.func.argc = terms->len;
root->value.func.argv = (SearchTerm **) terms->pdata;
g_ptr_array_free (terms, FALSE);
} else {
if (terms->len > 0) {
/* we have an array of terms */
best = term_type (root);
for (i = 0; i < terms->len && best != -1; i++) {
term = terms->pdata[i];
best = term_type_best (best, term_type (term));
if (best == -1) {
g_warning ("Incompatable types in array: %s", *in);
goto exception;
}
}
array = g_ptr_array_new ();
g_ptr_array_add (array, root);
for (i = 0; i < terms->len; i++)
g_ptr_array_add (array, terms->pdata[i]);
root = g_new (SearchTerm, 1);
root->type = SEARCH_TERM_LIST;
root->value.array = array;
}
g_ptr_array_free (terms, TRUE);
}
*in = inptr;
return root;
exception:
search_term_free (root);
for (i = 0; i < terms->len; i++)
search_term_free (terms->pdata[i]);
g_ptr_array_free (terms, TRUE);
return NULL;
}
int
search_context_build (SearchContext *ctx, const char *expression)
{
const char *inptr = expression;
if (ctx->tree) {
search_term_free (ctx->tree);
ctx->tree = NULL;
}
decode_lwsp (&inptr);
if (*inptr != '(')
return -1;
inptr++;
if (!(ctx->tree = decode_tree (ctx, &inptr)))
goto exception;
decode_lwsp (&inptr);
if (*inptr != ')') {
goto exception;
} else {
inptr++;
decode_lwsp (&inptr);
if (*inptr != '\0')
goto exception;
}
return 0;
exception:
g_warning ("parse error: unexpected token at %s", inptr);
return -1;
}
static SearchResult *
search_symbol_eval (SearchContext *ctx, SearchSymbol *sym, void *user_data)
{
switch (sym->type) {
case SEARCH_SYMBOL_FUNCTION:
return sym->value.func (ctx, 0, NULL, user_data);
case SEARCH_SYMBOL_IFUNCTION:
return sym->value.ifunc (ctx, 0, NULL, user_data);
case SEARCH_SYMBOL_VARIABLE:
return search_result_copy (sym->value.var);
}
g_assert_not_reached ();
return NULL;
}
SearchResult *
search_term_eval (SearchContext *ctx, SearchTerm *term, void *user_data)
{
SearchResult *r, *res = NULL;
SearchSymbol *sym;
GPtrArray *argv;
int i;
switch (term->type) {
case SEARCH_TERM_BOOL:
res = search_result_new (SEARCH_RESULT_BOOL);
res->value.bool = term->value.bool;
return res;
case SEARCH_TERM_INT:
res = search_result_new (SEARCH_RESULT_INT);
res->value.integer = term->value.integer;
return res;
case SEARCH_TERM_TIME:
res = search_result_new (SEARCH_RESULT_TIME);
res->value.time = term->value.time;
return res;
case SEARCH_TERM_FLOAT:
res = search_result_new (SEARCH_RESULT_FLOAT);
res->value.decimal = term->value.decimal;
return res;
case SEARCH_TERM_STRING:
res = search_result_new (SEARCH_RESULT_STRING);
res->value.string = g_strdup (term->value.string);
return res;
case SEARCH_TERM_ARRAY:
res = search_result_new (SEARCH_RESULT_ARRAY);
res->value.array = g_ptr_array_new ();
for (i = 0; i < term->value.array->len; i++)
g_ptr_array_add (res->value.array, term->value.array->pdata[i]);
return res;
case SEARCH_TERM_LIST:
res = search_result_new (SEARCH_RESULT_LIST);
res->value.array = g_ptr_array_new ();
for (i = 0; i < term->value.array->len; i++) {
r = search_term_eval (ctx, term->value.array->pdata[i], NULL);
g_ptr_array_add (res->value.array, r);
}
return res;
case SEARCH_TERM_FUNCTION:
sym = term->value.func.sym;
search_stack_push (ctx);
ctx->stack->argv = argv = g_ptr_array_new ();
for (i = 0; i < term->value.func.argc; i++)
g_ptr_array_add (argv, search_term_eval (ctx, term->value.func.argv[i], user_data));
if (sym->value.func)
res = sym->value.func (ctx, argv->len, (SearchResult **) argv->pdata, user_data);
for (i = 0; i < argv->len; i++)
search_result_free ((SearchResult *) argv->pdata[i]);
g_ptr_array_free (argv, TRUE);
ctx->stack->argv = NULL;
search_stack_pop (ctx);
if (res == NULL)
return search_result_new (SEARCH_RESULT_VOID);
return res;
case SEARCH_TERM_IFUNCTION:
sym = term->value.func.sym;
return sym->value.ifunc (ctx, term->value.func.argc,
term->value.func.argv, user_data);
case SEARCH_TERM_VARIABLE:
return search_symbol_eval (ctx, term->value.var, user_data);
}
g_assert_not_reached ();
return NULL;
}
#if 1
static void
search_term_dump (SearchTerm *term)
{
int i;
switch (term->type) {
case SEARCH_TERM_BOOL:
printf ("%s ", term->value.bool ? "true" : "false");
break;
case SEARCH_TERM_INT:
printf ("%d ", term->value.integer);
break;
case SEARCH_TERM_TIME:
printf ("%ld ", term->value.time);
break;
case SEARCH_TERM_FLOAT:
printf ("%.2f ", term->value.decimal);
break;
case SEARCH_TERM_STRING:
printf ("\"%s\" ", term->value.string);
break;
case SEARCH_TERM_ARRAY:
printf ("<array> ");
break;
case SEARCH_TERM_LIST:
printf ("(");
for (i = 0; i < term->value.array->len; i++)
search_term_dump (term->value.array->pdata[i]);
printf (")");
break;
case SEARCH_TERM_FUNCTION:
case SEARCH_TERM_IFUNCTION:
printf ("(%s ", term->value.func.sym->name);
for (i = 0; i < term->value.func.argc; i++)
search_term_dump (term->value.func.argv[i]);
printf (") ");
break;
case SEARCH_TERM_VARIABLE:
printf ("%s ", term->value.var->name);
break;
}
}
#endif
SearchResult *
search_context_run (SearchContext *ctx, void *user_data)
{
SearchResult *res = NULL;
if (ctx->tree == NULL) {
ctx->exception = g_strdup_printf (_("No expression to evaluate"));
return NULL;
}
g_free (ctx->exception);
ctx->exception = NULL;
if (setjmp (ctx->env) == 0)
res = search_term_eval (ctx, ctx->tree, user_data);
return res;
}
void
search_context_throw (SearchContext *ctx, const char *exception, ...)
{
SearchStack *stack;
va_list ap;
int i;
va_start (ap, exception);
ctx->exception = g_strdup_vprintf (exception, ap);
va_end (ap);
/* clean up our stack */
stack = ctx->stack;
while (stack) {
if (stack->argv) {
for (i = 0; i < stack->argv->len; i++)
search_result_free (stack->argv->pdata[i]);
g_ptr_array_free (stack->argv, TRUE);
stack->argv = NULL;
}
stack = stack->parent;
}
longjmp (ctx->env, 1);
}
const char *
search_context_exception (SearchContext *ctx)
{
return ctx->exception;
}
static SearchResult *
search_result_convert (SearchContext *ctx, SearchResult *r, search_result_t type)
{
SearchResult *res;
if (r->type == SEARCH_RESULT_ARRAY)
return NULL;
switch (type) {
case SEARCH_RESULT_BOOL:
res = search_term_cast_bool (ctx, 1, &r, NULL);
break;
case SEARCH_RESULT_INT:
res = search_term_cast_int (ctx, 1, &r, NULL);
break;
case SEARCH_RESULT_FLOAT:
res = search_term_cast_float (ctx, 1, &r, NULL);
break;
case SEARCH_RESULT_STRING:
res = search_term_cast_string (ctx, 1, &r, NULL);
break;
default:
return NULL;
}
return res;
}
SearchResult *
search_result_new (search_result_t type)
{
SearchResult *res;
res = g_new (SearchResult, 1);
res->type = type;
res->value.integer = 0;
return res;
}
void
search_result_free (SearchResult *result)
{
int i;
switch (result->type) {
case SEARCH_RESULT_STRING:
g_free (result->value.string);
break;
case SEARCH_RESULT_ARRAY:
g_ptr_array_free (result->value.array, TRUE);
break;
case SEARCH_RESULT_LIST:
for (i = 0; i < result->value.array->len; i++)
search_result_free (result->value.array->pdata[i]);
g_ptr_array_free (result->value.array, TRUE);
default:
break;
}
g_free (result);
}
/* Builtin functions */
struct _intersect {
GPtrArray *array;
int num;
};
static void
and_array_intersect (gpointer key, gpointer val, gpointer user_data)
{
struct _intersect *isect = user_data;
if (GPOINTER_TO_INT (val) >= isect->num)
g_ptr_array_add (isect->array, key);
}
static SearchResult *
search_term_and (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data)
{
search_result_t type = SEARCH_RESULT_BOOL;
struct _intersect isect;
GHashTable *hash = NULL;
SearchResult *res, *r;
gboolean bool = TRUE;
gpointer okey, oval;
GPtrArray *array;
int val, num = 1;
int i, j;
if (argc == 0)
search_context_throw (ctx, _("No arguments in AND expression"));
/* evaluate the first term so we can figure out what type of AND this is... */
res = search_term_eval (ctx, argv[0], user_data);
/* if the type is an array, then we intersect the arrays, every other type is treated as boolean */
if (res->type == SEARCH_RESULT_ARRAY) {
type = SEARCH_RESULT_ARRAY;
hash = g_hash_table_new (g_direct_hash, g_direct_equal);
for (j = 0; j < res->value.array->len; j++) {
if (g_hash_table_lookup_extended (hash, res->value.array->pdata[j], &okey, &oval)) {
val = GPOINTER_TO_INT (oval);
oval = GINT_TO_POINTER (val + 1);
} else {
g_hash_table_insert (hash, res->value.array->pdata[j], GINT_TO_POINTER (1));
}
}
} else {
type = SEARCH_RESULT_BOOL;
r = search_result_convert (ctx, res, type);
bool = r->value.bool;
search_result_free (r);
}
search_result_free (res);
for (i = 1; i < argc && bool; i++) {
res = search_term_eval (ctx, argv[i], user_data);
if (type == SEARCH_RESULT_ARRAY) {
if (res->type != SEARCH_RESULT_ARRAY)
goto exception;
num++;
for (j = 0; j < res->value.array->len; j++) {
if (g_hash_table_lookup_extended (hash, res->value.array->pdata[j],
&okey, &oval)) {
val = GPOINTER_TO_INT (oval);
oval = GINT_TO_POINTER (val + 1);
} else {
g_hash_table_insert (hash, res->value.array->pdata[j],
GINT_TO_POINTER (1));
}
}
} else {
if (res->type == SEARCH_RESULT_ARRAY)
goto exception;
r = search_result_convert (ctx, res, SEARCH_RESULT_BOOL);
bool = bool && r->value.bool;
search_result_free (r);
}
search_result_free (res);
}
res = search_result_new (type);
if (type == SEARCH_RESULT_ARRAY) {
array = g_ptr_array_new ();
isect.array = array;
isect.num = num;
g_hash_table_foreach (hash, and_array_intersect, &isect);
g_hash_table_destroy (hash);
res->value.array = array;
} else
res->value.bool = bool;
return res;
exception:
if (type == SEARCH_RESULT_ARRAY)
g_hash_table_destroy (hash);
search_context_throw (ctx, _("Invalid types in AND"));
return NULL;
}
static SearchResult *
search_term_or (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data)
{
search_result_t type = SEARCH_RESULT_BOOL;
GHashTable *hash = NULL;
GPtrArray *array = NULL;
gboolean bool = FALSE;
SearchResult *res, *r;
int i, j;
if (argc == 0)
search_context_throw (ctx, _("No arguments in OR expression"));
/* evaluate the first term so we can figure out what type of AND this is... */
res = search_term_eval (ctx, argv[0], user_data);
/* if the type is an array, then we union the arrays, every other type is treated as boolean */
if (res->type == SEARCH_RESULT_ARRAY) {
type = SEARCH_RESULT_ARRAY;
hash = g_hash_table_new (g_direct_hash, g_direct_equal);
array = g_ptr_array_new ();
for (j = 0; j < res->value.array->len; j++) {
if (!g_hash_table_lookup (hash, res->value.array->pdata[j])) {
g_ptr_array_add (array, res->value.array->pdata[j]);
g_hash_table_insert (hash, res->value.array->pdata[j],
GINT_TO_POINTER (1));
}
}
} else {
type = SEARCH_RESULT_BOOL;
r = search_result_convert (ctx, res, type);
bool = r->value.bool;
search_result_free (r);
}
search_result_free (res);
for (i = 1; i < argc && bool; i++) {
res = search_term_eval (ctx, argv[i], user_data);
if (type == SEARCH_RESULT_ARRAY) {
if (res->type != SEARCH_RESULT_ARRAY)
goto exception;
for (j = 0; j < res->value.array->len; j++) {
if (!g_hash_table_lookup (hash, res->value.array->pdata[j])) {
g_ptr_array_add (array, res->value.array->pdata[j]);
g_hash_table_insert (hash, res->value.array->pdata[j],
GINT_TO_POINTER (1));
}
}
} else {
if (res->type == SEARCH_RESULT_ARRAY)
goto exception;
r = search_result_convert (ctx, res, type);
bool = bool || r->value.bool;
search_result_free (r);
}
search_result_free (res);
}
res = search_result_new (type);
if (type == SEARCH_RESULT_ARRAY) {
res->value.array = array;
g_hash_table_destroy (hash);
} else
res->value.bool = bool;
return res;
exception:
if (type == SEARCH_RESULT_ARRAY)
g_hash_table_destroy (hash);
search_context_throw (ctx, _("Invalid types in OR"));
return NULL;
}
static SearchResult *
search_term_not (SearchContext *ctx, int argc, SearchResult **argv, void *user_data)
{
SearchResult *res;
if (argc != 1)
search_context_throw (ctx, _("Incorrect number of arguments in NOT expression"));
if (argv[0]->type == SEARCH_RESULT_ARRAY) {
/* FIXME: invert the array? */
res = search_result_new (SEARCH_RESULT_VOID);
} else {
res = search_term_cast_bool (ctx, 1, argv, user_data);
res->value.bool = !res->value.bool;
}
return res;
}
static SearchResult *
search_term_lt (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data)
{
SearchResult *res, *r1 = NULL, *r2 = NULL;
search_result_t type;
if (argc != 2)
search_context_throw (ctx, _("Incorrect number of arguments in < expression"));
r1 = search_term_eval (ctx, argv[0], user_data);
r2 = search_term_eval (ctx, argv[1], user_data);
if (r1->type == r2->type) {
compare:
res = search_result_new (SEARCH_RESULT_BOOL);
switch (r1->type) {
case SEARCH_RESULT_BOOL:
res->value.bool = (r1->value.bool ? 1 : 0) < (r2->value.bool ? 1 : 0);
break;
case SEARCH_RESULT_INT:
res->value.bool = r1->value.integer < r2->value.integer;
break;
case SEARCH_RESULT_TIME:
res->value.bool = r1->value.time < r2->value.time;
break;
case SEARCH_RESULT_FLOAT:
res->value.bool = r1->value.decimal < r2->value.decimal;
break;
case SEARCH_RESULT_STRING:
res->value.bool = strcmp (r1->value.string, r2->value.string) < 0;
break;
default:
goto exception;
break;
}
} else {
type = MAX (r1->type, r2->type);
if (r1->type == type) {
res = search_result_convert (ctx, r2, type);
search_result_free (r2);
r2 = res;
if (r2 == NULL)
goto exception;
} else {
res = search_result_convert (ctx, r1, type);
search_result_free (r1);
r1 = res;
if (r1 == NULL)
goto exception;
}
goto compare;
}
search_result_free (r1);
search_result_free (r2);
return res;
exception:
if (r1)
search_result_free (r1);
if (r2)
search_result_free (r2);
search_context_throw (ctx, _("Incompatable types in comparison (<)"));
return NULL;
}
static SearchResult *
search_term_gt (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data)
{
SearchResult *res, *r1 = NULL, *r2 = NULL;
search_result_t type;
if (argc != 2)
search_context_throw (ctx, _("Incorrect number of arguments in > expression"));
r1 = search_term_eval (ctx, argv[0], user_data);
r2 = search_term_eval (ctx, argv[1], user_data);
if (r1->type == r2->type) {
compare:
res = search_result_new (SEARCH_RESULT_BOOL);
switch (r1->type) {
case SEARCH_RESULT_BOOL:
res->value.bool = (r1->value.bool ? 1 : 0) > (r2->value.bool ? 1 : 0);
break;
case SEARCH_RESULT_INT:
res->value.bool = r1->value.integer > r2->value.integer;
break;
case SEARCH_RESULT_TIME:
res->value.bool = r1->value.time > r2->value.time;
break;
case SEARCH_RESULT_FLOAT:
res->value.bool = r1->value.decimal > r2->value.decimal;
break;
case SEARCH_RESULT_STRING:
res->value.bool = strcmp (r1->value.string, r2->value.string) > 0;
break;
default:
goto exception;
break;
}
} else {
type = MAX (r1->type, r2->type);
if (r1->type == type) {
res = search_result_convert (ctx, r2, type);
search_result_free (r2);
r2 = res;
if (r2 == NULL)
goto exception;
} else {
res = search_result_convert (ctx, r1, type);
search_result_free (r1);
r1 = res;
if (r1 == NULL)
goto exception;
}
goto compare;
}
search_result_free (r1);
search_result_free (r2);
return res;
exception:
if (r1)
search_result_free (r1);
if (r2)
search_result_free (r2);
search_context_throw (ctx, _("Incompatable types in comparison (>)"));
return NULL;
}
static SearchResult *
search_term_eq (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data)
{
SearchResult *res, *r1 = NULL, *r2 = NULL;
search_result_t type;
if (argc != 2)
search_context_throw (ctx, _("Incorrect number of arguments to = expression"));
r1 = search_term_eval (ctx, argv[0], user_data);
r2 = search_term_eval (ctx, argv[1], user_data);
if (r1->type == r2->type) {
compare:
res = search_result_new (SEARCH_RESULT_BOOL);
switch (r1->type) {
case SEARCH_RESULT_BOOL:
res->value.bool = (r1->value.bool ? 1 : 0) == (r2->value.bool ? 1 : 0);
break;
case SEARCH_RESULT_INT:
res->value.bool = r1->value.integer == r2->value.integer;
break;
case SEARCH_RESULT_TIME:
res->value.bool = r1->value.time == r2->value.time;
break;
case SEARCH_RESULT_FLOAT:
res->value.bool = r1->value.decimal == r2->value.decimal;
break;
case SEARCH_RESULT_STRING:
res->value.bool = strcmp (r1->value.string, r2->value.string) == 0;
break;
default:
goto exception;
break;
}
} else {
type = MAX (r1->type, r2->type);
if (r1->type == type) {
res = search_result_convert (ctx, r2, type);
search_result_free (r2);
r2 = res;
if (r2 == NULL)
goto exception;
} else {
res = search_result_convert (ctx, r1, type);
search_result_free (r1);
r1 = res;
if (r1 == NULL)
goto exception;
}
goto compare;
}
search_result_free (r1);
search_result_free (r2);
return res;
exception:
if (r1)
search_result_free (r1);
if (r2)
search_result_free (r2);
search_context_throw (ctx, _("Incompatable types in comparison (=)"));
return NULL;
}
static SearchResult *
search_term_add (SearchContext *ctx, int argc, SearchResult **argv, void *user_data)
{
search_result_t type = SEARCH_RESULT_INT;
SearchResult *res;
double fsum = 0.0;
int i, isum = 0;
for (i = 0; i < argc; i++) {
if (argv[i]->type == SEARCH_RESULT_FLOAT && type == SEARCH_RESULT_INT) {
type = SEARCH_RESULT_FLOAT;
fsum = (double) isum;
}
switch (argv[i]->type) {
case SEARCH_RESULT_INT:
if (type == SEARCH_RESULT_INT)
isum += argv[i]->value.integer;
else
fsum += (double) argv[i]->value.integer;
break;
case SEARCH_RESULT_FLOAT:
fsum += argv[i]->value.decimal;
break;
default:
goto exception;
}
}
res = search_result_new (type);
if (type == SEARCH_RESULT_INT)
res->value.integer = isum;
else
res->value.decimal = fsum;
return res;
exception:
search_context_throw (ctx, _("Invalid types in (+ <%s>...)"),
type == SEARCH_RESULT_INT ? "int" : "float");
return NULL;
}
static SearchResult *
search_term_sub (SearchContext *ctx, int argc, SearchResult **argv, void *user_data)
{
search_result_t type = SEARCH_RESULT_INT;
SearchResult *res;
double fsum = 0.0;
int i, isum = 0;
if (argc > 0) {
type = argv[0]->type;
switch (type) {
case SEARCH_RESULT_INT:
isum = argv[0]->value.integer;
break;
case SEARCH_RESULT_FLOAT:
fsum = argv[0]->value.decimal;
break;
default:
goto exception;
}
}
for (i = 1; i < argc; i++) {
if (argv[i]->type == SEARCH_RESULT_FLOAT && type == SEARCH_RESULT_INT) {
type = SEARCH_RESULT_FLOAT;
fsum = (double) isum;
}
switch (argv[i]->type) {
case SEARCH_RESULT_INT:
if (type == SEARCH_RESULT_INT)
isum -= argv[i]->value.integer;
else
fsum -= (double) argv[i]->value.integer;
break;
case SEARCH_RESULT_FLOAT:
fsum -= argv[i]->value.decimal;
break;
default:
goto exception;
}
}
res = search_result_new (type);
if (type == SEARCH_RESULT_INT)
res->value.integer = isum;
else
res->value.decimal = fsum;
return res;
exception:
search_context_throw (ctx, _("Invalid types in (- <%s>...)"),
type == SEARCH_RESULT_INT ? "int" : "float");
return NULL;
}
static SearchResult *
search_term_mult (SearchContext *ctx, int argc, SearchResult **argv, void *user_data)
{
search_result_t type = SEARCH_RESULT_INT;
SearchResult *res;
double fmult = 1.0;
int i, imult = 1;
for (i = 0; i < argc; i++) {
if (argv[i]->type == SEARCH_RESULT_FLOAT && type == SEARCH_RESULT_INT) {
type = SEARCH_RESULT_FLOAT;
fmult = (double) imult;
}
switch (argv[i]->type) {
case SEARCH_RESULT_INT:
if (type == SEARCH_RESULT_INT)
imult *= argv[i]->value.integer;
else
fmult *= (double) argv[i]->value.integer;
break;
case SEARCH_RESULT_FLOAT:
fmult *= argv[i]->value.decimal;
break;
default:
goto exception;
}
}
res = search_result_new (type);
if (type == SEARCH_RESULT_INT)
res->value.integer = imult;
else
res->value.decimal = fmult;
return res;
exception:
search_context_throw (ctx, _("Invalid types in (* <%s>...)"),
type == SEARCH_RESULT_INT ? "int" : "float");
return NULL;
}
static SearchResult *
search_term_div (SearchContext *ctx, int argc, SearchResult **argv, void *user_data)
{
search_result_t type = SEARCH_RESULT_INT;
SearchResult *res;
double fdiv = 0.0;
int i, idiv = 1;
if (argc > 0) {
type = argv[0]->type;
switch (type) {
case SEARCH_RESULT_INT:
idiv = argv[0]->value.integer;
break;
case SEARCH_RESULT_FLOAT:
fdiv = argv[0]->value.decimal;
break;
default:
goto exception;
}
}
for (i = 0; i < argc; i++) {
if (argv[i]->type == SEARCH_RESULT_FLOAT && type == SEARCH_RESULT_INT) {
type = SEARCH_RESULT_FLOAT;
fdiv = (double) idiv;
}
switch (argv[i]->type) {
case SEARCH_RESULT_INT:
if (argv[i]->value.integer == 0)
goto exception;
if (type == SEARCH_RESULT_INT)
idiv /= argv[i]->value.integer;
else
fdiv /= (double) argv[i]->value.integer;
break;
case SEARCH_RESULT_FLOAT:
if (argv[i]->value.decimal == 0)
goto exception;
fdiv /= argv[i]->value.decimal;
break;
default:
goto exception;
}
}
res = search_result_new (type);
if (type == SEARCH_RESULT_INT)
res->value.integer = idiv;
else
res->value.decimal = fdiv;
return res;
exception:
search_context_throw (ctx, _("Invalid types in (/ <%s>...)"),
type == SEARCH_RESULT_INT ? "int" : "float");
return NULL;
}
static SearchResult *
search_term_if (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data)
{
SearchResult *res, *expr;
if (argc < 2 || argc > 3)
search_context_throw (ctx, _("Invalid number of arguments to (if expr func )"));
if (argc >= 2 && argc <= 3) {
res = search_term_eval (ctx, argv[0], user_data);
if (res->type != SEARCH_RESULT_BOOL) {
expr = search_term_cast_bool (ctx, 1, &res, user_data);
search_result_free (res);
} else
expr = res;
if (expr->value.bool) {
search_result_free (expr);
return search_term_eval (ctx, argv[1], user_data);
} else if (argc == 3) {
search_result_free (expr);
return search_term_eval (ctx, argv[2], user_data);
}
} else
expr = search_result_new (SEARCH_RESULT_VOID);
return expr;
}
static SearchResult *
search_term_begin (SearchContext *ctx, int argc, SearchTerm **argv, void *user_data)
{
SearchResult *res;
int i;
res = search_result_new (SEARCH_RESULT_VOID);
for (i = 0; i < argc; i++) {
search_result_free (res);
res = search_term_eval (ctx, argv[i], user_data);
}
return res;
}
static SearchResult *
search_term_cast_bool (SearchContext *ctx, int argc, SearchResult **argv, void *user_data)
{
SearchResult *res;
if (argc != 1)
search_context_throw (ctx, _("Incorrect number of arguments to (cast-bool )"));
res = search_result_new (SEARCH_RESULT_BOOL);
switch (argv[0]->type) {
case SEARCH_RESULT_BOOL:
res->value.bool = argv[0]->value.bool;
break;
case SEARCH_RESULT_INT:
res->value.bool = argv[0]->value.integer ? TRUE : FALSE;
break;
case SEARCH_RESULT_FLOAT:
res->value.bool = ((int) argv[0]->value.decimal) ? TRUE : FALSE;
break;
case SEARCH_RESULT_STRING:
if (!strcmp (argv[0]->value.string, "true") || !strcmp (argv[0]->value.string, "#t"))
res->value.bool = TRUE;
else
res->value.bool = FALSE;
break;
default:
res->value.bool = FALSE;
break;
}
return res;
}
static SearchResult *
search_term_cast_int (SearchContext *ctx, int argc, SearchResult **argv, void *user_data)
{
SearchResult *res;
if (argc != 1)
search_context_throw (ctx, _("Incorrect number of arguments to (cast-int )"));
res = search_result_new (SEARCH_RESULT_INT);
switch (argv[0]->type) {
case SEARCH_RESULT_BOOL:
res->value.integer = argv[0]->value.bool ? 1 : 0;
break;
case SEARCH_RESULT_INT:
res->value.integer = argv[0]->value.integer;
break;
case SEARCH_RESULT_FLOAT:
res->value.integer = (int) argv[0]->value.decimal;
break;
case SEARCH_RESULT_STRING:
res->value.integer = strtol (argv[0]->value.string, NULL, 10);
break;
default:
res->value.integer = 0;
break;
}
return res;
}
static SearchResult *
search_term_cast_float (SearchContext *ctx, int argc, SearchResult **argv, void *user_data)
{
SearchResult *res;
if (argc != 1)
search_context_throw (ctx, _("Incorrect number of arguments to (cast-float )"));
res = search_result_new (SEARCH_RESULT_FLOAT);
switch (argv[0]->type) {
case SEARCH_RESULT_BOOL:
res->value.decimal = argv[0]->value.bool ? 1.0 : 0.0;
break;
case SEARCH_RESULT_INT:
res->value.decimal = argv[0]->value.integer * 1.0;
break;
case SEARCH_RESULT_FLOAT:
res->value.decimal = argv[0]->value.decimal;
break;
case SEARCH_RESULT_STRING:
res->value.decimal = strtod (argv[0]->value.string, NULL);
break;
default:
res->value.decimal = 0.0;
break;
}
return res;
}
static SearchResult *
search_term_cast_string (SearchContext *ctx, int argc, SearchResult **argv, void *user_data)
{
SearchResult *res;
if (argc != 1)
search_context_throw (ctx, _("Incorrect number of arguments to (cast-string )"));
res = search_result_new (SEARCH_RESULT_STRING);
switch (argv[0]->type) {
case SEARCH_RESULT_BOOL:
res->value.string = argv[0]->value.bool ? g_strdup ("true") : g_strdup ("false");
break;
case SEARCH_RESULT_INT:
res->value.string = g_strdup_printf ("%d", argv[0]->value.integer);
break;
case SEARCH_RESULT_FLOAT:
res->value.string = g_strdup_printf ("%.2f", argv[0]->value.decimal);
break;
case SEARCH_RESULT_STRING:
res->value.string = g_strdup (argv[0]->value.string);
break;
default:
res->value.string = g_strdup ("");
break;
}
return res;
}
static void
dump_value (SearchResult *res)
{
int i;
switch (res->type) {
case SEARCH_RESULT_BOOL:
printf ("%s ", res->value.bool ? "true" : "false");
break;
case SEARCH_RESULT_INT:
printf ("%d ", res->value.integer);
break;
case SEARCH_RESULT_TIME:
printf ("%ld ", res->value.time);
break;
case SEARCH_RESULT_FLOAT:
printf ("%.2f ", res->value.decimal);
break;
case SEARCH_RESULT_STRING:
printf ("\"%s\" ", res->value.string);
break;
case SEARCH_RESULT_LIST:
printf ("(");
for (i = 0; i < res->value.array->len; i++)
dump_value (res->value.array->pdata[i]);
printf (")");
break;
default:
printf ("not a printable type: %d\n", res->type);
}
}
int main (int argc, char **argv)
{
SearchContext *ctx;
SearchResult *res;
ctx = search_context_new ();
if (search_context_build (ctx, argv[1]) == -1) {
printf ("failed to build?\n");
return 0;
}
search_term_dump (ctx->tree);
if (!(res = search_context_run (ctx, NULL))) {
printf ("failed to evaluate: %s\n", search_context_exception (ctx));
return 0;
}
switch (res->type) {
case SEARCH_RESULT_BOOL:
printf ("bool val = %s\n", res->value.bool ? "true" : "false");
break;
case SEARCH_RESULT_INT:
printf ("int val = %d\n", res->value.integer);
break;
case SEARCH_RESULT_TIME:
printf ("time_t val = %ld\n", res->value.time);
break;
case SEARCH_RESULT_FLOAT:
printf ("float val = %.2f\n", res->value.decimal);
break;
case SEARCH_RESULT_STRING:
printf ("string val = %s\n", res->value.string);
break;
case SEARCH_RESULT_LIST:
printf ("list val = ");
dump_value (res);
printf ("\n");
break;
default:
printf ("not a printable type: %d\n", res->type);
}
search_result_free (res);
search_context_unref (ctx);
return 0;
}
|
lgpl-2.1
|