repo_name stringlengths 4 116 | path stringlengths 4 379 | size stringlengths 1 7 | content stringlengths 3 1.05M | license stringclasses 15
values |
|---|---|---|---|---|
andrescabsi14/educo | wp-content/themes/eduCo/internaHorariosPresenciales.php | 23342 | <?php
/*
Template Name: Horarios Cursos Presenciales
*/
?>
<?php get_header(); ?>
<?php if( have_posts() ) the_post(); ?>
<section class="main-container inner">
<section class="main-image <?php the_field( "texto" ); ?>">
<figure style="background: url('<?php the_field( "imagen_principal" ); ?>') no-repeat center center; background-size: cover;">
<div class="wrapcont darken">
<h1><?php the_title(); ?></h1>
<h4><?php the_field( "subtitulo" ); ?></h4>
</div>
</figure>
</section>
<section class="main-content wrapcont content">
<div class="content">
<div class="table">
<!-- HORARIO A
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<h2>Horario A</h2>
<?php the_field( "horario_a_-_horas" ); ?>
<table class="horarios_tabla" border="1" width="100%" cellspacing="0">
<tbody>
<tr class="title">
<td>Solo Básico</td>
<td>De Básico Hasta Intermedio</td>
<td>De Básico Hasta Avanzado</td>
<td>De Básico Hasta Macros</td>
</tr>
<tr>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_basico') ): ?>
<ul>
<?php while( have_rows('solo_basico') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_basico') ): ?>
<ul>
<?php while( have_rows('solo_basico') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_basico_hasta_intermedio') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_intermedio') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_basico_hasta_intermedio') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_intermedio') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_basico_hasta_avanzado') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_avanzado') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_basico_hasta_avanzado') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_avanzado') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_basico_hasta_macros') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_macros') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_basico_hasta_macros') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_macros') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
<tr class="title">
<td></td>
<td>Solo Intermedio</td>
<td>De Intermedio Hasta Avanzado</td>
<td>Solo Intermedio Hasta Macros</td>
</tr>
<tr>
<td></td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_intermedio') ): ?>
<ul>
<?php while( have_rows('solo_intermedio') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_intermedio') ): ?>
<ul>
<?php while( have_rows('solo_intermedio') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_intermedio_hasta_avanzado') ): ?>
<ul>
<?php while( have_rows('de_intermedio_hasta_avanzado') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_intermedio_hasta_avanzado') ): ?>
<ul>
<?php while( have_rows('de_intermedio_hasta_avanzado') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_intermedio_hasta_macros') ): ?>
<ul>
<?php while( have_rows('solo_intermedio_hasta_macros') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_intermedio_hasta_macros') ): ?>
<ul>
<?php while( have_rows('solo_intermedio_hasta_macros') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
<tr class="title">
<td></td>
<td></td>
<td>Solo Avanzado</td>
<td>De Avanzado Hasta Macros </td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_avanzado') ): ?>
<ul>
<?php while( have_rows('solo_avanzado') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_avanzado') ): ?>
<ul>
<?php while( have_rows('solo_avanzado') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_avanzado_hasta_macros') ): ?>
<ul>
<?php while( have_rows('de_avanzado_hasta_macros') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_avanzado_hasta_macros') ): ?>
<ul>
<?php while( have_rows('de_avanzado_hasta_macros') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
<tr class="title">
<td></td>
<td></td>
<td></td>
<td>Solo Macros</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_macros') ): ?>
<ul>
<?php while( have_rows('solo_macros') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_macros') ): ?>
<ul>
<?php while( have_rows('solo_macros') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
<!-- HORARIO B
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<h2>Horario B</h2>
<?php the_field( "horario_a_-_horas_copy" ); ?>
<table class="horarios_tabla" border="1" width="100%" cellspacing="0">
<tbody>
<tr class="title">
<td>Solo Básico</td>
<td>De Básico Hasta Intermedio</td>
<td>De Básico Hasta Avanzado</td>
<td>De Básico Hasta Macros</td>
</tr>
<tr>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_basico_copy') ): ?>
<ul>
<?php while( have_rows('solo_basico_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_basico_copy') ): ?>
<ul>
<?php while( have_rows('solo_basico_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_basico_hasta_intermedio_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_intermedio_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_basico_hasta_intermedio_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_intermedio_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_basico_hasta_avanzado_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_avanzado_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_basico_hasta_avanzado_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_avanzado_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_basico_hasta_macros_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_macros_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_basico_hasta_macros_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_macros_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
<tr class="title">
<td></td>
<td>Solo Intermedio</td>
<td>De Intermedio Hasta Avanzado</td>
<td>Solo Intermedio Hasta Macros</td>
</tr>
<tr>
<td></td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_intermedio_copy') ): ?>
<ul>
<?php while( have_rows('solo_intermedio_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_intermedio_copy') ): ?>
<ul>
<?php while( have_rows('solo_intermedio_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_intermedio_hasta_avanzado_copy') ): ?>
<ul>
<?php while( have_rows('de_intermedio_hasta_avanzado_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_intermedio_hasta_avanzado_copy') ): ?>
<ul>
<?php while( have_rows('de_intermedio_hasta_avanzado_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_intermedio_hasta_macros_copy') ): ?>
<ul>
<?php while( have_rows('solo_intermedio_hasta_macros_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_intermedio_hasta_macros_copy') ): ?>
<ul>
<?php while( have_rows('solo_intermedio_hasta_macros_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
<tr class="title">
<td></td>
<td></td>
<td>Solo Avanzado</td>
<td>De Avanzado Hasta Macros</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_avanzado_copy') ): ?>
<ul>
<?php while( have_rows('solo_avanzado_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_avanzado_copy') ): ?>
<ul>
<?php while( have_rows('solo_avanzado_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_avanzado_hasta_macros_copy') ): ?>
<ul>
<?php while( have_rows('de_avanzado_hasta_macros_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_avanzado_hasta_macros_copy') ): ?>
<ul>
<?php while( have_rows('de_avanzado_hasta_macros_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
<tr class="title">
<td></td>
<td></td>
<td></td>
<td>Solo Macros</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_macros_copy') ): ?>
<ul>
<?php while( have_rows('solo_macros_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_macros_copy') ): ?>
<ul>
<?php while( have_rows('solo_macros_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
<!-- HORARIO C
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
<h2>Horario C</h2>
<?php the_field( "horario_a_-_horas_copy_copy" ); ?>
<table class="horarios_tabla" border="1" width="100%" cellspacing="0">
<tbody>
<tr class="title">
<td>Solo Básico</td>
<td>De Básico Hasta Intermedio</td>
<td>De Básico Hasta Avanzado</td>
<td>De Básico Hasta Macros</td>
</tr>
<tr>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_basico_copy_copy') ): ?>
<ul>
<?php while( have_rows('solo_basico_copy_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_basico_copy_copy') ): ?>
<ul>
<?php while( have_rows('solo_basico_copy_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_basico_hasta_intermedio_copy_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_intermedio_copy_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_basico_hasta_intermedio_copy_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_intermedio_copy_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_basico_hasta_avanzado_copy_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_avanzado_copy_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_basico_hasta_avanzado_copy_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_avanzado_copy_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_basico_hasta_macros_copy_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_macros_copy_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_basico_hasta_macros_copy_copy') ): ?>
<ul>
<?php while( have_rows('de_basico_hasta_macros_copy_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
<tr class="title">
<td></td>
<td>Solo Intermedio</td>
<td>De Intermedio Hasta Avanzado</td>
<td>Solo Intermedio Hasta Macros</td>
</tr>
<tr>
<td></td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_intermedio_copy_copy') ): ?>
<ul>
<?php while( have_rows('solo_intermedio_copy_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_intermedio_copy_copy') ): ?>
<ul>
<?php while( have_rows('solo_intermedio_copy_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_intermedio_hasta_avanzado_copy_copy') ): ?>
<ul>
<?php while( have_rows('de_intermedio_hasta_avanzado_copy_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_intermedio_hasta_avanzado_copy_copy') ): ?>
<ul>
<?php while( have_rows('de_intermedio_hasta_avanzado_copy_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_intermedio_hasta_macros_copy_copy') ): ?>
<ul>
<?php while( have_rows('solo_intermedio_hasta_macros_copy_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_intermedio_hasta_macros_copy_copy') ): ?>
<ul>
<?php while( have_rows('solo_intermedio_hasta_macros_copy_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
<tr class="title">
<td></td>
<td></td>
<td>Solo Avanzado</td>
<td>De Avanzado Hasta Macros</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_avanzado_copy_copy') ): ?>
<ul>
<?php while( have_rows('solo_avanzado_copy_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_avanzado_copy_copy') ): ?>
<ul>
<?php while( have_rows('solo_avanzado_copy_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('de_avanzado_hasta_macros_copy_copy') ): ?>
<ul>
<?php while( have_rows('de_avanzado_hasta_macros_copy_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('de_avanzado_hasta_macros_copy_copy') ): ?>
<ul>
<?php while( have_rows('de_avanzado_hasta_macros_copy_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
<tr class="title">
<td></td>
<td></td>
<td></td>
<td>Solo Macros</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td>
<div class="inicia">Inicia:</div>
<?php if( have_rows('solo_macros_copy_copy') ): ?>
<ul>
<?php while( have_rows('solo_macros_copy_copy') ): the_row();?>
<?php the_sub_field('inicia'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<br>
<div class="finaliza">Finaliza:</div>
<?php if( have_rows('solo_macros_copy_copy') ): ?>
<ul>
<?php while( have_rows('solo_macros_copy_copy') ): the_row();?>
<?php the_sub_field('termina'); ?>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
</div> <!-- End Table -->
</div>
</section>
</section>
<?php get_footer(); ?> | gpl-2.0 |
AllinKhantZeya/Mod-A-Source-Code | src/main/java/com/mod/mod_a/init/ModAMaterials.java | 2266 | package com.mod.mod_a.init;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraftforge.common.util.EnumHelper;
public class ModAMaterials {
/* Vanilla Armour Materials
LEATHER("leather", 5, new int[]{1, 3, 2, 1}, 15),
CHAIN("chainmail", 15, new int[]{2, 5, 4, 1}, 12),
IRON("iron", 15, new int[]{2, 6, 5, 2}, 9),
GOLD("gold", 7, new int[]{2, 5, 3, 1}, 25),
DIAMOND("diamond", 33, new int[]{3, 8, 6, 3}, 10);
Vanilla Tool Materials
WOOD(0, 59, 2.0F, 0.0F, 15),
STONE(1, 131, 4.0F, 1.0F, 5),
IRON(2, 250, 6.0F, 2.0F, 14),
EMERALD(3, 1561, 8.0F, 3.0F, 10),
GOLD(0, 32, 12.0F, 0.0F, 22);
*/
//Mod A Tool Materials
public static final ToolMaterial DARK = EnumHelper.addToolMaterial("DARK", 3, 800, 3.0F, 2.0F, 18);
public static final ToolMaterial CROSS_SWORD = EnumHelper.addToolMaterial("CROSS_SWORD", 3, 1000, 2.0F, 4.0F, 3);
public static final ToolMaterial SOUL = EnumHelper.addToolMaterial("SOUL", 2, 400, 10.0F, 1.0F, 30);
public static final ToolMaterial DRAGON = EnumHelper.addToolMaterial("DRAGON", 3, 1800, 6.0F, 5.0F, 10);
public static final ToolMaterial WITHER = EnumHelper.addToolMaterial("WITHER", 3, 1600, 13.0F, 3.0F, 15);
//Mod A Armour Materials
public static final ArmorMaterial DARK_ARMOR = EnumHelper.addArmorMaterial("DARK_ARMOR", "dark_armor", 20, new int[]{2, 7, 5, 2}, 20);
public static final ArmorMaterial KNIGHT = EnumHelper.addArmorMaterial("KNIGHT", "knight", 18, new int[]{3, 8, 4, 1}, 23);
public static final ArmorMaterial FESTIVE = EnumHelper.addArmorMaterial("FESTIVE", "festive", 10, new int[]{2, 4, 4, 1}, 30);
public static final ArmorMaterial REAPER = EnumHelper.addArmorMaterial("REAPER", "reaper", 25, new int[]{2, 9, 7, 2}, 12);
public static final ArmorMaterial SOUL_ARMOR = EnumHelper.addArmorMaterial("SOUL_ARMOR", "soul_armor", 10, new int[]{2, 6, 4, 2}, 35);
public static final ArmorMaterial DRAGON_ARMOR = EnumHelper.addArmorMaterial("DRAGON_ARMOR", "dragon_armor", 38, new int[]{4, 9, 8, 4}, 9);
public static final ArmorMaterial WITHER_ARMOR =EnumHelper.addArmorMaterial("WITHER_ARMOR", "wither_armor", 35, new int[]{4, 8, 5, 4}, 27);
}
| gpl-2.0 |
teamcriterion/sourcerefactory.com | sites/default/files/php/twig/7f30d3f0_fieldset.html.twig_0b5ebc11a7bc56124bf6c65a852d8fc0ff51e99dee5b3d6dfa839512f62f2915/7688454334b74fba5f70a7860b0ca94b0f7e65b1cd39a17d718d1295e2fa0d97.php | 4939 | <?php
/* core/themes/classy/templates/form/fieldset.html.twig */
class __TwigTemplate_0b5ebc11a7bc56124bf6c65a852d8fc0ff51e99dee5b3d6dfa839512f62f2915 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 24
$context["classes"] = array(0 => "form-item", 1 => "js-form-wrapper", 2 => "form-wrapper");
// line 30
echo "<fieldset";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["attributes"]) ? $context["attributes"] : null), "addClass", array(0 => (isset($context["classes"]) ? $context["classes"] : null)), "method"), "html", null, true);
echo ">
";
// line 32
$context["legend_span_classes"] = array(0 => "fieldset-legend", 1 => (( // line 34
(isset($context["required"]) ? $context["required"] : null)) ? ("js-form-required") : ("")), 2 => (( // line 35
(isset($context["required"]) ? $context["required"] : null)) ? ("form-required") : ("")));
// line 38
echo " ";
// line 39
echo " <legend";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["legend"]) ? $context["legend"] : null), "attributes", array()), "html", null, true);
echo ">
<span";
// line 40
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute($this->getAttribute((isset($context["legend_span"]) ? $context["legend_span"] : null), "attributes", array()), "addClass", array(0 => (isset($context["legend_span_classes"]) ? $context["legend_span_classes"] : null)), "method"), "html", null, true);
echo ">";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["legend"]) ? $context["legend"] : null), "title", array()), "html", null, true);
echo "</span>
</legend>
<div class=\"fieldset-wrapper\">
";
// line 43
if ((isset($context["errors"]) ? $context["errors"] : null)) {
// line 44
echo " <div class=\"form-item--error-message\">
<strong>";
// line 45
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["errors"]) ? $context["errors"] : null), "html", null, true);
echo "</strong>
</div>
";
}
// line 48
echo " ";
if ((isset($context["prefix"]) ? $context["prefix"] : null)) {
// line 49
echo " <span class=\"field-prefix\">";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["prefix"]) ? $context["prefix"] : null), "html", null, true);
echo "</span>
";
}
// line 51
echo " ";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["children"]) ? $context["children"] : null), "html", null, true);
echo "
";
// line 52
if ((isset($context["suffix"]) ? $context["suffix"] : null)) {
// line 53
echo " <span class=\"field-suffix\">";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["suffix"]) ? $context["suffix"] : null), "html", null, true);
echo "</span>
";
}
// line 55
echo " ";
if ($this->getAttribute((isset($context["description"]) ? $context["description"] : null), "content", array())) {
// line 56
echo " <div";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute($this->getAttribute((isset($context["description"]) ? $context["description"] : null), "attributes", array()), "addClass", array(0 => "description"), "method"), "html", null, true);
echo ">";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["description"]) ? $context["description"] : null), "content", array()), "html", null, true);
echo "</div>
";
}
// line 58
echo " </div>
</fieldset>
";
}
public function getTemplateName()
{
return "core/themes/classy/templates/form/fieldset.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 89 => 58, 81 => 56, 78 => 55, 72 => 53, 70 => 52, 65 => 51, 59 => 49, 56 => 48, 50 => 45, 47 => 44, 45 => 43, 37 => 40, 32 => 39, 30 => 38, 28 => 35, 27 => 34, 26 => 32, 21 => 30, 19 => 24,);
}
}
| gpl-2.0 |
ProjectSkyfire/SkyFire.548 | src/server/game/Boost/Boost.cpp | 16081 | /*
* Copyright (C) 2011-2021 Project SkyFire <https://www.projectskyfire.org/>
* Copyright (C) 2008-2021 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2021 MaNGOS <https://www.getmangos.eu/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Boost.h"
#include "WorldSession.h"
#include "Config.h"
CharacterBooster::CharacterBooster(WorldSession* session) : m_session(session), m_timer(0), m_boosting(false), m_sendPacket(false) { }
SlotEquipmentMap const* CharacterBooster::_GetCharBoostItems(std::vector<std::pair<uint32, uint32> >& itemsToMail) const
{
itemsToMail.push_back(std::make_pair(LEMON_FLAVOUR_PUDING_ID, LEMON_FLAVOUR_PUDING_COUNT));
switch (m_charBoostInfo.specialization)
{
case SPEC_DEATH_KNIGHT_BLOOD:
return &deathKnightEquipmentBlood;
case SPEC_DEATH_KNIGHT_FROST:
return &deathKnightEquipmentFrost;
case SPEC_DEATH_KNIGHT_UNHOLY:
return &deathKnightEquipmentUnholy;
case SPEC_DRUID_BALANCE:
return &druidEquipmentBalance;
case SPEC_DRUID_FERAL:
case SPEC_DRUID_GUARDIAN:
return &druidEquipmentFeral;
case SPEC_DRUID_RESTORATION:
return &druidEquipmentRestoration;
case SPEC_HUNTER_BEAST_MASTERY:
case SPEC_HUNTER_MARKSMANSHIP:
case SPEC_HUNTER_SURVIVAL:
return &hunterEquipment;
case SPEC_MAGE_ARCANE:
case SPEC_MAGE_FIRE:
case SPEC_MAGE_FROST:
//itemsToMail.push_back(std::make_pair(101081, 1));
return &mageEquipment;
case SPEC_MONK_BREWMASTER:
return &monkEquipmentBrewmaster;
case SPEC_MONK_MISTWEAVER:
return &monkEquipmentMistweaver;
case SPEC_MONK_WINDWALKER:
return &monkEquipmentWindwalker;
case SPEC_PALADIN_HOLY:
return &paladinEquipmentHoly;
case SPEC_PALADIN_PROTECTION:
return &paladinEquipmentProtection;
case SPEC_PALADIN_RETRIBUTION:
return &paladinEquipmentRetribution;
case SPEC_PRIEST_DISCIPLINE:
case SPEC_PRIEST_HOLY:
//itemsToMail.push_back(std::make_pair(101172, 1));
return &priestEquipmentDisciplineAndHoly;
case SPEC_PRIEST_SHADOW:
//itemsToMail.push_back(std::make_pair(101172, 1));
return &priestEquipmentShadow;
case SPEC_ROGUE_ASSASSINATION:
return &rogueEquipmentAssassionation;
case SPEC_ROGUE_COMBAT:
return &rogueEquipmentCombat;
case SPEC_ROGUE_SUBTLETY:
return &rogueEquipmentCombat;
case SPEC_SHAMAN_ELEMENTAL:
return &shamanEquipmentElemental;
case SPEC_SHAMAN_ENHANCEMENT:
return &shamanEquipmentEnhancement;
case SPEC_SHAMAN_RESTORATION:
return &shamanEquipmentRestoration;
case SPEC_WARLOCK_AFFLICTION:
case SPEC_WARLOCK_DEMONOLOGY:
case SPEC_WARLOCK_DESTRUCTION:
//itemsToMail.push_back(std::make_pair(101275, 1));
return &warlockEquipment;
case SPEC_WARRIOR_ARMS:
return &warriorEquipmentArms;
case SPEC_WARRIOR_FURY:
return &warriorEquipmentFury;
case SPEC_WARRIOR_PROTECTION:
return &warriorEquipmentProtection;
default:
return NULL;
}
}
void CharacterBooster::_SendCharBoostPacket(SlotEquipmentMap const* items) const
{
ObjectGuid guid = m_charBoostInfo.charGuid;
WorldPacket data(SMSG_BATTLE_PAY_BOOST_ITEMS, 8 + 3 + items->size());
data.WriteGuidMask(guid, 2, 0, 7, 5, 3, 4, 1);
data.WriteBits(items->size(), 22);
data.WriteBit(guid[6]);
data.FlushBits();
data.WriteGuidBytes(guid, 7, 2, 6, 5);
for (SlotEquipmentMap::const_iterator itr = items->begin(); itr != items->end(); itr++)
data << (uint32)itr->second;
data.WriteGuidBytes(guid, 0, 1, 3, 4);
m_session->SendPacket(&data);
}
uint32 CharacterBooster::_PrepareMail(SQLTransaction& trans, std::string const& subject, std::string const& body) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_MAIL);
uint32 mailId = sObjectMgr->GenerateMailID();
stmt->setUInt32(0, mailId);
stmt->setUInt8(1, MAIL_NORMAL);
stmt->setInt8(2, MAIL_STATIONERY_DEFAULT);
stmt->setUInt16(3, 0);
stmt->setUInt32(4, m_charBoostInfo.lowGuid);
stmt->setUInt32(5, m_charBoostInfo.lowGuid);
stmt->setString(6, subject);
stmt->setString(7, body);
stmt->setBool(8, true);
stmt->setUInt64(9, time(NULL) + 180 * DAY);
stmt->setUInt64(10, time(NULL));
stmt->setUInt32(11, 0);
stmt->setUInt32(12, 0);
stmt->setUInt8(13, 0);
trans->Append(stmt);
return mailId;
}
void CharacterBooster::_SendMail(SQLTransaction& trans, std::vector<std::pair<uint32, uint32> > const& items) const
{
if (items.empty())
return;
uint32 mailId = _PrepareMail(trans, CHARRACTER_BOOST_EQUIPED_ITEMS_MAIL_SUBJECT, CHARRACTER_BOOST_EQUIPED_ITEMS_MAIL_BODY);
PreparedStatement* stmt = NULL;
Player* player = sObjectAccessor->FindPlayer(m_charBoostInfo.charGuid);
for (uint8 i = 0; i < items.size(); i++)
{
if (Item* item = Item::CreateItem(items[i].first, items[i].second, player))
{
item->SetBinding(true);
item->SaveToDB(trans);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_MAIL_ITEM);
stmt->setUInt32(0, mailId);
stmt->setUInt32(1, item->GetGUIDLow());
stmt->setUInt32(2, m_charBoostInfo.lowGuid);
trans->Append(stmt);
}
}
}
void CharacterBooster::_MailEquipedItems(SQLTransaction& trans) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_INVENTORY_ITEM_GUID_UNTIL_BAG_SLOT);
stmt->setUInt32(0, 0);
stmt->setUInt8(1, EQUIPMENT_SLOT_END);
stmt->setUInt32(2, m_charBoostInfo.lowGuid);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (!result)
return;
uint32 mailId = _PrepareMail(trans, CHARRACTER_BOOST_EQUIPED_ITEMS_MAIL_SUBJECT, CHARRACTER_BOOST_EQUIPED_ITEMS_MAIL_BODY);
uint32 itemCount = 0;
do
{
if (itemCount++ > 10)
{
itemCount = 0;
mailId = _PrepareMail(trans, CHARRACTER_BOOST_EQUIPED_ITEMS_MAIL_SUBJECT, CHARRACTER_BOOST_EQUIPED_ITEMS_MAIL_BODY);
}
uint32 itemGuid = (*result)[0].GetUInt32();
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_MAIL_ITEM);
stmt->setUInt32(0, mailId);
stmt->setUInt32(1, itemGuid);
stmt->setUInt32(2, m_charBoostInfo.lowGuid);
trans->Append(stmt);
}
while (result->NextRow());
// unEquip after sending
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_INVENTORY_UNTIL_BAG_SLOT);
stmt->setUInt32(0, 0);
stmt->setUInt8(1, EQUIPMENT_SLOT_END);
stmt->setUInt32(2, m_charBoostInfo.lowGuid);
trans->Append(stmt);
}
std::string CharacterBooster::_SetSpecialization(SQLTransaction& trans, uint8 const& classId) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_TALENT);
stmt->setUInt32(0, m_charBoostInfo.lowGuid);
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
do
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
stmt->setUInt32(0, (*result)[0].GetUInt32());
stmt->setUInt32(1, m_charBoostInfo.lowGuid);
trans->Append(stmt);
}
while (result->NextRow());
}
if (uint32 const* specs = GetClassSpecializations(classId))
{
for (uint8 i = 0; i < MAX_TALENT_TABS; i++)
{
if (std::vector<uint32> const* spells = GetSpecializationSpells(specs[i]))
{
for (std::vector<uint32>::const_iterator iter = spells->begin(); iter != spells->end(); iter++)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SPELL_BY_SPELL);
stmt->setUInt32(0, *iter);
stmt->setUInt32(1, m_charBoostInfo.lowGuid);
trans->Append(stmt);
}
}
}
}
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_TALENT);
stmt->setUInt32(0, m_charBoostInfo.lowGuid);
trans->Append(stmt);
std::ostringstream talentTree;
talentTree << m_charBoostInfo.specialization << " 0 ";
return talentTree.str();
}
void CharacterBooster::_LearnSpells(SQLTransaction& trans, uint8 const& raceId, uint8 const& classId) const
{
PreparedStatement* stmt;
uint32 const* languageSpells = NULL;
if (raceId == RACE_PANDAREN_HORDE)
languageSpells = pandarenLanguageSpellsHorde;
else if (raceId == RACE_PANDAREN_ALLIANCE)
languageSpells = pandarenLanguageSpellsAlliance;
if (languageSpells)
{
for (uint8 i = 0; i < PANDAREN_FACTION_LANGUAGE_COUNT; i++)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SPELL);
stmt->setUInt32(0, m_charBoostInfo.lowGuid);
stmt->setUInt32(1, languageSpells[i]);
stmt->setBool(2, true);
stmt->setBool(3, false);
trans->Append(stmt);
}
}
std::vector<uint32> spellsToLearn(CharBoostSpells);
spellsToLearn.push_back(m_charBoostInfo.allianceFaction ? SWIFT_PURPLE_GRYPGON_SPELL : SWIFT_PURPLE_WIND_RIDER_SPELL);
switch (classId)
{
case CLASS_WARRIOR:
case CLASS_PALADIN:
spellsToLearn.push_back(PLATE_MAIL_ARMOR_SPELL);
break;
default:
break;
}
for (uint8 i = 0; i < spellsToLearn.size(); i++)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_SPELL);
stmt->setUInt32(0, m_charBoostInfo.lowGuid);
stmt->setUInt32(1, spellsToLearn[i]);
stmt->setBool(2, true);
stmt->setBool(3, false);
trans->Append(stmt);
}
}
uint8 CharacterBooster::_GetRace() const
{
uint8 charRace = 0;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_RACE);
stmt->setUInt32(0, m_charBoostInfo.lowGuid);
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
charRace = (*result)[0].GetUInt8();
if (charRace == RACE_PANDAREN_NEUTRAL)
charRace = m_charBoostInfo.allianceFaction ? RACE_PANDAREN_ALLIANCE : RACE_PANDAREN_HORDE;
}
return charRace;
}
std::string CharacterBooster::_EquipItems(SQLTransaction& trans, SlotEquipmentMap const* itemsToEquip) const
{
SlotEquipmentMap::const_iterator itr;
std::ostringstream items;
PreparedStatement* stmt;
Player* player = sObjectAccessor->FindPlayer(m_charBoostInfo.charGuid);
for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; i++)
{
itr = itemsToEquip->find(i);
if (itr != itemsToEquip->end())
{
if (Item* item = Item::CreateItem(itr->second, 1, player))
{
item->SetBinding(true);
item->SaveToDB(trans);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_INVENTORY);
stmt->setUInt32(0, m_charBoostInfo.lowGuid);
stmt->setUInt32(1, 0);
stmt->setUInt8(2, itr->first);
stmt->setUInt32(3, item->GetGUIDLow());
trans->Append(stmt);
items << (itr->second) << " 0 ";
}
else
items << "0 0 ";
}
else
items << "0 0 ";
}
return items.str();
}
void CharacterBooster::_SaveBoostedChar(SQLTransaction& trans, std::string const& items, uint8 const& raceId, uint8 const& classId) const
{
float const* position = m_charBoostInfo.allianceFaction ? startPosition[1] : startPosition[0];
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHARACTER_BOOST);
stmt->setUInt8(0, raceId);
stmt->setUInt64(1, sWorld->getIntConfig(WorldIntConfigs::CONFIG_BOOST_START_MONEY));
stmt->setUInt8(2, sWorld->getIntConfig(WorldIntConfigs::CONFIG_BOOST_START_LEVEL));
stmt->setFloat(3, position[0]);
stmt->setFloat(4, position[1]);
stmt->setFloat(5, position[2]);
stmt->setFloat(6, position[3]);
stmt->setUInt16(7, VALE_OF_ETERNAL_BLOSSOMS_MAP_ID);
stmt->setString(8, _SetSpecialization(trans, classId));
stmt->setUInt16(9, AT_LOGIN_FIRST);
stmt->setString(10, items);
stmt->setUInt32(11, m_charBoostInfo.lowGuid);
trans->Append(stmt);
}
void CharacterBooster::_HandleCharacterBoost() const
{
uint8 classId = 0;
if (ChrSpecializationEntry const* specEntry = sChrSpecializationStore.LookupEntry(m_charBoostInfo.specialization))
classId = specEntry->classId;
if (!classId)
return;
uint8 raceId = _GetRace();
if (!raceId)
return;
std::vector<std::pair<uint32, uint32> > itemsToMail;
SlotEquipmentMap const* itemsToEquip = _GetCharBoostItems(itemsToMail);
if (!itemsToEquip)
return;
SlotEquipmentMap const* bagsToEquip = &embersilkBags;
if (!bagsToEquip)
return;
SQLTransaction trans = CharacterDatabase.BeginTransaction();
_MailEquipedItems(trans);
_SendMail(trans, itemsToMail);
_LearnSpells(trans, raceId, classId);
_EquipItems(trans, bagsToEquip);
_SaveBoostedChar(trans, _EquipItems(trans, itemsToEquip), raceId, classId);
CharacterDatabase.CommitTransaction(trans);
m_session->SetBoosting(false);
_SendCharBoostPacket(itemsToEquip);
}
void CharacterBooster::HandleCharacterBoost()
{
if (!m_charBoostInfo.charGuid)
return;
switch (m_charBoostInfo.action)
{
case CHARACTER_BOOST_ITEMS:
m_session->SendBattlePayDistributionUpdate(m_charBoostInfo.charGuid, CHARACTER_BOOST, m_charBoostInfo.action,
CHARACTER_BOOST_TEXT_ID, CHARACTER_BOOST_BONUS_TEXT, CHARACTER_BOOST_BONUS_TEXT2);
m_charBoostInfo.action = CHARACTER_BOOST_APPLIED;
m_timer = 500;
m_sendPacket = true;
break;
case CHARACTER_BOOST_APPLIED:
m_session->SendBattlePayDistributionUpdate(m_charBoostInfo.charGuid, CHARACTER_BOOST, m_charBoostInfo.action,
CHARACTER_BOOST_TEXT_ID, CHARACTER_BOOST_BONUS_TEXT, CHARACTER_BOOST_BONUS_TEXT2);
m_charBoostInfo = CharacterBoostData();
break;
default:
break;
}
}
void CharacterBooster::SetBoostedCharInfo(uint64 guid, uint32 action, uint32 specialization, bool allianceFaction)
{
m_boosting = true;
m_charBoostInfo.charGuid = guid;
m_charBoostInfo.lowGuid = GUID_LOPART(guid);
m_charBoostInfo.action = action;
m_charBoostInfo.specialization = specialization;
m_charBoostInfo.allianceFaction = allianceFaction;
}
void CharacterBooster::Update(uint32 diff)
{
if (m_sendPacket)
{
if (m_timer <= diff)
{
m_sendPacket = false;
_HandleCharacterBoost();
}
else
m_timer -= diff;
}
} | gpl-2.0 |
aharrison24/XCSoar | src/Wind/CirclingWind.hpp | 2352 | /*
Copyright_License {
XCSoar Glide Computer - http://www.xcsoar.org/
Copyright (C) 2000-2012 The XCSoar Project
A detailed list of copyright holders can be found in the file "AUTHORS".
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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
}
*/
#ifndef XCSOAR_CIRCLING_WIND_HPP
#define XCSOAR_CIRCLING_WIND_HPP
#include "Vector.hpp"
#include "Navigation/GeoPoint.hpp"
#include "Util/StaticArray.hpp"
#include "NMEA/Validity.hpp"
struct MoreData;
struct DerivedInfo;
/**
* Class to provide wind estimates from circling
*/
class CirclingWind
{
/**
* The windanalyser analyses the list of flightsamples looking for
* windspeed and direction.
*/
struct Sample
{
Vector v;
fixed time;
fixed mag;
};
Validity last_track_available, last_ground_speed_available;
// we are counting the number of circles, the first onces are probably not very round
int circle_count;
// active is set to true or false by the slot_newFlightMode slot
bool active;
int circle_deg;
Angle last_track;
Vector min_vector;
Vector max_vector;
bool first;
StaticArray<Sample, 50> samples;
public:
struct Result
{
unsigned quality;
Vector wind;
Result() {}
Result(int _quality):quality(_quality) {}
Result(int _quality, Vector _wind):quality(_quality), wind(_wind) {}
bool IsValid() const {
return quality > 0;
}
};
/**
* Clear as if never flown
*/
void Reset();
/**
* Called if the flightmode changes
*/
void NewFlightMode(const DerivedInfo &derived);
/**
* Called if a new sample is available in the samplelist.
*/
Result NewSample(const MoreData &info);
private:
Result CalcWind();
};
#endif
| gpl-2.0 |
Shmuma/z | frontends/php/chart5.php | 5597 | <?php
/*
** ZABBIX
** Copyright (C) 2000-2005 SIA Zabbix
**
** 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, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
?>
<?php
require_once "include/config.inc.php";
require_once "include/services.inc.php";
$page["file"] = "chart5.php";
$page["title"] = "S_CHART";
$page["type"] = PAGE_TYPE_IMAGE;
include_once "include/page_header.php";
?>
<?php
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
"serviceid"=> array(T_ZBX_INT, O_MAND,P_SYS, DB_ID, NULL)
);
check_fields($fields);
?>
<?php
if(! (DBfetch(DBselect('select serviceid from services where serviceid='.$_REQUEST["serviceid"]))) )
{
fatal_error(S_NO_IT_SERVICE_DEFINED);
}
$denyed_groups = get_accessible_groups_by_user($USER_DETAILS,PERM_READ_ONLY,PERM_MODE_LT);
if( !($service = DBfetch(DBselect("select s.* from services s left join triggers t on s.triggerid=t.triggerid ".
" left join functions f on t.triggerid=f.triggerid left join items i on f.itemid=i.itemid left join hosts_groups hg on i.hostid=hg.hostid ".
" where (i.hostid is NULL or hg.groupid not in (".$denyed_groups.")) ".
" and s.serviceid=".$_REQUEST["serviceid"]
))))
{
access_deny();
}
?>
<?php
$start_time = time(NULL);
$sizeX=900;
$sizeY=300;
$shiftX=12;
$shiftYup=17;
$shiftYdown=25+15*3;
$im = imagecreate($sizeX+$shiftX+61,$sizeY+$shiftYup+$shiftYdown+10);
$red=ImageColorAllocate($im,255,0,0);
$darkred=ImageColorAllocate($im,150,0,0);
$green=ImageColorAllocate($im,0,255,0);
$darkgreen=ImageColorAllocate($im,0,150,0);
$blue=ImageColorAllocate($im,0,0,255);
$darkblue=ImageColorAllocate($im,0,0,150);
$yellow=ImageColorAllocate($im,255,255,0);
$darkyellow=ImageColorAllocate($im,150,150,0);
$cyan=ImageColorAllocate($im,0,255,255);
$black=ImageColorAllocate($im,0,0,0);
$gray=ImageColorAllocate($im,150,150,150);
$white=ImageColorAllocate($im,255,255,255);
$bg=ImageColorAllocate($im,6+6*16,7+7*16,8+8*16);
$x=imagesx($im);
$y=imagesy($im);
ImageFilledRectangle($im,0,0,$x,$y,$white);
ImageRectangle($im,0,0,$x-1,$y-1,$black);
$str=$service["name"]." (year ".date("Y").")";
$x=imagesx($im)/2-ImageFontWidth(4)*strlen($str)/2;
ImageString($im, 4,$x,1, $str , $darkred);
$now = time(NULL);
$to_time=$now;
$count_now=array();
$problem=array();
$year=date("Y");
$start=mktime(0,0,0,1,1,$year);
$wday=date("w",$start);
if($wday==0) $wday=7;
$start=$start-($wday-1)*24*3600;
for($i=0;$i<52;$i++)
{
if(($period_start=$start+7*24*3600*$i) > time())
break;
if(($period_end=$start+7*24*3600*($i+1)) > time())
$period_end = time();
$stat = calculate_service_availability($_REQUEST["serviceid"],$period_start,$period_end);
$problem[$i]=$stat["problem"];
$ok[$i]=$stat["ok"];
$count_now[$i]=1;
}
for($i=0;$i<=$sizeY;$i+=$sizeY/10)
{
DashedLine($im,$shiftX,$i+$shiftYup,$sizeX+$shiftX,$i+$shiftYup,$gray);
}
for(
$i = 0, $period_start = $start;
$i <= $sizeX;
$i += $sizeX/52, $period_start += 7*24*3600
)
{
DashedLine($im,$i+$shiftX,$shiftYup,$i+$shiftX,$sizeY+$shiftYup,$gray);
ImageStringUp($im, 1,$i+$shiftX-4, $sizeY+$shiftYup+32, date("d.M",$period_start) , $black);
}
$maxY = max(max($problem), 100);
$minY = 0;
$maxX = 900;
$minX = 0;
for($i=1;$i<=52;$i++)
{
if(!isset($ok[$i-1])) continue;
$x2=(900/52)*$sizeX*($i-$minX-1)/($maxX-$minX);
$y2=$sizeY*($ok[$i-1]-$minY)/($maxY-$minY);
$y2=$sizeY-$y2;
ImageFilledRectangle($im,$x2+$shiftX,$y2+$shiftYup,$x2+$shiftX+8,$sizeY+$shiftYup,ImageColorAllocate($im,120,200,120));
ImageRectangle($im,$x2+$shiftX,$y2+$shiftYup,$x2+$shiftX+8,$sizeY+$shiftYup,$black);
// Doesn't work for some reason
ImageFilledRectangle($im,$x2+$shiftX,$shiftYup,$x2+$shiftX+8,$y2+$shiftYup,ImageColorAllocate($im,200,120,120));
ImageRectangle($im,$x2+$shiftX,$shiftYup,$x2+$shiftX+8,$y2+$shiftYup,$black);
}
for($i=0;$i<=$sizeY;$i+=$sizeY/10)
{
ImageString($im, 1, $sizeX+5+$shiftX, $sizeY-$i-4+$shiftYup, ($i*($maxY-$minY)/$sizeY+$minY)."%" , ImageColorAllocate($im,200,120,120));
}
ImageFilledRectangle($im,$shiftX,$sizeY+$shiftYup+39+15*0,$shiftX+5,$sizeY+$shiftYup+35+9+15*0,ImageColorAllocate($im,120,200,120));
ImageRectangle($im,$shiftX,$sizeY+$shiftYup+39+15*0,$shiftX+5,$sizeY+$shiftYup+35+9+15*0,$black);
ImageString($im, 2,$shiftX+9,$sizeY+$shiftYup+15*0+35, "OK (%)", $black);
ImageFilledRectangle($im,$shiftX,$sizeY+$shiftYup+39+15*1,$shiftX+5,$sizeY+$shiftYup+35+9+15*1,$darkred);
ImageRectangle($im,$shiftX,$sizeY+$shiftYup+39+15*1,$shiftX+5,$sizeY+$shiftYup+15+9+35*1,$black);
ImageString($im, 2,$shiftX+9,$sizeY+$shiftYup+15*1+35, "PROBLEMS (%)", $black);
ImageStringUp($im,0,imagesx($im)-10,imagesy($im)-50, "http://www.zabbix.com", $gray);
$end_time=time(NULL);
ImageString($im, 0,imagesx($im)-100,imagesy($im)-12,"Generated in ".($end_time-$start_time)." sec", $gray);
ImageOut($im);
ImageDestroy($im);
?>
<?php
include_once "include/page_footer.php";
?>
| gpl-2.0 |
felladrin/runuo-pt-br | Scripts/Mobiles/Monsters/ML/Labyrinth/Pyre.cs | 2023 | using System;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Items;
using Server.Spells;
namespace Server.Mobiles
{
[CorpseName( "o corpo de Pyre" )]
public class Pyre : Phoenix
{
[Constructable]
public Pyre()
{
IsParagon = true;
Name = "Pyre";
Hue = 0x489;
FightMode = FightMode.Closest;
SetStr( 605, 611 );
SetDex( 391, 519 );
SetInt( 669, 818 );
SetHits( 1783, 1939 );
SetDamage( 30 );
SetDamageType( ResistanceType.Physical, 50 );
SetDamageType( ResistanceType.Fire, 50 );
SetResistance( ResistanceType.Physical, 65 );
SetResistance( ResistanceType.Fire, 72, 75 );
SetResistance( ResistanceType.Poison, 36, 41 );
SetResistance( ResistanceType.Energy, 50, 51 );
SetSkill( SkillName.Wrestling, 121.9, 130.6 );
SetSkill( SkillName.Tactics, 114.4, 117.4 );
SetSkill( SkillName.MagicResist, 147.7, 153.0 );
SetSkill( SkillName.Poisoning, 122.8, 124.0 );
SetSkill( SkillName.Magery, 121.8, 127.8 );
SetSkill( SkillName.EvalInt, 103.6, 117.0 );
SetSkill( SkillName.Meditation, 100.0, 110.0 );
Fame = 21000;
Karma = -21000;
}
public override void GenerateLoot()
{
AddLoot( LootPack.UltraRich, 3 );
}
public override WeaponAbility GetWeaponAbility()
{
if ( Utility.RandomBool() )
return WeaponAbility.ParalyzingBlow;
else
return WeaponAbility.BleedAttack;
}
public override bool GivesMLMinorArtifact{ get{ return true; } }
public override int TreasureMapLevel{ get{ return 5; } }
public override bool HasAura{ get{ return true; } }
public Pyre( Serial serial )
: base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
| gpl-2.0 |
AlphaNodes/additionals | lib/additionals/wiki_macros/last_updated_by_macro.rb | 569 | # frozen_string_literal: true
module Additionals
module WikiMacros
module LastUpdatedByMacro
Redmine::WikiFormatting::Macros.register do
desc <<-DESCRIPTION
Displays a user who updated the page.
{{last_updated_by}}
DESCRIPTION
macro :last_updated_by do |obj, args|
raise 'The correct usage is {{last_updated_by}}' unless args.empty?
tag.span safe_join([avatar(obj.author, size: 14), ' ', link_to_user(obj.author)]),
class: 'last-updated-by'
end
end
end
end
end
| gpl-2.0 |
mito/Divine-state-generator | src/system/bymoc/bymoc_system_trans.cc | 1723 | #include "system/bymoc/bymoc_system_trans.hh"
#include "system/bymoc/bymoc_explicit_system.hh"
#include "system/bymoc/bymoc_transition.hh"
#ifndef DOXYGEN_PROCESSING
using namespace divine;
#endif
static transition_t * aux_trans;
static system_trans_t * aux_sys_trans = 0;
static enabled_trans_t * aux_enb_trans = 0;
bymoc_system_trans_t::~bymoc_system_trans_t()
{ /* empty destructor */ }
system_trans_t & bymoc_system_trans_t::operator=(const system_trans_t & second)
{
gerr << "bymoc_system_trans_t::operator= not implemented" << thr();
return (*aux_sys_trans); //unreachable;
}
std::string bymoc_system_trans_t::to_string() const
{
gerr << "bymoc_system_trans_t::to_string not implemented" << thr();
return std::string(""); //unreachable
}
void bymoc_system_trans_t::write(std::ostream & ostr) const
{
gerr << "bymoc_system_trans_t::write not implemented" << thr();
}
void bymoc_system_trans_t::set_count(const size_int_t new_count)
{
gerr << "bymoc_system_trans_t::set_count not implemented" << thr();
}
size_int_t bymoc_system_trans_t::get_count() const
{
gerr << "bymoc_system_trans_t::get_count not implemented" << thr();
return 0; //unreachable
}
transition_t *& bymoc_system_trans_t::operator[](const int i)
{
gerr << "bymoc_system_trans_t::operator[] not implemented" << thr();
return aux_trans; //unreachable
}
transition_t * const & bymoc_system_trans_t::operator[](const int i) const
{
gerr << "bymoc_system_trans_t::operator[] not implemented" << thr();
return aux_trans; //unreachable
}
enabled_trans_t & bymoc_enabled_trans_t::operator=(const enabled_trans_t & second)
{
gerr << "bymoc_system_trans_t::operator= not implemented" << thr();
return (*aux_enb_trans); //unreachable
}
| gpl-2.0 |
captainblue2013/fyscu | core/component/cache/cache.conf.php | 232 | <?php
if(defined('FYSCU_ROOT')){
return array(
'v'=>'0.1.1',
'cache_path'=>PROJECT_ROOT.'tpl/c/', //缓存存放的地方
'seed'=>'hdu%^$hsjr', //生成key的种子串
'cache_time'=>0,
);
}else{
return array();
}
?> | gpl-2.0 |
victoralex/gameleon | public_web/components/bugcraft/resources/public/component.bugcraft.spellEffects/class.spellEffects.boltStickySprayNonCascade.js | 5076 |
spellEffects.boltStickySprayNonCascade = function( args )
{
this.ID = spellEffects.layer[1].push( this ) - 1;
this.alpha = 1;
this.offsetX = 42;
this.offsetY = 12;
this.duration = 500;
this.speed = 12;
this.removeDistance = 60;
this.rotation = 0;
this.deleteRange = 102;
this.previousX = args.sourceCharacter.characterData.character_zone_x - this.offsetX - 5;
this.previousY = args.sourceCharacter.characterData.character_zone_y - this.offsetY - 30;
var dateStart = new Date();
var startTime = dateStart.getTime();
var dateEnd = 0;
var endTime = 0;
var dx = 0;
var dy = 0;
var self = this;
var boltStickySprayImageObject = new Image();
boltStickySprayImageObject.src = '/components/bugcraft/resources/public/component.bugcraft.spellEffects/images/bolt/stickySprayBolt/bolt_slow_glow0.png';
var boltStickySpraySound = soundManager.createSound({
id: 'boltStickySpray' + ( ++soundIncrementor ),
url: '/components/bugcraft/resources/public/component.bugcraft.spellEffects/sounds/boltStickySpray.mp3',
volume: spellEffects.volumeByRange ( Component.bugcraft.currentCharacterObject.characterData.character_zone_x, Component.bugcraft.currentCharacterObject.characterData.character_zone_y, args.targetCharacter.characterData.character_zone_x, args.targetCharacter.characterData.character_zone_y, spellEffects.volumeRangeLong )
});
//boltStickySpraySound.play();
var boltPositionX = args.sourceCharacter.characterData.character_zone_x;
var boltPositionY = args.sourceCharacter.characterData.character_zone_y;
//
//draw the bolt effect
//
this.draw = function()
{
self.computeTrajectory();
Map.ctx.globalAlpha = self.alpha;
Map.ctx.save();
Map.ctx.translate( boltPositionX, boltPositionY );
Map.ctx.rotate( self.rotation );
Map.ctx.shadowOffsetX = 9;
Map.ctx.shadowOffsetY = 9;
Map.ctx.shadowColor = 'rgba(0, 0, 0, 0.75)';
Map.ctx.drawImage(
boltStickySprayImageObject,
- self.offsetX,
- self.offsetY
)
self.previousX = boltPositionX - self.offsetX - 5;
self.previousY = boltPositionY - self.offsetY - 30;
Map.ctx.restore();
Map.ctx.globalAlpha = 1;
}
this.computeTrajectory = function()
{
// remove the effect if the projectile is less than self.removeDistance px to the target
var distanceToTarget = Math.floor( Math.sqrt( (args.targetCharacter.characterData.character_zone_x - boltPositionX ) * (args.targetCharacter.characterData.character_zone_x - boltPositionX ) + (args.targetCharacter.characterData.character_zone_y - boltPositionY ) * (args.targetCharacter.characterData.character_zone_y - boltPositionY ) ) )
if ( distanceToTarget < self.removeDistance )
{
self.remove();
}
dateEnd = new Date();
endTime = dateEnd.getTime();
self.speed = distanceToTarget * 15 / (self.duration - endTime + startTime);
// angle calculations
if ( args.targetCharacter.characterData.character_zone_x > boltPositionX )
{
self.rotation = Math.atan( (boltPositionY - args.targetCharacter.characterData.character_zone_y) / (boltPositionX - args.targetCharacter.characterData.character_zone_x) );
//alert('quadran bottom-right + top-right');
}
if ( args.targetCharacter.characterData.character_zone_x < boltPositionX && args.targetCharacter.characterData.character_zone_y >= boltPositionY )
{
self.rotation = Math.atan( (boltPositionY - args.targetCharacter.characterData.character_zone_y) / (boltPositionX - args.targetCharacter.characterData.character_zone_x) ) + Math.PI;
//alert('quadran bottom-left');
}
if ( args.targetCharacter.characterData.character_zone_x < boltPositionX && args.targetCharacter.characterData.character_zone_y < boltPositionY )
{
self.rotation = Math.atan( (boltPositionY - args.targetCharacter.characterData.character_zone_y) / (boltPositionX - args.targetCharacter.characterData.character_zone_x) ) - Math.PI ;
//alert('quadran top-left');
}
//set step distances
dx = Math.floor(this.speed * Math.cos( self.rotation ));
dy = Math.floor(this.speed * Math.sin( self.rotation ));
boltPositionX += dx;
boltPositionY += dy;
}
//remove the boltStickySpray effect
this.remove = function()
{
spellEffects.layerCleaner.push( this );
spellEffects.layer[1][ this.ID ] = null;
clearInterval( _cycleImagePointer );
}
var i = 0;
var _cycleImage = function()
{
boltStickySprayImageObject.src = '/components/bugcraft/resources/public/component.bugcraft.spellEffects/images/bolt/stickySprayBolt/bolt_slow_glow' + ( i++ % 4 ) + '.png';
_cycleImagePointer = setTimeout( _cycleImage, 100 );
}
var _cycleImagePointer = setTimeout( _cycleImage, 100 );
} //end boltStickySpray | gpl-2.0 |
MichelCarroll/GourmetTemporary | single-business.php | 596 | <?php
/**
* The Template for displaying all single posts.
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
*/
get_header(); ?>
<div id="content" class="directory">
<?php twentyeleven_content_nav( 'nav-above' ); ?>
<ul id="listing">
<?php the_post(); ?>
<?php get_template_part( 'content', 'business' ); ?>
</ul>
<?php twentyeleven_content_nav( 'nav-below' ); ?>
</div><!-- #content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?> | gpl-2.0 |
LeagueSharp-Devs/LeagueSharp.SDKEx | Core/UI/IMenu/Values/MenuList.cs | 13739 | // <copyright file="MenuList.cs" company="LeagueSharp">
// Copyright (c) 2015 LeagueSharp.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/
// </copyright>
namespace LeagueSharp.SDK.UI
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Security.Permissions;
using LeagueSharp.SDK.UI.Skins;
using LeagueSharp.SDK.Utils;
/// <summary>
/// A list of values.
/// </summary>
[Serializable]
public abstract class MenuList : MenuItem
{
#region Fields
/// <summary>
/// The index.
/// </summary>
protected int ListIndex;
#endregion
#region Constructors and Destructors
/// <summary>
/// Initializes a new instance of the <see cref="MenuList" /> class.
/// </summary>
internal MenuList()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="MenuList" /> class.
/// </summary>
/// <param name="name">Internal name of the component</param>
/// <param name="displayName">Display name of the component</param>
/// <param name="uniqueString">String to make this component unique</param>
protected MenuList(string name, string displayName, string uniqueString = "")
: base(name, displayName, uniqueString)
{
}
#endregion
#region Public Properties
/// <summary>
/// Gets or sets a value indicating whether the dropdown menu is active.
/// </summary>
public bool Active { get; set; }
/// <summary>
/// Gets the amount of options available
/// </summary>
public abstract int Count { get; }
/// <summary>
/// Gets or sets a value indicating whether if the user is hovering over the dropdown.
/// </summary>
/// <value>
/// <c>true</c> if the user is hovering over the dropdown; otherwise, <c>false</c>.
/// </value>
public bool Hovering { get; set; }
/// <summary>
/// Gets or sets the index of the option that is currently being hovered at by the user.
/// </summary>
public int HoveringIndex { get; set; }
/// <summary>
/// Gets or sets the index.
/// </summary>
/// <value>
/// The index.
/// </value>
public int Index
{
get
{
return this.ListIndex;
}
set
{
int newValue;
if (value < 0)
{
newValue = 0;
}
else if (value >= this.Count)
{
newValue = this.Count - 1;
}
else
{
newValue = value;
}
if (newValue != this.ListIndex)
{
this.ListIndex = newValue;
this.FireEvent();
}
}
}
/// <summary>
/// Gets the maximum width of the string.
/// </summary>
/// <value>
/// The maximum width of the string.
/// </value>
public abstract int MaxStringWidth { get; }
/// <summary>
/// Gets the selected value as an object.
/// </summary>
/// <value>
/// The selected value as an object.
/// </value>
public abstract object SelectedValueAsObject { get; }
/// <summary>
/// Gets a list of strings that represent the different options
/// </summary>
public abstract string[] ValuesAsStrings { get; }
#endregion
#region Methods
/// <summary>
/// Builds an <see cref="ADrawable" /> for this component.
/// </summary>
/// <param name="theme">
/// The theme.
/// </param>
/// <returns>
/// The <see cref="ADrawable" /> instance.
/// </returns>
protected override ADrawable BuildHandler(ITheme theme)
{
return theme.BuildListHandler(this);
}
#endregion
}
/// <summary>
/// A list of values with a specific type.
/// </summary>
/// <typeparam name="T">
/// Type of object in the list
/// </typeparam>
[Serializable]
public class MenuList<T> : MenuList, ISerializable
{
#region Fields
private T[] values;
/// <summary>
/// Local width.
/// </summary>
private int width;
#endregion
#region Constructors and Destructors
/// <summary>
/// Initializes a new instance of the <see cref="MenuList{T}" /> class.
/// </summary>
/// <param name="name">
/// The internal name of this component
/// </param>
/// <param name="displayName">
/// The display name of this component
/// </param>
/// <param name="objects">
/// The objects.
/// </param>
/// <param name="uniqueString">
/// String used in saving settings
/// </param>
public MenuList(string name, string displayName, IEnumerable<T> objects, string uniqueString = "")
: base(name, displayName, uniqueString)
{
this.values = objects.ToArray();
}
/// <summary>
/// Initializes a new instance of the <see cref="MenuList{T}" /> class based upon the given Enumeration type.
/// </summary>
/// <param name="name">
/// The name.
/// </param>
/// <param name="displayName">
/// The display Name.
/// </param>
/// <param name="uniqueString">
/// The unique String.
/// </param>
public MenuList(string name, string displayName, string uniqueString = "")
: this(name, displayName, Enum.GetValues(typeof(T)).Cast<T>(), uniqueString)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="MenuList{T}" /> class.
/// </summary>
/// <param name="info">
/// The information.
/// </param>
/// <param name="context">
/// The context.
/// </param>
protected MenuList(SerializationInfo info, StreamingContext context)
{
this.ListIndex = (int)info.GetValue("index", typeof(int));
}
#endregion
#region Public Properties
/// <summary>
/// Gets the count.
/// </summary>
public override int Count => this.Values.Length;
/// <summary>
/// Gets the maximum width of the string.
/// </summary>
/// <value>
/// The maximum width of the string.
/// </value>
public override int MaxStringWidth
{
get
{
if (this.width == 0)
{
foreach (var newWidth in
this.Values.Select(obj => MenuSettings.Font.MeasureText(null, obj.ToString(), 0).Width)
.Where(newWidth => newWidth > this.width))
{
this.width = newWidth;
}
}
return this.width;
}
}
/// <summary>
/// Gets the selected value.
/// </summary>
/// <value>
/// The selected value.
/// </value>
public T SelectedValue
{
get
{
return this.Values[this.Index];
}
set
{
for (var i = 0; i < this.Values.Length; i++)
{
if (this.Values[i].Equals(value))
{
this.Index = i;
return;
}
}
}
}
/// <summary>
/// Gets the selected value as an object.
/// </summary>
/// <value>
/// The selected value as an object.
/// </value>
public override object SelectedValueAsObject => this.SelectedValue;
/// <summary>
/// Gets the values.
/// </summary>
/// <value>
/// The values.
/// </value>
public T[] Values
{
get
{
return this.values;
}
set
{
this.values = value;
if (this.Index >= this.values.Length)
{
this.Index = this.values.Length - 1;
}
}
}
/// <summary>
/// Gets the values as strings.
/// </summary>
public override string[] ValuesAsStrings
{
get
{
return this.Values.Select(arg => arg.ToString()).ToArray();
}
}
/// <summary>
/// Value Width.
/// </summary>
public override int Width => this.Handler.Width();
#endregion
#region Public Methods and Operators
/// <summary>
/// Drawing callback.
/// </summary>
public override void Draw()
{
this.Handler.Draw();
}
/// <summary>
/// Extracts the specified component.
/// </summary>
/// <param name="component">
/// The component.
/// </param>
public override void Extract(MenuItem component)
{
this.Index = ((MenuList<T>)component).Index;
}
/// <summary>
/// Resets the MenuItem back to his default values.
/// </summary>
public override void RestoreDefault()
{
// Do nothing.
}
/// <summary>
/// Windows Process Messages callback.
/// </summary>
/// <param name="args">
/// <see cref="WindowsKeys" /> data
/// </param>
public override void WndProc(WindowsKeys args)
{
this.Handler.OnWndProc(args);
}
/// <summary>
/// Item PreReset callback.
/// </summary>
public override void PreReset()
{
this.Handler.OnPreReset();
}
/// <summary>
/// Item PostReset callback.
/// </summary>
public override void PostReset()
{
this.Handler.OnPostReset();
}
#endregion
#region Explicit Interface Methods
/// <summary>
/// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the
/// target object.
/// </summary>
/// <param name="info">
/// The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data.
/// </param>
/// <param name="context">
/// The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext" />) for this
/// serialization.
/// </param>
/// <exception cref="T:System.Security.SecurityException">
/// The caller does not have the required permission. =
/// </exception>
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException(nameof(info));
}
info.AddValue("index", this.Index, typeof(int));
}
#endregion
#region Methods
/// <summary>
/// Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the data needed to serialize the
/// target object.
/// </summary>
/// <param name="info">
/// The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> to populate with data.
/// </param>
/// <param name="context">
/// The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext" />) for this
/// serialization.
/// </param>
/// <exception cref="T:System.Security.SecurityException">
/// The caller does not have the required permission. =
/// </exception>
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
protected virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("index", this.Index, typeof(int));
}
#endregion
}
} | gpl-2.0 |
llych/wenwo | jcache/urls.py | 413 | # coding:utf-8
from django.conf.urls import patterns, include, url
from jcache.views import *
urlpatterns = patterns('',
url(r'^cache/cache_refresh/$', cache_refresh, name='cache_refresh'),
url(r'^cache/cache_setting/$', cache_setting, name='cache_setting'),
url(r'^cache/cache_urls/$', cache_urls, name='cache_urls'),
) | gpl-2.0 |
liangbizhi/MoralLibrary | src/com/home/db/DBOpenHelper.java | 795 | package com.home.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DBOpenHelper extends SQLiteOpenHelper{
public DBOpenHelper(Context context) {
super(context, "books.db", null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
String sql = "create table book(id integer primary key autoincrement, isbn text, title text, image text, price text, pages integer,"
+ "binding text, author text, translator text, count integer, pubdate text, publisher text, category text, bookcase text,"
+ " location text, author_intro text, book_intro text, comments text)";
db.execSQL(sql);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
| gpl-2.0 |
farhang/domain_lookup | whois_domain_status.tpl.php | 365 | <?php
// $Id: whois_domain_status.tpl.php,v 1.2 2009/12/30 10:12:02 helmo Exp $
/**
* @file
* Template for the Whois module's output method 'HTMLized status only'.
*/
if (!$registered) {
echo t('The domain %domain is free', array('%domain' => $address)) ;
}
else {
echo t('The domain %domain is registered', array('%domain' => $address));
}
| gpl-2.0 |
astridx/joomla-cms | layouts/joomla/content/readmore.php | 2456 | <?php
/**
* @package Joomla.Site
* @subpackage Layout
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
$params = $displayData['params'];
$item = $displayData['item'];
$direction = Factory::getLanguage()->isRtl() ? 'left' : 'right';
?>
<p class="readmore">
<?php if (!$params->get('access-view')) : ?>
<a class="btn btn-secondary" href="<?php echo $displayData['link']; ?>" itemprop="url" aria-label="<?php echo Text::_('COM_CONTENT_REGISTER_TO_READ_MORE'); ?>
<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>">
<?php echo '<span class="fa fa-chevron-' . $direction . '" aria-hidden="true"></span>'; ?>
<?php echo Text::_('COM_CONTENT_REGISTER_TO_READ_MORE'); ?>
</a>
<?php elseif ($readmore = $item->alternative_readmore) : ?>
<a class="btn btn-secondary" href="<?php echo $displayData['link']; ?>" itemprop="url" aria-label="<?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>">
<?php echo '<span class="fa fa-chevron-' . $direction . '" aria-hidden="true"></span>'; ?>
<?php echo $readmore; ?>
<?php if ($params->get('show_readmore_title', 0) != 0) : ?>
<?php echo HTMLHelper::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
<?php endif; ?>
</a>
<?php elseif ($params->get('show_readmore_title', 0) == 0) : ?>
<a class="btn btn-secondary" href="<?php echo $displayData['link']; ?>" itemprop="url" aria-label="<?php echo Text::_('COM_CONTENT_READ_MORE'); ?> <?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>">
<?php echo '<span class="fa fa-chevron-' . $direction . '" aria-hidden="true"></span>'; ?>
<?php echo Text::sprintf('COM_CONTENT_READ_MORE_TITLE'); ?>
</a>
<?php else : ?>
<a class="btn btn-secondary" href="<?php echo $displayData['link']; ?>" itemprop="url" aria-label="<?php echo Text::_('COM_CONTENT_READ_MORE'); ?> <?php echo htmlspecialchars($item->title, ENT_QUOTES, 'UTF-8'); ?>">
<?php echo '<span class="fa fa-chevron-' . $direction . '" aria-hidden="true"></span>'; ?>
<?php echo Text::_('COM_CONTENT_READ_MORE'); ?>
<?php echo HTMLHelper::_('string.truncate', $item->title, $params->get('readmore_limit')); ?>
</a>
<?php endif; ?>
</p>
| gpl-2.0 |
nemerle/reko | src/Core/Output/BlockDecorator.cs | 1850 | #region License
/*
* Copyright (C) 1999-2021 John Källén.
*
* 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, 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; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Reko.Core.Output
{
/// <summary>
/// This class us used by ProcedureFormatter to render block-specific information
/// before and after blocks are rendered. These will always be rendered as comments.
/// </summary>
public class BlockDecorator
{
public bool ShowEdges { get; set; }
public virtual void BeforeBlock(Block block, List<string> lines)
{
}
public virtual void AfterBlock(Block block, List<string> lines)
{
WriteBlockGraphEdges(block, lines);
}
public virtual void WriteBlockGraphEdges(Block block, List<string> lines)
{
if (ShowEdges && block.Succ.Count > 0)
{
StringBuilder sb = new StringBuilder("succ: ");
foreach (var s in block.Succ.Where(b => b != null))
sb.AppendFormat(" {0}", s.DisplayName);
lines.Add(sb.ToString());
}
}
}
}
| gpl-2.0 |
georgejhunt/HaitiDictionary.activity | data/words/djabl~es.js | 62 | showWord(["n. "," Femèl dyab. Kote dyablès sa a soti.<br>"]) | gpl-2.0 |
emundus/v6 | libraries/fabrik/vendor/aws/aws-sdk-php/src/Sdk.php | 29995 | <?php
namespace Aws;
/**
* Builds AWS clients based on configuration settings.
*
* @method \Aws\ACMPCA\ACMPCAClient createACMPCA(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionACMPCA(array $args = [])
* @method \Aws\Acm\AcmClient createAcm(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionAcm(array $args = [])
* @method \Aws\AlexaForBusiness\AlexaForBusinessClient createAlexaForBusiness(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionAlexaForBusiness(array $args = [])
* @method \Aws\Amplify\AmplifyClient createAmplify(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionAmplify(array $args = [])
* @method \Aws\ApiGateway\ApiGatewayClient createApiGateway(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionApiGateway(array $args = [])
* @method \Aws\AppMesh\AppMeshClient createAppMesh(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionAppMesh(array $args = [])
* @method \Aws\AppSync\AppSyncClient createAppSync(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionAppSync(array $args = [])
* @method \Aws\ApplicationAutoScaling\ApplicationAutoScalingClient createApplicationAutoScaling(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionApplicationAutoScaling(array $args = [])
* @method \Aws\ApplicationDiscoveryService\ApplicationDiscoveryServiceClient createApplicationDiscoveryService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionApplicationDiscoveryService(array $args = [])
* @method \Aws\Appstream\AppstreamClient createAppstream(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionAppstream(array $args = [])
* @method \Aws\Athena\AthenaClient createAthena(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionAthena(array $args = [])
* @method \Aws\AutoScaling\AutoScalingClient createAutoScaling(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionAutoScaling(array $args = [])
* @method \Aws\AutoScalingPlans\AutoScalingPlansClient createAutoScalingPlans(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionAutoScalingPlans(array $args = [])
* @method \Aws\Batch\BatchClient createBatch(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionBatch(array $args = [])
* @method \Aws\Budgets\BudgetsClient createBudgets(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionBudgets(array $args = [])
* @method \Aws\Chime\ChimeClient createChime(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionChime(array $args = [])
* @method \Aws\Cloud9\Cloud9Client createCloud9(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloud9(array $args = [])
* @method \Aws\CloudDirectory\CloudDirectoryClient createCloudDirectory(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudDirectory(array $args = [])
* @method \Aws\CloudFormation\CloudFormationClient createCloudFormation(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudFormation(array $args = [])
* @method \Aws\CloudFront\CloudFrontClient createCloudFront(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudFront(array $args = [])
* @method \Aws\CloudHSMV2\CloudHSMV2Client createCloudHSMV2(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudHSMV2(array $args = [])
* @method \Aws\CloudHsm\CloudHsmClient createCloudHsm(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudHsm(array $args = [])
* @method \Aws\CloudSearch\CloudSearchClient createCloudSearch(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudSearch(array $args = [])
* @method \Aws\CloudSearchDomain\CloudSearchDomainClient createCloudSearchDomain(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudSearchDomain(array $args = [])
* @method \Aws\CloudTrail\CloudTrailClient createCloudTrail(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudTrail(array $args = [])
* @method \Aws\CloudWatch\CloudWatchClient createCloudWatch(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudWatch(array $args = [])
* @method \Aws\CloudWatchEvents\CloudWatchEventsClient createCloudWatchEvents(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudWatchEvents(array $args = [])
* @method \Aws\CloudWatchLogs\CloudWatchLogsClient createCloudWatchLogs(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCloudWatchLogs(array $args = [])
* @method \Aws\CodeBuild\CodeBuildClient createCodeBuild(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCodeBuild(array $args = [])
* @method \Aws\CodeCommit\CodeCommitClient createCodeCommit(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCodeCommit(array $args = [])
* @method \Aws\CodeDeploy\CodeDeployClient createCodeDeploy(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCodeDeploy(array $args = [])
* @method \Aws\CodePipeline\CodePipelineClient createCodePipeline(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCodePipeline(array $args = [])
* @method \Aws\CodeStar\CodeStarClient createCodeStar(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCodeStar(array $args = [])
* @method \Aws\CognitoIdentity\CognitoIdentityClient createCognitoIdentity(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCognitoIdentity(array $args = [])
* @method \Aws\CognitoIdentityProvider\CognitoIdentityProviderClient createCognitoIdentityProvider(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCognitoIdentityProvider(array $args = [])
* @method \Aws\CognitoSync\CognitoSyncClient createCognitoSync(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCognitoSync(array $args = [])
* @method \Aws\Comprehend\ComprehendClient createComprehend(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionComprehend(array $args = [])
* @method \Aws\ComprehendMedical\ComprehendMedicalClient createComprehendMedical(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionComprehendMedical(array $args = [])
* @method \Aws\ConfigService\ConfigServiceClient createConfigService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionConfigService(array $args = [])
* @method \Aws\Connect\ConnectClient createConnect(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionConnect(array $args = [])
* @method \Aws\CostExplorer\CostExplorerClient createCostExplorer(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCostExplorer(array $args = [])
* @method \Aws\CostandUsageReportService\CostandUsageReportServiceClient createCostandUsageReportService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionCostandUsageReportService(array $args = [])
* @method \Aws\DAX\DAXClient createDAX(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionDAX(array $args = [])
* @method \Aws\DLM\DLMClient createDLM(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionDLM(array $args = [])
* @method \Aws\DataPipeline\DataPipelineClient createDataPipeline(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionDataPipeline(array $args = [])
* @method \Aws\DataSync\DataSyncClient createDataSync(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionDataSync(array $args = [])
* @method \Aws\DatabaseMigrationService\DatabaseMigrationServiceClient createDatabaseMigrationService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionDatabaseMigrationService(array $args = [])
* @method \Aws\DeviceFarm\DeviceFarmClient createDeviceFarm(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionDeviceFarm(array $args = [])
* @method \Aws\DirectConnect\DirectConnectClient createDirectConnect(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionDirectConnect(array $args = [])
* @method \Aws\DirectoryService\DirectoryServiceClient createDirectoryService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionDirectoryService(array $args = [])
* @method \Aws\DynamoDb\DynamoDbClient createDynamoDb(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionDynamoDb(array $args = [])
* @method \Aws\DynamoDbStreams\DynamoDbStreamsClient createDynamoDbStreams(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionDynamoDbStreams(array $args = [])
* @method \Aws\EKS\EKSClient createEKS(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionEKS(array $args = [])
* @method \Aws\Ec2\Ec2Client createEc2(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionEc2(array $args = [])
* @method \Aws\Ecr\EcrClient createEcr(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionEcr(array $args = [])
* @method \Aws\Ecs\EcsClient createEcs(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionEcs(array $args = [])
* @method \Aws\Efs\EfsClient createEfs(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionEfs(array $args = [])
* @method \Aws\ElastiCache\ElastiCacheClient createElastiCache(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionElastiCache(array $args = [])
* @method \Aws\ElasticBeanstalk\ElasticBeanstalkClient createElasticBeanstalk(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionElasticBeanstalk(array $args = [])
* @method \Aws\ElasticLoadBalancing\ElasticLoadBalancingClient createElasticLoadBalancing(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionElasticLoadBalancing(array $args = [])
* @method \Aws\ElasticLoadBalancingV2\ElasticLoadBalancingV2Client createElasticLoadBalancingV2(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionElasticLoadBalancingV2(array $args = [])
* @method \Aws\ElasticTranscoder\ElasticTranscoderClient createElasticTranscoder(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionElasticTranscoder(array $args = [])
* @method \Aws\ElasticsearchService\ElasticsearchServiceClient createElasticsearchService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionElasticsearchService(array $args = [])
* @method \Aws\Emr\EmrClient createEmr(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionEmr(array $args = [])
* @method \Aws\FMS\FMSClient createFMS(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionFMS(array $args = [])
* @method \Aws\FSx\FSxClient createFSx(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionFSx(array $args = [])
* @method \Aws\Firehose\FirehoseClient createFirehose(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionFirehose(array $args = [])
* @method \Aws\GameLift\GameLiftClient createGameLift(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionGameLift(array $args = [])
* @method \Aws\Glacier\GlacierClient createGlacier(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionGlacier(array $args = [])
* @method \Aws\GlobalAccelerator\GlobalAcceleratorClient createGlobalAccelerator(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionGlobalAccelerator(array $args = [])
* @method \Aws\Glue\GlueClient createGlue(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionGlue(array $args = [])
* @method \Aws\Greengrass\GreengrassClient createGreengrass(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionGreengrass(array $args = [])
* @method \Aws\GuardDuty\GuardDutyClient createGuardDuty(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionGuardDuty(array $args = [])
* @method \Aws\Health\HealthClient createHealth(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionHealth(array $args = [])
* @method \Aws\Iam\IamClient createIam(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionIam(array $args = [])
* @method \Aws\ImportExport\ImportExportClient createImportExport(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionImportExport(array $args = [])
* @method \Aws\Inspector\InspectorClient createInspector(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionInspector(array $args = [])
* @method \Aws\IoT1ClickDevicesService\IoT1ClickDevicesServiceClient createIoT1ClickDevicesService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionIoT1ClickDevicesService(array $args = [])
* @method \Aws\IoT1ClickProjects\IoT1ClickProjectsClient createIoT1ClickProjects(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionIoT1ClickProjects(array $args = [])
* @method \Aws\IoTAnalytics\IoTAnalyticsClient createIoTAnalytics(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionIoTAnalytics(array $args = [])
* @method \Aws\IoTJobsDataPlane\IoTJobsDataPlaneClient createIoTJobsDataPlane(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionIoTJobsDataPlane(array $args = [])
* @method \Aws\Iot\IotClient createIot(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionIot(array $args = [])
* @method \Aws\IotDataPlane\IotDataPlaneClient createIotDataPlane(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionIotDataPlane(array $args = [])
* @method \Aws\Kafka\KafkaClient createKafka(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionKafka(array $args = [])
* @method \Aws\Kinesis\KinesisClient createKinesis(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionKinesis(array $args = [])
* @method \Aws\KinesisAnalytics\KinesisAnalyticsClient createKinesisAnalytics(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionKinesisAnalytics(array $args = [])
* @method \Aws\KinesisAnalyticsV2\KinesisAnalyticsV2Client createKinesisAnalyticsV2(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionKinesisAnalyticsV2(array $args = [])
* @method \Aws\KinesisVideo\KinesisVideoClient createKinesisVideo(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionKinesisVideo(array $args = [])
* @method \Aws\KinesisVideoArchivedMedia\KinesisVideoArchivedMediaClient createKinesisVideoArchivedMedia(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionKinesisVideoArchivedMedia(array $args = [])
* @method \Aws\KinesisVideoMedia\KinesisVideoMediaClient createKinesisVideoMedia(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionKinesisVideoMedia(array $args = [])
* @method \Aws\Kms\KmsClient createKms(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionKms(array $args = [])
* @method \Aws\Lambda\LambdaClient createLambda(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionLambda(array $args = [])
* @method \Aws\LexModelBuildingService\LexModelBuildingServiceClient createLexModelBuildingService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionLexModelBuildingService(array $args = [])
* @method \Aws\LexRuntimeService\LexRuntimeServiceClient createLexRuntimeService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionLexRuntimeService(array $args = [])
* @method \Aws\LicenseManager\LicenseManagerClient createLicenseManager(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionLicenseManager(array $args = [])
* @method \Aws\Lightsail\LightsailClient createLightsail(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionLightsail(array $args = [])
* @method \Aws\MQ\MQClient createMQ(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMQ(array $args = [])
* @method \Aws\MTurk\MTurkClient createMTurk(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMTurk(array $args = [])
* @method \Aws\MachineLearning\MachineLearningClient createMachineLearning(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMachineLearning(array $args = [])
* @method \Aws\Macie\MacieClient createMacie(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMacie(array $args = [])
* @method \Aws\MarketplaceCommerceAnalytics\MarketplaceCommerceAnalyticsClient createMarketplaceCommerceAnalytics(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMarketplaceCommerceAnalytics(array $args = [])
* @method \Aws\MarketplaceEntitlementService\MarketplaceEntitlementServiceClient createMarketplaceEntitlementService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMarketplaceEntitlementService(array $args = [])
* @method \Aws\MarketplaceMetering\MarketplaceMeteringClient createMarketplaceMetering(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMarketplaceMetering(array $args = [])
* @method \Aws\MediaConnect\MediaConnectClient createMediaConnect(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMediaConnect(array $args = [])
* @method \Aws\MediaConvert\MediaConvertClient createMediaConvert(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMediaConvert(array $args = [])
* @method \Aws\MediaLive\MediaLiveClient createMediaLive(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMediaLive(array $args = [])
* @method \Aws\MediaPackage\MediaPackageClient createMediaPackage(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMediaPackage(array $args = [])
* @method \Aws\MediaStore\MediaStoreClient createMediaStore(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMediaStore(array $args = [])
* @method \Aws\MediaStoreData\MediaStoreDataClient createMediaStoreData(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMediaStoreData(array $args = [])
* @method \Aws\MediaTailor\MediaTailorClient createMediaTailor(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMediaTailor(array $args = [])
* @method \Aws\MigrationHub\MigrationHubClient createMigrationHub(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMigrationHub(array $args = [])
* @method \Aws\Mobile\MobileClient createMobile(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionMobile(array $args = [])
* @method \Aws\Neptune\NeptuneClient createNeptune(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionNeptune(array $args = [])
* @method \Aws\OpsWorks\OpsWorksClient createOpsWorks(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionOpsWorks(array $args = [])
* @method \Aws\OpsWorksCM\OpsWorksCMClient createOpsWorksCM(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionOpsWorksCM(array $args = [])
* @method \Aws\Organizations\OrganizationsClient createOrganizations(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionOrganizations(array $args = [])
* @method \Aws\PI\PIClient createPI(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionPI(array $args = [])
* @method \Aws\Pinpoint\PinpointClient createPinpoint(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionPinpoint(array $args = [])
* @method \Aws\PinpointEmail\PinpointEmailClient createPinpointEmail(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionPinpointEmail(array $args = [])
* @method \Aws\PinpointSMSVoice\PinpointSMSVoiceClient createPinpointSMSVoice(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionPinpointSMSVoice(array $args = [])
* @method \Aws\Polly\PollyClient createPolly(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionPolly(array $args = [])
* @method \Aws\Pricing\PricingClient createPricing(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionPricing(array $args = [])
* @method \Aws\QuickSight\QuickSightClient createQuickSight(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionQuickSight(array $args = [])
* @method \Aws\RAM\RAMClient createRAM(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionRAM(array $args = [])
* @method \Aws\RDSDataService\RDSDataServiceClient createRDSDataService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionRDSDataService(array $args = [])
* @method \Aws\Rds\RdsClient createRds(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionRds(array $args = [])
* @method \Aws\Redshift\RedshiftClient createRedshift(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionRedshift(array $args = [])
* @method \Aws\Rekognition\RekognitionClient createRekognition(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionRekognition(array $args = [])
* @method \Aws\ResourceGroups\ResourceGroupsClient createResourceGroups(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionResourceGroups(array $args = [])
* @method \Aws\ResourceGroupsTaggingAPI\ResourceGroupsTaggingAPIClient createResourceGroupsTaggingAPI(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionResourceGroupsTaggingAPI(array $args = [])
* @method \Aws\RoboMaker\RoboMakerClient createRoboMaker(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionRoboMaker(array $args = [])
* @method \Aws\Route53\Route53Client createRoute53(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionRoute53(array $args = [])
* @method \Aws\Route53Domains\Route53DomainsClient createRoute53Domains(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionRoute53Domains(array $args = [])
* @method \Aws\Route53Resolver\Route53ResolverClient createRoute53Resolver(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionRoute53Resolver(array $args = [])
* @method \Aws\S3\S3Client createS3(array $args = [])
* @method \Aws\S3\S3MultiRegionClient createMultiRegionS3(array $args = [])
* @method \Aws\S3Control\S3ControlClient createS3Control(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionS3Control(array $args = [])
* @method \Aws\SageMaker\SageMakerClient createSageMaker(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSageMaker(array $args = [])
* @method \Aws\SageMakerRuntime\SageMakerRuntimeClient createSageMakerRuntime(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSageMakerRuntime(array $args = [])
* @method \Aws\SecretsManager\SecretsManagerClient createSecretsManager(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSecretsManager(array $args = [])
* @method \Aws\SecurityHub\SecurityHubClient createSecurityHub(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSecurityHub(array $args = [])
* @method \Aws\ServerlessApplicationRepository\ServerlessApplicationRepositoryClient createServerlessApplicationRepository(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionServerlessApplicationRepository(array $args = [])
* @method \Aws\ServiceCatalog\ServiceCatalogClient createServiceCatalog(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionServiceCatalog(array $args = [])
* @method \Aws\ServiceDiscovery\ServiceDiscoveryClient createServiceDiscovery(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionServiceDiscovery(array $args = [])
* @method \Aws\Ses\SesClient createSes(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSes(array $args = [])
* @method \Aws\Sfn\SfnClient createSfn(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSfn(array $args = [])
* @method \Aws\Shield\ShieldClient createShield(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionShield(array $args = [])
* @method \Aws\Sms\SmsClient createSms(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSms(array $args = [])
* @method \Aws\SnowBall\SnowBallClient createSnowBall(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSnowBall(array $args = [])
* @method \Aws\Sns\SnsClient createSns(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSns(array $args = [])
* @method \Aws\Sqs\SqsClient createSqs(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSqs(array $args = [])
* @method \Aws\Ssm\SsmClient createSsm(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSsm(array $args = [])
* @method \Aws\StorageGateway\StorageGatewayClient createStorageGateway(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionStorageGateway(array $args = [])
* @method \Aws\Sts\StsClient createSts(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSts(array $args = [])
* @method \Aws\Support\SupportClient createSupport(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSupport(array $args = [])
* @method \Aws\Swf\SwfClient createSwf(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionSwf(array $args = [])
* @method \Aws\TranscribeService\TranscribeServiceClient createTranscribeService(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionTranscribeService(array $args = [])
* @method \Aws\Transfer\TransferClient createTransfer(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionTransfer(array $args = [])
* @method \Aws\Translate\TranslateClient createTranslate(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionTranslate(array $args = [])
* @method \Aws\Waf\WafClient createWaf(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionWaf(array $args = [])
* @method \Aws\WafRegional\WafRegionalClient createWafRegional(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionWafRegional(array $args = [])
* @method \Aws\WorkDocs\WorkDocsClient createWorkDocs(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionWorkDocs(array $args = [])
* @method \Aws\WorkMail\WorkMailClient createWorkMail(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionWorkMail(array $args = [])
* @method \Aws\WorkSpaces\WorkSpacesClient createWorkSpaces(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionWorkSpaces(array $args = [])
* @method \Aws\XRay\XRayClient createXRay(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionXRay(array $args = [])
* @method \Aws\signer\signerClient createsigner(array $args = [])
* @method \Aws\MultiRegionClient createMultiRegionsigner(array $args = [])
*/
class Sdk
{
const VERSION = '3.81.7';
/** @var array Arguments for creating clients */
private $args;
/**
* Constructs a new SDK object with an associative array of default
* client settings.
*
* @param array $args
*
* @throws \InvalidArgumentException
* @see Aws\AwsClient::__construct for a list of available options.
*/
public function __construct(array $args = [])
{
$this->args = $args;
if (!isset($args['handler']) && !isset($args['http_handler'])) {
$this->args['http_handler'] = default_http_handler();
}
}
public function __call($name, array $args)
{
$args = isset($args[0]) ? $args[0] : [];
if (strpos($name, 'createMultiRegion') === 0) {
return $this->createMultiRegionClient(substr($name, 17), $args);
}
if (strpos($name, 'create') === 0) {
return $this->createClient(substr($name, 6), $args);
}
throw new \BadMethodCallException("Unknown method: {$name}.");
}
/**
* Get a client by name using an array of constructor options.
*
* @param string $name Service name or namespace (e.g., DynamoDb, s3).
* @param array $args Arguments to configure the client.
*
* @return AwsClientInterface
* @throws \InvalidArgumentException if any required options are missing or
* the service is not supported.
* @see Aws\AwsClient::__construct for a list of available options for args.
*/
public function createClient($name, array $args = [])
{
// Get information about the service from the manifest file.
$service = manifest($name);
$namespace = $service['namespace'];
// Instantiate the client class.
$client = "Aws\\{$namespace}\\{$namespace}Client";
return new $client($this->mergeArgs($namespace, $service, $args));
}
public function createMultiRegionClient($name, array $args = [])
{
// Get information about the service from the manifest file.
$service = manifest($name);
$namespace = $service['namespace'];
$klass = "Aws\\{$namespace}\\{$namespace}MultiRegionClient";
$klass = class_exists($klass) ? $klass : 'Aws\\MultiRegionClient';
return new $klass($this->mergeArgs($namespace, $service, $args));
}
private function mergeArgs($namespace, array $manifest, array $args = [])
{
// Merge provided args with stored, service-specific args.
if (isset($this->args[$namespace])) {
$args += $this->args[$namespace];
}
// Provide the endpoint prefix in the args.
if (!isset($args['service'])) {
$args['service'] = $manifest['endpoint'];
}
return $args + $this->args;
}
/**
* Determine the endpoint prefix from a client namespace.
*
* @param string $name Namespace name
*
* @return string
* @internal
* @deprecated Use the `\Aws\manifest()` function instead.
*/
public static function getEndpointPrefix($name)
{
return manifest($name)['endpoint'];
}
}
| gpl-2.0 |
dzan/open-fujix | app/src/main/java/com/dzn/openfujix/MainActivity.java | 1138 | package com.dzn.openfujix;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings)
{
return true;
}
return super.onOptionsItemSelected(item);
}
}
| gpl-2.0 |
jolay/ayansa | cache/mod_vvisit_counter/860aea6b5aac75573e8d7d8ebc839c97-cache-mod_vvisit_counter-9457eb875a4efcfd9f0b9f8ec168d40f.php | 83 | <?php die("Access Denied"); ?>#x#a:2:{s:6:"output";s:0:"";s:6:"result";s:4:"1560";} | gpl-2.0 |
simontakite/sysadmin | pythonscripts/practicalprogramming/cond/if_multiline.py | 91 | ph = 8.0
if ph < 7.0:
print(ph, "is acidic.")
print "You should be careful with that!"
| gpl-2.0 |
pockemul/PockEmul | src/cpu/hd44102.cpp | 6823 | /**********************************************************************
HD44102 Dot Matrix Liquid Crystal Graphic Display Column Driver emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
#include <QDebug>
#include "hd44102.h"
#include "pobject.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
#define LOG 0
#define CONTROL_DISPLAY_OFF 0x38
#define CONTROL_DISPLAY_ON 0x39
#define CONTROL_COUNT_DOWN_MODE 0x3a
#define CONTROL_COUNT_UP_MODE 0x3b
#define CONTROL_Y_ADDRESS_MASK 0x3f
#define CONTROL_X_ADDRESS_MASK 0xc0
#define CONTROL_DISPLAY_START_PAGE 0x3e
#define STATUS_BUSY 0x80 /* not supported */
#define STATUS_COUNT_UP 0x40
#define STATUS_DISPLAY_OFF 0x20
#define STATUS_RESET 0x10 /* not supported */
//**************************************************************************
// INLINE HELPERS
//**************************************************************************
//-------------------------------------------------
// count_up_or_down -
//-------------------------------------------------
inline void CHD44102::count_up_or_down()
{
info.m_output = info.imem[info.m_x][info.m_y];
// qWarning()<<objectName()<<" reg:"<<info.m_x<<info.m_y<<QString("=%1").arg(info.m_output,2,16,QChar('0'));
if (info.m_status & STATUS_COUNT_UP)
{
if (++info.m_y > 49) info.m_y = 0;
}
else
{
if (--info.m_y < 0) info.m_y = 49;
}
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// CHD44102 - constructor
//-------------------------------------------------
CHD44102::CHD44102(CPObject *parent)
{
pPC = parent;
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
bool CHD44102::init()
{
memset(info.imem,0,sizeof(info.imem));
info.m_cs2=0;
info.m_page=0;
info.m_x=0;
info.m_y=0;
updated = true;
Reset();
return true;
}
bool CHD44102::exit()
{
return true;
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void CHD44102::Reset()
{
info.m_status = STATUS_DISPLAY_OFF | STATUS_COUNT_UP;
}
BYTE CHD44102::cmd_status()
{
// qWarning()<<"status:"<<info.m_status;
return 0;
return info.m_status;
}
//-------------------------------------------------
// data_r - data read
//-------------------------------------------------
BYTE CHD44102::get8()
{
UINT8 data = info.m_output; //info.imem[info.m_x][info.m_y];
count_up_or_down();
// qWarning()<<objectName()<<" get:"<<QString("%1").arg(data,2,16,QChar('0'));
return data;
}
//-------------------------------------------------
// data_w - data write
//-------------------------------------------------
void CHD44102::set8( BYTE val)
{
// qWarning()<<"write "<<val<<" to m_x="<<info.m_x<<" m_y="<<info.m_y<<" page="<<info.m_page;
info.imem[info.m_x][info.m_y] = val;
count_up_or_down();
updated = true;
}
void CHD44102::Load_Internal(QXmlStreamReader *xmlIn)
{
if (xmlIn->readNextStartElement()) {
if ( (xmlIn->name()=="cpu") &&
(xmlIn->attributes().value("model").toString() == "hd44102")) {
QByteArray ba_reg = QByteArray::fromBase64(xmlIn->attributes().value("registers").toString().toLatin1());
memcpy((char *) &info,ba_reg.data(),sizeof(info));
updated = true;
}
xmlIn->skipCurrentElement();
}
}
void CHD44102::save_internal(QXmlStreamWriter *xmlOut)
{
xmlOut->writeStartElement("cpu");
xmlOut->writeAttribute("model","hd44102");
QByteArray ba_reg((char*)&info,sizeof(info));
xmlOut->writeAttribute("registers",ba_reg.toBase64());
xmlOut->writeEndElement();
}
//-------------------------------------------------
// read - register read
//-------------------------------------------------
//READ8_MEMBER( CHD44102::read )
//{
// UINT8 data = 0;
// if (m_cs2)
// {
// data = (offset & 0x01) ? data_r(space, offset) : status_r(space, offset);
// }
// return data;
//}
//-------------------------------------------------
// write - register write
//-------------------------------------------------
//WRITE8_MEMBER( CHD44102::write )
//{
// if (m_cs2)
// {
// (offset & 0x01) ? data_w(space, offset, data) : control_w(space, offset, data);
// }
//}
//-------------------------------------------------
// control_w - control write
//-------------------------------------------------
void CHD44102::cmd_write(UINT8 data)
{
// qWarning()<<objectName()<<"cmd:"<<tr("%1").arg(data,2,16,QChar('0'));
if (info.m_status & STATUS_BUSY) return;
switch (data)
{
case CONTROL_DISPLAY_OFF:
info.m_status |= STATUS_DISPLAY_OFF;
// if (LOG) logerror("HD44102 '%s' Display Off\n", tag());
break;
case CONTROL_DISPLAY_ON:
// if (LOG) logerror("HD44102 '%s' Display On\n", tag());
info.m_status &= ~STATUS_DISPLAY_OFF;
break;
case CONTROL_COUNT_DOWN_MODE:
// if (LOG) logerror("HD44102 '%s' Count Down Mode\n", tag());
info.m_status &= ~STATUS_COUNT_UP;
break;
case CONTROL_COUNT_UP_MODE:
// if (LOG) logerror("HD44102 '%s' Count Up Mode\n", tag());
info.m_status |= STATUS_COUNT_UP;
break;
default:
{
int x = (data & CONTROL_X_ADDRESS_MASK) >> 6;
int y = data & CONTROL_Y_ADDRESS_MASK;
if ((data & CONTROL_Y_ADDRESS_MASK) == CONTROL_DISPLAY_START_PAGE)
{
// if (LOG) logerror("HD44102 '%s' Display Start Page %u\n", tag(), x);
info.m_page = x;
// qWarning()<<"PAGE="<<x;
}
else if (y > 49)
{
// logerror("HD44102 '%s' Invalid Address X %u Y %u (%02x)!\n", tag(), data, x, y);
}
else
{
// if (LOG) logerror("HD44102 '%s' Address X %u Y %u (%02x)\n", tag(), data, x, y);
info.m_x = x;
info.m_y = y;
// qWarning()<<"m_x="<<x<<" m_y="<<y;
}
}
}
updated = true;
}
//-------------------------------------------------
// cs2_w - chip select 2 write
//-------------------------------------------------
//WRITE_LINE_MEMBER( CHD44102::cs2_w )
//{
// m_cs2 = state;
//}
| gpl-2.0 |
estrategasdigitales/Dagutorio | wp-content/themes/theshop/vc_templates/vc_row.php | 3098 | <?php
/** @var $this WPBakeryShortCode_VC_Row */
$output = $el_class = $bg_image = $bg_color = $bg_image_repeat = $font_color = $padding = $margin_bottom = $css = $full_width = $el_id = $parallax_image = $parallax = '';
extract( shortcode_atts( array(
'el_class' => '',
'bg_image' => '',
'bg_color' => '',
'bg_image_repeat' => '',
'font_color' => '',
'padding' => '',
'margin_bottom' => '',
'full_width' => false,
'parallax' => false,
'parallax_image' => false,
'css' => '',
'overlay' => '',
'el_id' => '',
), $atts ) );
$parallax_image_id = '';
$parallax_image_src = '';
// wp_enqueue_style( 'js_composer_front' );
wp_enqueue_script( 'wpb_composer_front_js' );
// wp_enqueue_style('js_composer_custom_css');
$el_class = $this->getExtraClass( $el_class );
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'vc_row wpb_row ' . ( $this->settings( 'base' ) === 'vc_row_inner' ? 'vc_inner ' : '' ) . get_row_css_class() . $el_class . vc_shortcode_custom_css_class( $css, ' ' ), $this->settings['base'], $atts );
$style = $this->buildStyle( $bg_image, $bg_color, $bg_image_repeat, $font_color, $padding, $margin_bottom );
?>
<div <?php echo isset( $el_id ) && ! empty( $el_id ) ? "id='" . esc_attr( $el_id ) . "'" : ""; ?> <?php
?>class="<?php echo esc_attr( $css_class ); ?><?php if ( $full_width == 'stretch_row_content_no_spaces' ): echo ' vc_row-no-padding'; endif; ?><?php if ( ! empty( $parallax ) ): echo ' vc_general vc_parallax vc_parallax-' . $parallax; endif; ?><?php if ( ! empty( $parallax ) && strpos( $parallax, 'fade' ) ): echo ' js-vc_parallax-o-fade'; endif; ?><?php if ( ! empty( $parallax ) && strpos( $parallax, 'fixed' ) ): echo ' js-vc_parallax-o-fixed'; endif; ?>"<?php if ( ! empty( $full_width ) ) {
echo ' data-vc-full-width="true" data-vc-full-width-init="false" ';
if ( $full_width == 'stretch_row_content' || $full_width == 'stretch_row_content_no_spaces' ) {
echo ' data-vc-stretch-content="true"';
}
} ?>
<?php
// parallax bg values
$bgSpeed = 1.5;
?>
<?php
if ( $parallax ) {
wp_enqueue_script( 'vc_jquery_skrollr_js' );
echo '
data-vc-parallax="' . $bgSpeed . '"
';
}
if ( strpos( $parallax, 'fade' ) ) {
echo '
data-vc-parallax-o-fade="on"
';
}
if ( $parallax_image ) {
$parallax_image_id = preg_replace( '/[^\d]/', '', $parallax_image );
$parallax_image_src = wp_get_attachment_image_src( $parallax_image_id, 'full' );
if ( ! empty( $parallax_image_src[0] ) ) {
$parallax_image_src = $parallax_image_src[0];
}
echo '
data-vc-parallax-image="' . $parallax_image_src . '"
';
}
?>
<?php echo apply_filters('the_content', $style); ?>> <?php echo ($parallax_image) ? '<div class="vc_parallax_overlay" style="background-color: '.esc_attr($overlay).';"></div>' : ''; ?><?php
echo wpb_js_remove_wpautop( $content );
?></div><?php echo apply_filters('the_content', $this->endBlockComment( 'row' ));
if ( ! empty( $full_width ) ) {
echo '<div class="vc_row-full-width"></div>';
}
| gpl-2.0 |
hemoye/ACM | C_C++/杭电题目分类/基础题/1106.cpp | 815 | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 1004;
int main(int agrc, char *agrv[])
{
int arrAy[MAXN];
char str[MAXN];
while (~scanf("%s", str)){
int flage(0), count(0);
int len = strlen(str);
memset(arrAy, 0, len);
for (int i = 0; i < len; ){
if ('5' == str[i]) i++;
while ('5' != str[i] && i < len){
flage = 1;
arrAy[count] = arrAy[count] * 10 + (str[i] - '0');
i++;
}
if (flage){
count++;
flage = 0;
}
}
sort(arrAy, arrAy + count);
for (int i = 0; i < count; i++) printf(0 == i ? "%d" : " %d", arrAy[i]);
puts("");
}
return 0;
}
| gpl-2.0 |
tuxun/smw-funwiki | extensions/cldr/CldrNames/CldrNamesMy.php | 35589 | <?php
$languageNames = array(
'ab' => 'အက်ခါဇူအနျ',
'af' => 'အာဖရိကန်းစ်',
'agq' => 'အာဂ်ဟိန်း',
'ak' => 'အာကိန်',
'am' => 'အန်ဟာရစျချ',
'ang' => 'အင်္ဂလိပ်စာဟောင်း',
'ar' => 'အာရေဗီ',
'ar-001' => 'အရေဗီ(ပုံမှန်)',
'arn' => 'မာပုချီ',
'as' => 'အက္စမီစ်',
'asa' => 'အာစု',
'az' => 'အော်ဇောဘိုင်ဂျောနီ',
'ba' => 'ဘက်ရှ်ကီအာ',
'ban' => 'ဘာလီ',
'bas' => 'ဘာဆာ',
'be' => 'ဘီလာရု',
'bem' => 'ဘိန်ဘာ',
'bez' => 'ဘီနာ',
'bg' => 'ဘူဂေးရီးယား',
'bm' => 'ဘန်ဘာရာ',
'bn' => 'ဘင်္ဂါလီ',
'bo' => 'တိဘက်',
'br' => 'ဘရီတွန်',
'brx' => 'ဗိုဒို',
'bs' => 'ဘော့စ်နီးယား',
'ca' => 'ကာတာလန်',
'ce' => 'ချေချင်း',
'cgg' => 'ချီဂါ',
'chr' => 'ချာရိုကီ',
'ckb' => 'ဆိုရာနီ ကူဒစ်ရှ်',
'co' => 'ခိုစီကန်',
'cr' => 'ခရီး',
'cs' => 'ချက်',
'cy' => 'ဝေလ',
'da' => 'ဒိန်းမတ်',
'dak' => 'ဒါကိုတာ',
'dav' => 'တိုင်တာ',
'de' => 'ဂျာမန်',
'de-at' => 'ဩစတြီးယ ဂျာမန်',
'de-ch' => 'ဆွစ် အမြင့် ဂျာမန်',
'del' => 'ဒီလာဝဲ',
'dje' => 'ဇာမာ',
'dsb' => 'အောက်ဆိုဘီအမ်',
'dua' => 'ဒူအလာ',
'dum' => 'အလယ်ပိုင်း ဒတ်ချ်',
'dyo' => 'ဂျိုလာ-ဖွန်ရီ',
'dz' => 'ဒွန်ကာ',
'ebu' => 'အမ်ဘူ',
'ee' => 'ဝီ',
'egy' => 'ရှေးဟောင်း အီဂျစ်',
'el' => 'ဂရိ',
'en' => 'အင်္ဂလိပ်',
'en-au' => 'ဩစတြေးလျှ အင်္ဂလိပ်',
'en-ca' => 'ကနေဒါ အင်္ဂလိပ်',
'en-gb' => 'ဗြိတိသျှ အင်္ဂလိပ်',
'en-us' => 'အမေရိကန် အင်္ဂလိပ်',
'enm' => 'အလယ်ပိုင်း အင်္ဂလိပ်',
'eo' => 'အက္စပရန္တို',
'es' => 'စပိန်',
'es-419' => 'လက်တင်အမေရိက စပိန်',
'es-es' => 'စပိန်(ဥရောပ)',
'et' => 'အက်စ်တိုးနီးရန်း',
'eu' => 'ဘစ်က္ကီ',
'fa' => 'ပါရှန်',
'fi' => 'ဖင်နစ်ရှ်',
'fil' => 'ဖိလစ်ပီနို',
'fj' => 'ဖီဂျီ',
'fo' => 'ဖာရိုအိစ်',
'fr' => 'ပြင်သစ်',
'fr-ca' => 'ကနေဒါ ပြင်သစ်',
'fr-ch' => 'ဆွစ် ပြင်သစ်',
'frm' => 'အလယ်ပိုင်းပြင်သစ်',
'fro' => 'ပြင်သစ်ဟောင်း',
'frr' => 'မြောက်ပိုင်း ဖရီစီရန်',
'frs' => 'အရှေ့ပိုင်း ဖရီစီရန်',
'fy' => 'အနောက်ပိုင်း ဖရီစီရန်',
'ga' => 'အိုင်းရစ်',
'gag' => 'ဂါဂါဇ်',
'gl' => 'ဂါလာစီယံ',
'gmh' => 'အလယ်ပိုင်းအမြင့်ဂျာမန်',
'gn' => 'ဂူအာရာနီ',
'grc' => 'ရှေးဟောင်း ဂရိ',
'gsw' => 'ဆွစ် ဂျာမန်',
'gu' => 'ဂူဂျာရသီ',
'guz' => 'ဂူစီး',
'gv' => 'မန်းဇ်',
'ha' => 'ဟာဥစာ',
'haw' => 'ဟာဝေယံ',
'he' => 'ဟီးဘရူး',
'hi' => 'ဟိန္ဒီ',
'hr' => 'ခရိုအေရှန်',
'hsb' => 'အပေါ်ဆိုဘီအမ်',
'ht' => 'ဟာအီတီအန်',
'hu' => 'ဟန်ဂေရီ',
'hy' => 'အာမေနီအန်',
'id' => 'အင်ဒိုနီးရှား',
'ig' => 'အစ္ဂဘို',
'ii' => 'စီချွမ် ရီ',
'is' => 'အိုင်စ်လန္ဒီ',
'it' => 'အီတလီ',
'iu' => 'အီနုခ်တီတု',
'ja' => 'ဂျပန်',
'jgo' => 'ဂွမ်ဘာ',
'jmc' => 'မချာမီ',
'jpr' => 'ဂျူဒီယို-ပါရှန်',
'jrb' => 'ဂျူဒီယို-အာရေဗျ',
'jv' => 'ဂျာဗားနီးစ်',
'ka' => 'ဂျော်ဂျီယန်',
'kab' => 'ခဘိုင်လ်',
'kac' => 'ကချင်',
'kam' => 'ခမ်ဘာ',
'kde' => 'မာခွန်ဒီ',
'kea' => 'ခဘူဗာဒီအာနူ',
'kg' => 'ကွန်ဂို',
'kha' => 'ခါစီ',
'khq' => 'ခိုရာ ချီအီနီ',
'ki' => 'ခီခူယူ',
'kk' => 'ခါဇါခ်',
'kl' => 'ခလာအ်လီဆပ်',
'kln' => 'ခါလိမ်ဂျင်',
'km' => 'ခမာ',
'kn' => 'ကန္နာဒါ',
'ko' => 'ကိုးရီးယား',
'koi' => 'ကိုမီ-ပါမြက်',
'kok' => 'ကွန်ကနီ',
'ks' => 'ကက်ရှ်မီရီ',
'ksb' => 'ရှန်ဘာလာ',
'ksf' => 'ဘာဖီအာ',
'ku' => 'ကဒ်',
'kw' => 'ခိုနီရှ်',
'ky' => 'ခရူဂစ်',
'la' => 'လက်တင်',
'lag' => 'လန်ဂီ',
'lb' => 'လူဇင်ဘတ်က်',
'lg' => 'ဂန်ဒီ',
'lkt' => 'လာကိုတာ',
'ln' => 'လင်ဂါလာ',
'lo' => 'လာအို',
'lt' => 'လစ္သူအာနီယံ',
'lu' => 'လူဘာ-ခါတန်ဂါ',
'luo' => 'လူအို',
'luy' => 'လူရီအာ',
'lv' => 'လက္ဘီအံ',
'mas' => 'မာဆိုင်',
'mer' => 'မီရု',
'mfe' => 'မိုရှီစ်ယန်း',
'mg' => 'အာလာဂါစီ',
'mga' => 'အလယ်ပိုင်း အိုင်းရစ်',
'mgh' => 'မာခူဝါ-မီအီတို',
'mgo' => 'မီတာ',
'mi' => 'မောင်းရီ (နယူးဇီလန်ကျွန်းရှိ ပင်ရင်းတိုင်းရင်းသားလူမျိုး)',
'mk' => 'မာစီဒိုနီယံ',
'ml' => 'မလေးရာလမ်',
'mn' => 'မွန်ဂိုလီးယန်း',
'mnc' => 'မန်ချူး',
'mni' => 'မနိပူရီ',
'moh' => 'မိုဟော့ခ်',
'mr' => 'မာရသီ',
'ms' => 'မလေး',
'mt' => 'မောလ္တီစ်',
'mua' => 'မန်ဒန်း',
'mul' => 'အကြိမ်များစွာ ဘာသာစကားများ',
'my' => 'ဗမာ',
'naq' => 'နာမာ',
'nb' => 'ဘွတ်မော်လ်',
'nd' => 'တောင်ဒီဘီလီ',
'nds' => 'အနိမ့် ဂျာမန်',
'ne' => 'နီပါလီ',
'nl' => 'ဒတ်ချ်',
'nl-be' => 'ဖလီမစ်ရှ်',
'nmg' => 'ဝါဆီအို',
'nn' => 'နော်ဝေး နီးနော်စ်ခ်',
'no' => 'နော်ဝေး',
'nqo' => 'နကို',
'nus' => 'နူအာ',
'nyn' => 'ယန်ကိုလီ',
'om' => 'အိုရိုမို',
'or' => 'အိုရီရာ',
'pa' => 'ပန်ချာပီ',
'peo' => 'ပါရှန် အဟောင်း',
'pi' => 'ပါဠိ',
'pl' => 'ပိုလန်',
'ps' => 'ပါရှ်တို',
'pt' => 'ပေါ်တူဂီ',
'pt-br' => 'ဘရာဇီး ပေါ်တူဂီ',
'pt-pt' => 'ဥရောပ ပေါ်တူဂီ',
'qu' => 'ခက်ချ်ဝါ',
'quc' => 'ခီခ်အီချီ',
'rm' => 'ရောမ',
'rn' => 'ရွန်ဒီ',
'ro' => 'ရိုမေနီယား',
'rof' => 'ရွမ်ဘို',
'ru' => 'ရုရှ',
'rw' => 'ကင်ရာဝန်ဒါ',
'rwk' => 'ဝါ',
'sa' => 'သင်္သကရိုက်',
'saq' => 'ဆန်ဘူရု',
'sbp' => 'ဆန်ဂု',
'sco' => 'စကော့',
'sd' => 'စင်ဒီ',
'se' => 'တောင်ဆာမိ',
'seh' => 'စီနာ',
'ses' => 'ခိုရာဘိုရို ဆမ်နီ',
'sg' => 'ဆမ်ဂို',
'sga' => 'အိုင်းရစ် ဟောင်း',
'shi' => 'တာချယ်လ်ဟစ်',
'shn' => 'ရှမ်း',
'si' => 'ဆင်ဟာလ',
'sk' => 'စလိုဗက်',
'sl' => 'စလိုဗေးနီးယမ်း',
'sma' => 'တောင်ပိုင်း ဆာမိ',
'smj' => 'လူလီ ဆာမိ',
'smn' => 'အီနာရီ ဆာမိ',
'sms' => 'ခိုလ် ဆာမိ',
'sn' => 'ရှိနာ',
'so' => 'ဆိုမာလီ',
'sq' => 'အယ်လ်ဘေးနီးယန်း',
'sr' => 'ဆားဗီးယန်း',
'su' => 'ဆူဒန်',
'sv' => 'ဆွီဒင်',
'sw' => 'ဆြာဟီလီ',
'swc' => 'ခွန်ဂို စွာဟီလီ',
'ta' => 'တမီးလ်',
'te' => 'တီလီဂု',
'teo' => 'တီဆို',
'tg' => 'တာဂွီခ်',
'th' => 'ထိုင်း',
'ti' => 'တီဂ်ရင်ရာ',
'tk' => 'တခ္မင်',
'to' => 'တွန်ဂါ',
'tr' => 'တာကစ်',
'tt' => 'တတာ',
'twq' => 'တာဆာဝါခ်',
'tzm' => 'အလယ်အက်တ်လက်စ် တာမာဇိုက်',
'ug' => 'ဝီဂါ',
'uk' => 'ယူကရိန်း',
'und' => 'မသိ သို့မဟုတ် မရှိ သော ဘာသာစကား',
'ur' => 'အော်ဒူ',
'uz' => 'ဦးဇ်ဘက်',
'vai' => 'ဗိုင်',
'vi' => 'ဗီယက်နမ်',
'vun' => 'ဗန်ဂျို',
'wo' => 'ဝူလိုဖ်',
'xh' => 'ဇိုစာ',
'xog' => 'ဆိုဂါ',
'yo' => 'ရိုရုဘာ',
'zgh' => 'မိုရိုကန် တွမ်မဇိုတ် စံ',
'zh' => 'တရုတ်',
'zh-hans' => 'ရိုးရှင်းသော တရုတ်',
'zh-hant' => 'ရှေးရိုးစဉ်လာ တရုတ်',
'zu' => 'ဇူလူ',
'zxx' => 'ဘာသာစကား နှင့် ပတ်သက် သောအရာမရှိ',
);
$currencyNames = array(
'AED' => 'အာရပ်ဒူဟမ်း',
'AFN' => 'အာဖဂန်အာဖဂါနီ',
'ALL' => 'အယ်လ်ဘီးနီးယားလီခ်',
'AMD' => 'အာမေးနီးယားဒရမ်း',
'ANG' => 'နယ်သာလန် အန်တီလန် ဂင်းဒါး',
'AOA' => 'အင်ဂိုလာ ကန်ဇာ',
'ARP' => 'အာဂျင်တီးနား ပီဆို (၁၉၈၃–၁၉၈၅)',
'ARS' => 'အာဂျင်တီးနား ပီဆို',
'AUD' => 'ဩစတြေးလျ ဒေါ်လာ',
'AWG' => 'အရူဘန် ဂင်းဒါး',
'AZN' => 'အဇာဘိုင်ဂျန်မာနတ်',
'BAM' => 'ဘော့စနီးယား နှင့် ဟာဇီဂိုဘီးနားမတ်က်',
'BBD' => 'ဘာဘဒီယံဒေါ်လာ',
'BDT' => 'ဘင်္ဂလားဒေ့ရှ် တာကာ',
'BEF' => 'ဘယ်လ်ဂျီယမ် ဖရန့်',
'BGN' => 'ဘူဂေးရီးယားလက်ဖ်',
'BHD' => 'ဘာရိန်းဒီနား',
'BIF' => 'ဘူရွန်ဒီ ဖရန့်',
'BMD' => 'ဘာမူဒါ ဒေါ်လာ',
'BND' => 'ဘရူနိုင်း ဒေါ်လာ',
'BOB' => 'ဘိုလီဘီယံ ဘိုလီဘီအားနို',
'BOP' => 'ဘိုလီးဘီးယား ပီဆို',
'BRL' => 'ဘရာဇီး ရီးယဲ',
'BSD' => 'ဘဟားမား ဒေါ်လာ',
'BTN' => 'ဘူတန်အံဂါလ်ထရန်',
'BUK' => 'ဗမာ ကျပ်',
'BWP' => 'ဘော့စ်ဝါနာ ပုလ',
'BYB' => 'ဘီလာရုစ် ရူဘယ်အသစ် (၁၉၉၄–၁၉၉၉)',
'BYR' => 'ဘီလာရုစ် ရူဘယ်',
'BZD' => 'ဘေလီဇ် ဒေါ်လာ',
'CAD' => 'ကနေဒါ ဒေါ်လာ',
'CDF' => 'ကွန်ဂို ဖရန့်',
'CHF' => 'ဆွစ် ဖရန့်',
'CLP' => 'ချီလီ ပီဆို',
'CNY' => 'တရုတ် ယွမ်',
'COP' => 'ကိုလံဘီယာ ပီဆို',
'CRC' => 'ကော့စ်တာရီကာ ခိုလုံး',
'CUC' => 'နိုင်ငံခြားငွေလဲလှယ်နိုင်သော ကျူးဘားပီဆိုငွေ',
'CUP' => 'ကျူးဘား ပီဆို',
'CVE' => 'ခေ့ပ်ဗာဒူ အက်စ်ခူဒို',
'CYP' => 'ဆိုက်ပရက်စ် ပေါင်',
'CZK' => 'ချက်ခိုရိုနာ',
'DEM' => 'ဂျာမဏီ မတ်',
'DJF' => 'ဂျီဘူတီ ဖရန့်',
'DKK' => 'ဒိန်းမတ်ခရိုဏာ',
'DOP' => 'ဒိုမီနီကန် ပီဆို',
'DZD' => 'အဲလ်ဂျီရီယန် ဒီနာ',
'EGP' => 'အီဂျစ် ပေါင်',
'ERN' => 'အီရီတရီအာနာ့ခ်ဖာ',
'ESP' => 'စပိန် ပယ်စေးတာ',
'ETB' => 'အီသီယိုးပီးယားဘီးယာ',
'EUR' => 'ယူရို',
'FJD' => 'ဖီဂျီ ဒေါ်လာ',
'FKP' => 'ဖောက်ကလန် ကျွန်းစု ပေါင်',
'FRF' => 'ပြင်သစ် ဖရန့်',
'GBP' => 'ဗြိတိသျှ ပေါင်',
'GEL' => 'ဂျော်ဂျီယာလားရီ',
'GHS' => 'ဂါနာ ဆဲဒီ',
'GIP' => 'ဂျီဘရော်လ်တာ ပေါင်',
'GMD' => 'ဂန်ဘီယာ ဒါလာစီ',
'GNF' => 'ဂီးနီ ဖရန့်',
'GTQ' => 'ဂွာတီမာလာ ခက်ဇော်လ်',
'GYD' => 'ဂူရာနာ ဒေါ်လာ',
'HKD' => 'ဟောင်ကောင် ဒေါ်လာ',
'HNL' => 'ဟွန်ဒူးရပ်စ် လန်းပီးရာ',
'HRK' => 'ခရိုအေးရှားခူးနာ',
'HTG' => 'ဟေတီဂူးအော်ဒ်',
'HUF' => 'ဟန်ဂေရီယံဖော်ရင့်တ်',
'IDR' => 'အင်ဒိုနီးရှား ရူပီးယား',
'ILP' => 'အစ္စရေး ပေါင်',
'ILS' => 'အစ္စရေးရှဲကလ်အသစ်',
'INR' => 'အိန္ဒိယ ရူပီး',
'IQD' => 'အီရပ်ဒီနား',
'IRR' => 'အီရန်ရီအော်လ်',
'ISK' => 'အိုက်စလန် ခရိုဏာ',
'JMD' => 'ဂျမေကာ ဒေါ်လာ',
'JOD' => 'ဂျော်ဒန်ဒီနား',
'JPY' => 'ဂျပန်ယန်း',
'KES' => 'ကင်ညာသျှီလင်',
'KGS' => 'ခရူဂစ်စတန်ဆော်မ်',
'KHR' => 'ကမ္ဘောဒီးယား ရီးယဲ',
'KMF' => 'ကိုမိုရိုစ် ဖရန့်',
'KPW' => 'မြောက်ကိုးရီးယား ဝမ်',
'KRW' => 'တောင်ကိုးရီးယား ဝမ်',
'KWD' => 'ကူဝိတ်ဒီနာ',
'KYD' => 'ကေမန် ကျွန်းစု ဒေါ်လာ',
'KZT' => 'ခရူဂစ်စတန်ထိန်ဂျီ',
'LAK' => 'လာအိုခိပ်',
'LBP' => 'လက်ဘနွန် ပေါင်',
'LKR' => 'သီရိလင်္ကာ ရူပီး',
'LRD' => 'လိုင်ဘေးရီးယား ဒေါ်လာ',
'LTL' => 'လစ်သူယေးနီးယားလီတားစ်',
'LVL' => 'လတ်ဗီးယားလတ်',
'LYD' => 'လီဗျာ ဒီနာ',
'MAD' => 'မိုရိုကို ဒရမ်',
'MDL' => 'မောလ်ဒိုဗာလယ်အို',
'MGA' => 'မလာဂစ်စီ အရီရရီ ငွေကြေး',
'MKD' => 'မာစီဒိုးနီးယားဒီနာ',
'MMK' => 'မြန်မာကျပ်',
'MNT' => 'မွန်ဂိုးလီးယားထူးဂရခ်',
'MOP' => 'မကာအိုပါတားကား',
'MRO' => 'မောရီတာနီအာအူဂီးယာ',
'MUR' => 'မော်ရေရှားစ် ရူပီ',
'MVR' => 'မော်လ်ဒိုက်ရူးဖီရာ',
'MWK' => 'မာလာဝီခွါးချာ',
'MXN' => 'မက္ကဆီကို ပီဆို',
'MYR' => 'မလေးရှား ရင်းဂစ်',
'MZN' => 'မိုဇန်ဘစ်မက်တီခယ်လ်',
'NAD' => 'နမ်မီးဘီးယား ဒေါ်လာ',
'NGN' => 'နိုင်ဂျီးရီးယားနိုင်းရာ',
'NIO' => 'နီကာရာဂွာ ခိုးဒိုဘာ',
'NOK' => 'နော်ဝေ ခရိုဏာ',
'NPR' => 'နီပေါ ရူပီး',
'NZD' => 'နယူးဇီလန် ဒေါ်လာ',
'OMR' => 'အိုမန်ရီအော်လ်',
'PAB' => 'ပနားမား ဘလ်ဘိုးအာ',
'PEN' => 'ပီရူး နူအီဗိုဆိုးလ်',
'PGK' => 'ပါပူရာနယူးဂီနီခီးနာ',
'PHP' => 'ဖိလစ်ပိုင် ပီဆို',
'PKR' => 'ပါကစ္စတန် ရူပီး',
'PLN' => 'ပိုလန် ဇလော့တီ',
'PYG' => 'ပါရာဂွေးဂွါးအ်နီး',
'QAR' => 'ကာတာရီအော်လ်',
'RON' => 'ရိုမေးနီယားလယ်အို',
'RSD' => 'ဆားဘီးယားဒယ်နား',
'RUB' => 'ရုရှ ရူဘယ်',
'RUR' => 'ရုရှ ရူဘယ် (၁၉၉၁–၁၉၉၈)',
'RWF' => 'ရဝန်ဒါ ဖရန့်',
'SAR' => 'ဆော်ဒီအာရေးဗီးယားရီယော်လ်',
'SBD' => 'ဆော်လမွန်ကျွန်းစု ဒေါ်လာ',
'SCR' => 'ဆေးရှလ်ရူးပီး',
'SDG' => 'ဆူဒန် ပေါင်',
'SDP' => 'ဆူဒန် ပေါင်အဟောင်း',
'SEK' => 'ဆွီဒင် ခရိုဏာ',
'SGD' => 'စင်္ကာပူ ဒေါ်လာ',
'SHP' => 'စိန့်ဟဲလီနာ ပေါင်',
'SLL' => 'ဆီအဲရာ လီအိုနီယန် လီအိုနီ',
'SOS' => 'ဆိုမာလီသျှီလင်',
'SRD' => 'ဆူရီနိမ်း ဒေါ်လာ',
'SSP' => 'တောင်ဆူဒန်ပေါင်',
'STD' => 'စိန့်တိုမီနှင့်ပရင်စီပ့် ဒိုဘရာ',
'SUR' => 'ဆိုဗီယက် ရူဗယ်',
'SYP' => 'ဆီးရီးယား ပေါင်',
'SZL' => 'စွာဇီလန်လီလန်းဂီနီ',
'THB' => 'ထိုင်းဘတ်',
'TJS' => 'တာဂျီကစ္စတန်ဆိုမိုနီ',
'TMT' => 'တာခ်မီန့စ်တန်မာနတ်',
'TND' => 'တူနီရှားဒီနာ',
'TOP' => 'တွန်ဂါဗန်ဂါ',
'TRL' => 'ရှေးဟောင်းတူရကီ လိုင်ရာ',
'TRY' => 'တူရကီ လိုင်ရာ',
'TTD' => 'ထရိုင်နီဒတ်နှင့်တိုဘာဂိုဒေါ်လာ',
'TWD' => 'ထိုင်ဝမ် ဒေါ်လာအသစ်',
'TZS' => 'တန်ဇန်းနီးယားသျှီလင်',
'UAH' => 'ယူကရိန်း',
'UGX' => 'ယူဂန္ဓာသျှီလင်',
'USD' => 'အမေရိကန် ဒေါ်လာ',
'USN' => 'အမေရိကန် ဒေါ်လာ (နောက်နေ့)',
'USS' => 'အမေရိကန် ဒေါ်လာ (တနေ့တည်း)',
'UYU' => 'ဥရုဂွေးပီဆို',
'UZS' => 'ဥဘက်ကစ္စတန်ဆော်မ်',
'VEF' => 'ဗင်နီဇွဲလား ဘိုလီဗာ',
'VND' => 'ဗီယက်နမ် ဒေါင်',
'VUV' => 'ဗာနုအာတူဗားထူ',
'WST' => 'စမိုအထားလာ',
'XAF' => 'ကင်မရွန်းဖရန့်',
'XAG' => 'ငွေ',
'XAU' => 'ရွှေ',
'XBB' => 'ဥရောပငွေကြေးစံနစ်',
'XCD' => 'အရှေ့ကာရီဘီယံဒေါ်လာ',
'XDR' => 'အထူးထုတ်ယူခွင့်',
'XOF' => 'အိုင်ဗရီးကိုးစ်ဖရန့်',
'XPF' => 'XPFဖရန့်',
'XPT' => 'ပလက်တီနမ်',
'XTS' => 'စမ်းသပ် ငွေကြေး ကုဒ်',
'XXX' => 'မသိသို့မဟုတ်မရှိသောငွေကြေး',
'YER' => 'ယီမင်ရီအော်လ်',
'ZAR' => 'တောင်အဖရိက ရန်း',
'ZMW' => 'ဇင်ဘာဘွေခွါးချာ',
'ZWD' => 'ဇင်ဘာဘွေ ဒေါ်လာ',
);
$currencySymbols = array(
'AUD' => 'A$',
'BRL' => 'R$',
'CAD' => 'CA$',
'CNY' => 'CN¥',
'EUR' => '€',
'GBP' => '£',
'HKD' => 'HK$',
'ILS' => '₪',
'INR' => '₹',
'JPY' => 'JP¥',
'KRW' => '₩',
'MMK' => 'K',
'MXN' => 'MX$',
'NZD' => 'NZ$',
'THB' => '฿',
'TWD' => 'NT$',
'USD' => 'US$',
'VND' => '₫',
'XAF' => 'FCFA',
'XCD' => 'EC$',
'XOF' => 'CFA',
'XPF' => 'CFPF',
);
$countryNames = array(
'AC' => 'အက်စ်စင်ရှီအွန်ကျွန်း',
'AD' => 'အန်ဒိုရာ',
'AE' => 'ယူအေအီး',
'AF' => 'အာဖဂန်နစ္စတန်',
'AG' => 'အန်တီဂုအာနှင့်ဘာဘုဒါ',
'AI' => 'အန်ဂွီလာ',
'AL' => 'အဲလ်ဘာနီအာ',
'AM' => 'အာမေနီးယား',
'AO' => 'အင်ဂိုလာ',
'AQ' => 'အန္တာတိက',
'AR' => 'အာဂျင်တီးနား',
'AS' => 'အမေရိကန် စမိုအ',
'AT' => 'ဩစတြီးယား',
'AU' => 'ဩစတြေးလျ',
'AW' => 'အာရုဘာ',
'AX' => 'အာလန်ကျွန်း',
'AZ' => 'အဇာဘိုင်ဂျန်',
'BA' => 'ဘော့စနီးယား နှင့် ဟာဇီဂိုဘီးနား',
'BB' => 'ဘာဘဒိုးစ်',
'BD' => 'ဘင်္ဂလားဒေ့ရှ်',
'BE' => 'ဘယ်လ်ဂျီယမ်',
'BF' => 'ဘာကီနာ ဖာဆို',
'BG' => 'ဘူဂေးရီးယား',
'BH' => 'ဘာရိန်း',
'BI' => 'ဘူရွန်ဒီ',
'BJ' => 'ဘီနင်',
'BL' => 'စိန့်ဘာသီလီမိုင်',
'BM' => 'ဘာမူဒါ',
'BN' => 'ဘရူနိုင်း',
'BO' => 'ဘိုလီးဘီးယား',
'BQ' => 'ကာရီဘီယံနယ်သာလန်',
'BR' => 'ဘရာဇီး',
'BS' => 'ဘဟားမား',
'BT' => 'ဘူတန်',
'BV' => 'ဘူဗက်ကျွန်း',
'BW' => 'ဘော့စ်ဝါနာ',
'BY' => 'ဘီလာရုစ်',
'BZ' => 'ဘေလီဇ်',
'CA' => 'ကနေဒါ',
'CC' => 'ကိုကိုး ကျွန်းစု',
'CD' => 'ကွန်ဂို-ကင်ရှာစ',
'CF' => 'အလယ်ပိုင်း အာဖရိက ပြည်ထောင်စု',
'CG' => 'ကွန်ဂို-ဘရာဇာဗီလ်',
'CH' => 'ဆွစ်ဇလန်',
'CI' => 'အိုင်ဗရီကိုစ့်',
'CK' => 'ကွတ် ကျွန်းစု',
'CL' => 'ချီလီ',
'CM' => 'ကင်မရွန်း',
'CN' => 'တရုတ်',
'CO' => 'ကိုလံဘီယာ',
'CP' => 'ကလစ်ပါတန်ကျွန်း',
'CR' => 'ကော့စ်တာရီကာ',
'CU' => 'ကျူးဘား',
'CV' => 'ခေ့ပ်ဗာဒူ',
'CW' => 'ခူရာကာအို',
'CX' => 'ခရစ်စမတ် ကျွန်း',
'CY' => 'ဆိုက်ပရက်စ်',
'CZ' => 'ချက် ပြည်ထောင်စု',
'DE' => 'ဂျာမဏီ',
'DG' => 'ဒီအေဂိုဂရာစီအာ',
'DJ' => 'ဂျီဘူတီ',
'DK' => 'ဒိန်းမတ်',
'DM' => 'ဒိုမီနီကာ',
'DO' => 'ဒိုမီနီကန်',
'DZ' => 'အယ်လ်ဂျီးရီးယား',
'EA' => 'ဆယ်ဥတာနှင့်မယ်လီလ်လာ',
'EC' => 'အီကွေဒေါ',
'EE' => 'အက်စတိုးနီးယား',
'EG' => 'အီဂျစ်',
'EH' => 'အနောက်ပိုင်း ဆာဟာရ',
'ER' => 'အီရီတရီအာ',
'ES' => 'စပိန်',
'ET' => 'အီသီယိုးပီးယား',
'EU' => 'ဥရောပသမဂ္ဂ',
'FI' => 'ဖင်လန်',
'FJ' => 'ဖီဂျီ',
'FK' => 'ဖောက်ကလန် ကျွန်းစု',
'FM' => 'မိုင်ခရိုနီရှား',
'FO' => 'ဖာရိုး ကျွန်းစုများ',
'FR' => 'ပြင်သစ်',
'GA' => 'ဂါဘွန်',
'GB' => 'ယူကေ',
'GD' => 'ဂရီနာဒါ',
'GE' => 'ဂျော်ဂျီယာ',
'GF' => 'ပြင်သစ် ဂီယာနာ',
'GG' => 'ဂွန်းဇီ',
'GH' => 'ဂါနာ',
'GI' => 'ဂျီဘရော်လ်တာ',
'GL' => 'ဂရင်းလန်း',
'GM' => 'ဂန်ဘီရာ',
'GN' => 'ဂီးနီ',
'GP' => 'ဂူအာဒီလုပ်',
'GQ' => 'အီကွေတာ ဂီရာနာ',
'GR' => 'ဂရိ',
'GS' => 'တောင် ဂျော်ဂျီယာ နှင့် တောင် ဆင်းဒဝစ်ဂျ် ကျွန်းစုများ',
'GT' => 'ဂွာတီမာလာ',
'GU' => 'ဂူအမ်',
'GW' => 'ဂီရာနာ-ဘီစ်စာဥ',
'GY' => 'ဂူရာနာ',
'HK' => 'ဟောင်ကောင်',
'HM' => 'ဟတ်ကျွန်းနှင့်မက်ဒေါနယ်ကျွန်းစု',
'HN' => 'ဟွန်ဒူးရပ်စ်',
'HR' => 'ခရိုအေးရှား',
'HT' => 'ဟေတီ',
'HU' => 'ဟန်ဂေရီ',
'IC' => 'ကာနာရီကျွန်းစု',
'ID' => 'အင်ဒိုနီးရှား',
'IE' => 'အိုင်ယာလန်',
'IL' => 'အစ္စရေး',
'IM' => 'မန်ကျွန်း',
'IN' => 'အိန္ဒိယ',
'IO' => 'ဗြိတိသျှ အိန္ဒြိယ သမုဒ္ဒရာ ပိုင်နက်',
'IQ' => 'အီရတ်',
'IR' => 'အီရန်',
'IS' => 'အိုက်စလန်',
'IT' => 'အီတလီ',
'JE' => 'ဂျာစီ',
'JM' => 'ဂျမေကာ',
'JO' => 'ဂျော်ဒန်',
'JP' => 'ဂျပန်',
'KE' => 'ကင်ညာ',
'KG' => 'ခရူဂစ်စတန်',
'KH' => 'ကမ္ဘောဒီးယား',
'KI' => 'ခီရီဘာတီ',
'KM' => 'ကိုမိုရိုစ်',
'KN' => 'စိန့်ကစ်နှင့်နီဗီစ်',
'KP' => 'မြောက်ကိုရီးယား',
'KR' => 'တောင်ကိုရီးယား',
'KW' => 'ကူဝိတ်',
'KY' => 'ကေမန် ကျွန်းစု',
'KZ' => 'ကာဇက်စတန်',
'LA' => 'လာအို',
'LB' => 'လက်ဘနွန်',
'LC' => 'စိန့်လူစီအာ',
'LI' => 'လစ်ခ်ထင်စတိုင်',
'LK' => 'သီရိလင်္ကာ',
'LR' => 'လိုင်ဘေးရီးယား',
'LS' => 'လီဆိုသို',
'LT' => 'လစ်သူယေးနီးယား',
'LU' => 'လူဇင်ဘတ်',
'LV' => 'လတ်ဗီးယား',
'LY' => 'လီဗရာ',
'MA' => 'မော်ရိုကို',
'MC' => 'မိုနာကို',
'MD' => 'မောလ်ဒိုဗာ',
'ME' => 'မွန်တီနိဂရိုး',
'MF' => 'စိန့်မာတင်',
'MG' => 'မာဒါဂတ်စကာ',
'MH' => 'မာရှယ် ကျွန်းစု',
'MK' => 'မာစီဒိုးနီးယား',
'ML' => 'မာလီ',
'MM' => 'မြန်မာ',
'MN' => 'မွန်ဂိုးလီးယား',
'MO' => 'မကာအို',
'MP' => 'တောင်ပိုင်းမာရီအာနာကျွန်းစု',
'MQ' => 'မာတီနီကီ',
'MR' => 'မောရီတာနီအာ',
'MS' => 'မောင့်စဲရက်',
'MT' => 'မောလ်တာ',
'MU' => 'မော်ရေရှားစ်',
'MV' => 'မော်လ်ဒိုက်',
'MW' => 'မာလာဝီ',
'MX' => 'မက္ကဆီကို',
'MY' => 'မလေးရှား',
'MZ' => 'မိုဇန်ဘစ်',
'NA' => 'နမ်မီးဘီးယား',
'NC' => 'နယူး ကယ်လီဒိုနီးယား',
'NE' => 'နိုင်ဂျာ',
'NF' => 'နောဖော့ခ်ကျွန်း',
'NG' => 'နိုင်ဂျီးရီးယား',
'NI' => 'နီကာရာဂွာ',
'NL' => 'နယ်သာလန်',
'NO' => 'နော်ဝေ',
'NP' => 'နီပေါ',
'NR' => 'နာဥူရူ',
'NU' => 'နီဥူအေ',
'NZ' => 'နယူးဇီလန်',
'OM' => 'အိုမန်',
'PA' => 'ပနားမား',
'PE' => 'ပီရူး',
'PF' => 'ပြင်သစ် ပေါ်လီနေးရှား',
'PG' => 'ပါပူရာနယူးဂီနီ',
'PH' => 'ဖိလစ်ပိုင်',
'PK' => 'ပါကစ္စတန်',
'PL' => 'ပိုလန်',
'PM' => 'စိန့်ပီအဲရီနှင့်မီကွီလွန်',
'PN' => 'ပစ်တ်ကိန်းကျွန်းစု',
'PR' => 'ပေါ်တူရီကို',
'PS' => 'ပါလက်စတိုင်း',
'PT' => 'ပေါ်တူဂီ',
'PW' => 'ပလောင်',
'PY' => 'ပါရာဂွေး',
'QA' => 'ကာတာ',
'QO' => 'သမုဒ္ဒရာဒေသအပြင်ထွက်နေသောဒေသများ',
'RE' => 'ရဲအူနီရွန်',
'RO' => 'ရိုမေးနီးယား',
'RS' => 'ဆားဘီးယား',
'RU' => 'ရုရှ',
'RW' => 'ရဝန်ဒါ',
'SA' => 'ဆော်ဒီအာရေးဗီးယား',
'SB' => 'ဆော်လမွန်ကျွန်းစု',
'SC' => 'ဆေးရှလ်',
'SD' => 'ဆူဒန်',
'SE' => 'ဆွီဒင်',
'SG' => 'စင်္ကာပူ',
'SH' => 'စိန့်ဟဲလီနာ',
'SI' => 'စလိုဗေးနီးယား',
'SJ' => 'စဗိုလ်ဘတ်နှင့်ဂျန်မေရန်',
'SK' => 'စလိုဗေးကီးယား',
'SL' => 'ဆီအဲရာ လီအိုနီ',
'SM' => 'ဆော့န်မာရီနို',
'SN' => 'ဆီနီဂေါ',
'SO' => 'ဆိုမာလီယာ',
'SR' => 'ဆူရီနိမ်း',
'SS' => 'မြောက်ဆူဒန်',
'ST' => 'စိန့်တိုမီနှင့်ပရင်စီပ့်',
'SV' => 'အယ်လ်ဆာဗေးဒိုး',
'SX' => 'ဆင့်မာအာတင်',
'SY' => 'ဆီးရီးယား',
'SZ' => 'စွာဇီလန်',
'TA' => 'ထရစ်တန်ဒါကွန်ဟာ',
'TC' => 'တခ်စ်နှင့်ကာအီကိုစ်ကျွန်းစု',
'TD' => 'ချဒ်',
'TF' => 'ပြင်သစ် တောင်ပိုင်း ပိုင်နက်များ',
'TG' => 'တိုဂို',
'TH' => 'ထိုင်း',
'TJ' => 'တာဂျီကစ္စတန်',
'TK' => 'ထိုးခါလူ',
'TL' => 'အရှေ့တီမော',
'TM' => 'တာခ်မီန့စ်တန်',
'TN' => 'တူနီးရှား',
'TO' => 'တွန်ဂါ',
'TR' => 'တူရကီ',
'TT' => 'ထရိုင်နီဒတ်နှင့်တိုဘာဂို',
'TV' => 'ထူးဗလူ',
'TW' => 'ထိုင်ဝမ်',
'TZ' => 'တန်ဇန်းနီးယား',
'UA' => 'ယူကရိန်း',
'UG' => 'ယူဂန္ဓာ',
'UM' => 'ယူနိုက်တက်စတိတ် အပြင်ထွက် နေသည့် သေးငယ်သောကျွန်းများ',
'US' => 'ယူအက်စ်',
'UY' => 'ဥရုဂွေး',
'UZ' => 'ဥဘက်ကစ္စတန်',
'VA' => 'ဗာတီကန်စီတီး',
'VC' => 'စိန့်ဗင့်ဆင့်နှင့် သည်ဂရဲနာဒင်းစ်',
'VE' => 'ဗင်နီဇွဲလား',
'VG' => 'ဗြိတိသျှ ဗာဂျင်း ကျွန်းစု',
'VI' => 'ယူအက်စ် ဗာဂျင်း ကျွန်းစု',
'VN' => 'ဗီယက်နမ်',
'VU' => 'ဗာနုအာတူ',
'WF' => 'ဝေါလစ်နှင့်ဖူထူးနား',
'WS' => 'ဆာမိုအာ',
'XK' => 'ကိုဆိုဗို',
'YE' => 'ယီမင်',
'YT' => 'မေအိုတီ',
'ZA' => 'တောင်အာဖရိက',
'ZM' => 'ဇမ်ဘီယာ',
'ZW' => 'ဇင်ဘာဘွေ',
);
$timeUnits = array(
'day-future-other' => '{0}ရက်အတွင်း',
'day-other' => '{0}ရက်',
'day-past-other' => 'လွန်ခဲ့သော{0}ရက်',
'hour-future-other' => '{0}နာရီအတွင်း',
'hour-other' => '{0}နာရီ',
'hour-past-other' => 'လွန်ခဲ့သော{0}နာရီ',
'microsecond-other' => '{0}မိုက်ခရိုစက္ကန့်',
'millisecond-other' => '{0}မီလီစက္ကန့်',
'minute-future-other' => '{0}မိနစ်အတွင်း',
'minute-other' => '{0} မိနစ်',
'minute-past-other' => 'လွန်ခဲ့သော{0}မိနစ်',
'month-future-other' => '{0}လအတွင်း',
'month-other' => '{0}လ',
'month-past-other' => 'လွန်ခဲ့သော{0}လ',
'nanosecond-other' => '{0} နာနိုစက္ကန့်',
'quarter-future-other' => 'သုံးလပတ်{0}ခု အတွင်း',
'quarter-narrow-future-other' => 'သုံးလပတ်{0}ခု အတွင်း',
'quarter-narrow-past-other' => 'လွန်ခဲ့သော သုံးလပတ်{0}ခု',
'quarter-past-other' => 'လွန်ခဲ့သော သုံးလပတ်{0}ခု',
'quarter-short-future-other' => 'သုံးလပတ်{0}ခု အတွင်း',
'quarter-short-past-other' => 'လွန်ခဲ့သော သုံးလပတ်{0}ခု',
'second-future-other' => '{0}စက္ကန့်အတွင်း',
'second-other' => '{0} စက္ကန့်',
'second-past-other' => 'လွန်ခဲ့သော{0}စက္ကန့်',
'week-future-other' => '{0}ပတ်အတွင်း',
'week-other' => '{0}ပတ်',
'week-past-other' => 'လွန်ခဲ့သော{0}ပတ်',
'year-future-other' => '{0}နှစ်အတွင်း',
'year-other' => '{0}နှစ်',
'year-past-other' => 'လွန်ခဲ့သော{0}နှစ်',
);
| gpl-2.0 |
mojofunk/alta | src/mojo/core/audio/utils.hpp | 161 | #ifndef MOJO_CORE_UTILS_TYPES_H
#define MOJO_CORE_UTILS_TYPES_H
MOJO_API std::vector<samplerate_t>
get_common_samplerates();
#endif // MOJO_CORE_UTILS_TYPES_H
| gpl-2.0 |
NatLibFi/NDL-VuFind2 | module/Finna/src/Finna/View/Helper/Root/RecordLink.php | 5778 | <?php
/**
* RecordLink view helper (DEPRECATED -- use RecordLinker instead)
*
* PHP version 7
*
* Copyright (C) The National Library of Finland 2017-2020.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* 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 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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package View_Helpers
* @author Anna Niku <anna.niku@gofore.com>
* @author Ere Maijala <ere.maijala@helsinki.fi>
* @author Samuli Sillanpää <samuli.sillanpaa@helsinki.fi>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org/wiki/vufind2:developer_manual Wiki
*/
namespace Finna\View\Helper\Root;
/**
* RecordLink view helper (DEPRECATED -- use RecordLinker instead)
*
* @category VuFind
* @package View_Helpers
* @author Anna Niku <anna.niku@gofore.com>
* @author Ere Maijala <ere.maijala@helsinki.fi>
* @author Samuli Sillanpää <samuli.sillanpaa@helsinki.fi>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org/wiki/vufind2:developer_manual Wiki
*/
class RecordLink extends \VuFind\View\Helper\Root\RecordLink
{
/**
* Data source configuration
*
* @var array
*/
protected $datasourceConfig;
/**
* Constructor
*
* @param \VuFind\Record\Router $router Record router
* @param array $config Configuration for search box
*/
public function __construct(\VuFind\Record\Router $router, $config)
{
// parent no longer has a constructor that uses $router
$this->datasourceConfig = $config;
}
/**
* Returns 'data-embed-iframe' if url is vimeo or youtube url
*
* @param string $url record url
*
* @return string
*/
public function getEmbeddedVideo($url)
{
if ($this->getEmbeddedVideoUrl($url)) {
return 'data-embed-iframe';
}
return '';
}
/**
* Returns url for video embedding if url is vimeo or youtube url
*
* @param string $url record url
*
* @return string
*/
public function getEmbeddedVideoUrl($url)
{
$parts = parse_url($url);
if (!$parts || !isset($parts['host'])) {
return '';
}
$embedUrl = '';
switch ($parts['host']) {
case 'vimeo.com':
$embedUrl = "https://player.vimeo.com/video" . $parts['path'];
break;
case 'youtu.be':
$embedUrl = "https://www.youtube.com/embed" . $parts['path'];
break;
case 'youtube.com':
parse_str($parts['query'], $query);
$embedUrl = "https://www.youtube.com/embed/" . $query['v'];
break;
}
return $embedUrl;
}
/**
* Given an array representing a related record (which may be a bib ID or OCLC
* number), this helper renders a URL linking to that record.
*
* @param array $link Link information from record model
* @param bool $escape Should we escape the rendered URL?
* @param string $source Source ID for backend being used to retrieve records
*
* @return string URL derived from link information
*/
public function related($link, $escape = true, $source = DEFAULT_SEARCH_BACKEND)
{
if ('identifier' === $link['type']) {
$urlHelper = $this->getView()->plugin('url');
$baseUrl = $urlHelper($this->getSearchActionForSource($source));
$result = $baseUrl
. '?lookfor=' . urlencode($link['value'])
. '&type=Identifier&jumpto=1';
} else {
$result = parent::related($link, false, $source);
}
$driver = $this->getView()->plugin('record')->getDriver();
$result .= $this->getView()->plugin('searchTabs')
->getCurrentHiddenFilterParams(
$driver->getSourceIdentifier(),
false,
'&'
);
if ($filters = ($link['filter'] ?? [])) {
$result .= '&' . implode(
'&',
array_map(
function ($key, $val) {
return 'filter[]=' . urlencode("$key:$val");
},
array_keys($filters),
$filters
)
);
}
if ($escape) {
$escapeHelper = $this->getView()->plugin('escapeHtml');
$result = $escapeHelper($result);
}
return $result;
}
/**
* Return URL of the record in staff interface if available
*
* @param \VuFind\RecordDriver\AbstractBase $driver Record driver
*
* @return string
*/
public function getStaffUiUrl($driver)
{
$parts = explode('.', $driver->getUniqueId(), 2);
if (!isset($parts[1])) {
return '';
}
$source = $parts[0];
$id = $parts[1];
if (!empty($this->datasourceConfig[$source]['staffUiUrl'])) {
$url = $this->datasourceConfig[$source]['staffUiUrl'];
return str_replace('%%id%%', $id, $url);
}
return '';
}
}
| gpl-2.0 |
Caduceus/DecapitatedSoul | data/spells/scripts/support/sharpshooter.lua | 972 | local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, 0)
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 10000)
condition:setParameter(CONDITION_PARAM_SKILL_DISTANCE, 75)
condition:setParameter(CONDITION_PARAM_SKILL_SHIELD, -75)
condition:setParameter(CONDITION_PARAM_BUFF_SPELL, 1)
combat:setCondition(condition)
local exhaustHealGroup = Condition(CONDITION_SPELLGROUPCOOLDOWN)
exhaustHealGroup:setParameter(CONDITION_PARAM_SUBID, 2)
exhaustHealGroup:setParameter(CONDITION_PARAM_TICKS, 10000)
combat:setCondition(exhaustHealGroup)
local exhaustSupportGroup = Condition(CONDITION_SPELLGROUPCOOLDOWN)
exhaustSupportGroup:setParameter(CONDITION_PARAM_SUBID, 3)
exhaustSupportGroup:setParameter(CONDITION_PARAM_TICKS, 10000)
combat:setCondition(exhaustSupportGroup)
function onCastSpell(creature, var)
return combat:execute(creature, var)
end
| gpl-2.0 |
colloquium/spacewalk | java/code/src/com/redhat/rhn/frontend/action/user/test/ChangeEmailSetupActionTest.java | 2134 | /**
* Copyright (c) 2009--2010 Red Hat, Inc.
*
* This software is licensed to you under the GNU General Public License,
* version 2 (GPLv2). There is NO WARRANTY for this software, express or
* implied, including the implied warranties of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
* along with this software; if not, see
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
*
* Red Hat trademarks are not licensed under GPLv2. No permission is
* granted to use or replicate Red Hat trademarks that are incorporated
* in this software or its documentation.
*/
package com.redhat.rhn.frontend.action.user.test;
import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.action.user.ChangeEmailSetupAction;
import com.redhat.rhn.manager.user.UserManager;
import com.redhat.rhn.testing.ActionHelper;
import com.redhat.rhn.testing.RhnBaseTestCase;
import org.apache.struts.action.ActionForward;
/**
* ChangeEmailSetupActionTest
* @version $Rev$
*/
public class ChangeEmailSetupActionTest extends RhnBaseTestCase {
public void testChangeEmailSetupAction() throws Exception {
ChangeEmailSetupAction action = new ChangeEmailSetupAction();
ActionHelper sah = new ActionHelper();
sah.setUpAction(action);
LocalizationService ls = LocalizationService.getInstance();
User user = sah.getUser();
//Test verified
sah.getRequest().setupAddParameter("uid", "");
user.setEmail("myemail@somewhere.com");
UserManager.storeUser(user);
ActionForward result = sah.executeAction();
assertEquals("default", result.getName());
//If we are a satellite, then we should expect yourchangeemail.instructions
//and message.Update
assertEquals(ls.getMessage("yourchangeemail.instructions"),
sah.getRequest().getAttribute("pageinstructions"));
assertEquals(ls.getMessage("message.Update"),
sah.getRequest().getAttribute("button_label"));
}
}
| gpl-2.0 |
lopezchin/sealite | administrator/components/com_content/controllers/articles.php | 2599 | <?php
/**
* @package Joomla.Administrator
* @subpackage com_content
* @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access.
defined('_JEXEC') or die;
jimport('joomla.application.component.controlleradmin');
/**
* Articles list controller class.
*
* @package Joomla.Administrator
* @subpackage com_content
* @since 1.6
*/
class ContentControllerArticles extends JControllerAdmin
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* @return ContentControllerArticles
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
// Articles default form can come from the articles or featured view.
// Adjust the redirect view on the value of 'view' in the request.
if (JRequest::getCmd('view') == 'featured') {
$this->view_list = 'featured';
}
parent::__construct($config);
$this->registerTask('unfeatured', 'featured');
}
/**
* Method to toggle the featured setting of a list of articles.
*
* @return void
* @since 1.6
*/
function featured()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Initialise variables.
$user = JFactory::getUser();
$ids = JRequest::getVar('cid', array(), '', 'array');
$values = array('featured' => 1, 'unfeatured' => 0);
$task = $this->getTask();
$value = JArrayHelper::getValue($values, $task, 0, 'int');
// Access checks.
foreach ($ids as $i => $id)
{
if (!$user->authorise('core.edit.state', 'com_content.article.'.(int) $id)) {
// Prune items that you can't change.
unset($ids[$i]);
JError::raiseNotice(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
}
}
if (empty($ids)) {
JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
}
else {
// Get the model.
$model = $this->getModel();
// Publish the items.
if (!$model->featured($ids, $value)) {
JError::raiseWarning(500, $model->getError());
}
}
$this->setRedirect('index.php?option=com_content&view=articles');
}
/**
* Proxy for getModel.
*
* @param string $name The name of the model.
* @param string $prefix The prefix for the PHP class name.
*
* @return JModel
* @since 1.6
*/
public function getModel($name = 'Article', $prefix = 'ContentModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
}
| gpl-2.0 |
tn5250j/tn5250j | src/org/tn5250j/sessionsettings/SignoffAttributesPanel.java | 5696 | /*
* Title: SignoffAttributesPanel
* Copyright: Copyright (c) 2001
* Company:
*
* @author Kenneth J. Pouncey
* @version 0.5
* <p>
* Description:
* <p>
* 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, or (at your option)
* any later version.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
package org.tn5250j.sessionsettings;
import org.tn5250j.SessionConfig;
import org.tn5250j.tools.AlignLayout;
import org.tn5250j.tools.LangTool;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
class SignoffAttributesPanel extends AttributesPanel {
private static final long serialVersionUID = 1L;
private JCheckBox signoffCheck;
private JTextField fromRow;
private JTextField fromCol;
private JTextField toRow;
private JTextField toCol;
SignoffAttributesPanel(SessionConfig config) {
super(config, "Signoff");
}
/**
* Component initialization
*/
public void initPanel() throws Exception {
setLayout(new BorderLayout());
contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
add(contentPane, BorderLayout.NORTH);
// define signoff confirmation panel
JPanel soConfirm = new JPanel();
soConfirm.setBorder(BorderFactory.createTitledBorder(
LangTool.getString("sa.titleSignoff")));
signoffCheck = new JCheckBox(LangTool.getString("sa.confirmSignoff"));
// check if signoff confirmation is to be checked
signoffCheck.setSelected(getStringProperty("confirmSignoff").equals("Yes"));
signoffCheck.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(ItemEvent e) {
doItemStateChanged(e);
}
});
soConfirm.add(signoffCheck);
// define signoff confirmation screen region
JPanel soRegion = new JPanel();
soRegion.setBorder(BorderFactory.createTitledBorder(
LangTool.getString("sa.titleSignoffRegion")));
AlignLayout rowcol = new AlignLayout(4, 5, 5);
soRegion.setLayout(rowcol);
soRegion.add(new JLabel(LangTool.getString("sa.fromRow")));
fromRow = new JTextField("1", 5);
soRegion.add(fromRow);
soRegion.add(new JLabel(LangTool.getString("sa.fromColumn")));
fromCol = new JTextField("1", 5);
soRegion.add(fromCol);
soRegion.add(new JLabel(LangTool.getString("sa.toRow")));
toRow = new JTextField("24", 5);
soRegion.add(toRow);
soRegion.add(new JLabel(LangTool.getString("sa.toColumn")));
toCol = new JTextField("80", 5);
soRegion.add(toCol);
loadRegion();
toggleRegion(signoffCheck.isSelected());
contentPane.add(soConfirm);
contentPane.add(soRegion);
}
private void loadRegion() {
Rectangle region = getRectangleProperty("signOnRegion");
if (region.x == 0)
fromRow.setText("1");
else
fromRow.setText(Integer.toString(region.x));
if (region.y == 0)
fromCol.setText("1");
else
fromCol.setText(Integer.toString(region.y));
if (region.width == 0)
toRow.setText("24");
else
toRow.setText(Integer.toString(region.width));
if (region.height == 0)
toCol.setText("80");
else
toCol.setText(Integer.toString(region.height));
}
/**
* React on the state change for signoff confirmation
*
* @param e Item event to react to
*/
private void doItemStateChanged(ItemEvent e) {
toggleRegion(false);
if (e.getStateChange() == ItemEvent.SELECTED) {
if (signoffCheck.isSelected()) {
toggleRegion(true);
}
}
}
private void toggleRegion(boolean state) {
fromRow.setEnabled(state);
fromCol.setEnabled(state);
toRow.setEnabled(state);
toCol.setEnabled(state);
}
public void applyAttributes() {
if (signoffCheck.isSelected()) {
changes.firePropertyChange(this, "confirmSignoff",
getStringProperty("confirmSignoff"),
"Yes");
setProperty("confirmSignoff", "Yes");
} else {
changes.firePropertyChange(this, "confirmSignoff",
getStringProperty("confirmSignoff"),
"No");
setProperty("confirmSignoff", "No");
}
Rectangle region = new Rectangle(Integer.parseInt(fromRow.getText()),
Integer.parseInt(fromCol.getText()),
Integer.parseInt(toRow.getText()),
Integer.parseInt(toCol.getText()));
if (region.x < 0)
region.x = 1;
if (region.y < 0)
region.y = 1;
if (region.width > 24)
region.width = 24;
if (region.height > 80)
region.height = 80;
setRectangleProperty("signOnRegion", region);
}
}
| gpl-2.0 |
chrisolido/BigGayAl | wp-content/plugins/wptouch/html/push-area.php | 4830 | <?php global $wptouch_settings; ?>
<div class="metabox-holder">
<div class="postbox" id="push-area">
<h3><span class="push-options"> </span><?php _e( "Push Notification Options", "wptouch" ); ?></h3>
<div class="left-content">
<p><?php echo sprintf(__( "Here you can configure WPtouch to push selected notifications through your %sProwl%s account to your iPhone, iPod touch and Growl-enabled Mac or PC.", "wptouch" ), '<a href="http://prowl.weks.net/" target="_blank">','</a>'); ?></p>
<p><?php echo sprintf(__( "%sMake sure you generate a Prowl API key to use here%s otherwise no notifications will be pushed to you.", "wptouch" ), '<strong>','</strong>'); ?></p>
</div><!-- left content -->
<div class="right-content">
<ul class="wptouch-make-li-italic">
<?php if ( function_exists( 'curl_init' ) ) { ?>
<li>
<input name="prowl-api" type="text" value="<?php echo $wptouch_settings['prowl-api']; ?>" /><?php _e( "Prowl API Key", "wptouch" ); ?> (<?php echo sprintf(__( "%sCreate a key now%s", "wptouch" ), '<a href="https://prowl.weks.net/settings.php" target="_blank">','</a>'); ?> - <a href="#prowl-info" class="fancylink">?</a>)
<div id="prowl-info" style="display:none">
<h2><?php _e( "More Info", "wptouch" ); ?></h2>
<p><?php _e( "In order to enable Prowl notifications you must create a Prowl account and download + configure the Prowl application for iPhone.", "wptouch" ); ?></p>
<p><?php _e( "Next, visit the Prowl website and generate your API key, which WPtouch will use to send your notifications.", "wptouch" ); ?></p>
<p><?php echo sprintf(__( "%sVisit the Prowl Website%s", "wptouch" ), '<a href="http://prowl.weks.net/settings.php" target="_blank">','</a>'); ?> | <?php echo sprintf(__( "%sVisit iTunes to Download Prowl%s", "wptouch" ), '<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=320876271&mt=8" target="_blank">','</a>'); ?></p>
</div>
<?php if ( isset( $wptouch_settings['prowl-api'] ) && strlen( $wptouch_settings['prowl-api'] ) ) { ?>
<?php if ( bnc_wptouch_is_prowl_key_valid() ) { ?>
<p class="valid"><?php _e( "Your Prowl API key has been verified.", "wptouch" ); ?></p>
<?php } else { ?>
<p class="invalid">
<?php _e( "Sorry, your Prowl API key is not verified.", "wptouch" ); ?><br />
<?php _e( "Please check your key and make sure there are no spaces or extra characters.", "wptouch" ); ?>
</p>
<?php } ?>
<?php } ?>
</li>
</ul>
<ul>
<li>
<input class="checkbox" type="checkbox" name="enable-prowl-comments-button" <?php if ( isset( $wptouch_settings['enable-prowl-comments-button']) && $wptouch_settings['enable-prowl-comments-button'] == 1) echo('checked'); ?> />
<label class="label" for="enable-prowl-comments-button"><?php _e( "Notify me of new comments & pingbacks/tracksbacks", "wptouch" ); ?></label>
</li>
<li>
<input class="checkbox" <?php if (!get_option('comment_registration')) : ?>disabled="true"<?php endif; ?> type="checkbox" name="enable-prowl-users-button" <?php if ( isset( $wptouch_settings['enable-prowl-users-button']) && $wptouch_settings['enable-prowl-users-button'] == 1) echo('checked'); ?> />
<label class="label" for="enable-prowl-users-button"><?php _e( "Notify me of new account registrations", "wptouch" ); ?></label>
</li>
<li>
<input class="checkbox" type="checkbox" name="enable-prowl-message-button" <?php if ( isset( $wptouch_settings['enable-prowl-message-button']) && $wptouch_settings['enable-prowl-message-button'] == 1) echo('checked'); ?> />
<label class="label" for="enable-prowl-message-button"><?php _e( "Allow users to send me direct messages", "wptouch" ); ?> <a href="#dm-info" class="fancylink">?</a></label>
<div id="dm-info" style="display:none">
<h2><?php _e( "More Info", "wptouch" ); ?></h2>
<p><?php _e( "This enables a new link to a drop-down in the submenu bar for WPtouch ('Message Me').", "wptouch" ); ?></p>
<p><?php _e( "When opened, a form is shown for users to fill in. The name, e-mail address, and message area is shown. Thier IP will also be sent to you, in case you want to ban it in the WordPress admin.", "wptouch" ); ?></p>
</div>
</li>
<?php } else { ?>
<li><strong class="no-pages"><?php echo sprintf(__( "%sCURL is required%s on your webserver to use Push capabilities in WPtouch.", "wptouch" ), '<a href="http://en.wikipedia.org/wiki/CURL" target="_blank">','</a>'); ?></strong></li>
<?php } ?>
</ul>
</div><!-- right content -->
<div class="bnc-clearer"></div>
</div><!-- postbox -->
</div><!-- metabox --> | gpl-2.0 |
wojoeraf/SP2015_TD | public/processing/forms.js | 4421 | /**
* @author Rafael Wörner
*/
/**
* The FormProcessing class provides methods to process the forms which appear in the menu.
* @class
*/
FormProcessing = function () {
this.helper = new Helper.Html();
this.helperMenu = new Helper.Menu();
// username regex
var regexUsername = /^\w{2,20}$/;
// extend validator
validator.extend('isUsername', function(str) {
var bool = regexUsername.test(str);
return str.length > 20 ? false : bool;
});
};
FormProcessing.prototype = {
/**
* Hides the login form.
*/
hideLoginForm: function () {
this.helper.hideElement("#loginArea");
},
/**
* Shows the login form.
*/
showLoginForm: function () {
this.helper.showElement("#loginArea");
},
/**
* Hides the register form.
*/
hideRegisterForm: function () {
this.helper.hideElement("#registerArea");
},
/**
* Shows the register form.
*/
showRegisterForm: function () {
this.helper.showElement("#registerArea");
},
/**
* Hides the forgot password form.
*/
hideForgotPasswordForm: function () {
this.helper.hideElement("#forgotPasswordArea");
},
/**
* Shows the forgot password form.
*/
showForgotPasswordForm: function () {
this.helper.showElement("#forgotPasswordArea");
},
/**
* Shows the change password form.
*/
showChangePWForm: function () {
this.helper.showElement("#changePWArea");
},
/**
* Hides the change password form.
*/
hideChangePWForm: function () {
this.helper.hideElement("#changePWArea");
},
/**
* Shows the ranking table
*/
showRankingTable: function () {
this.helper.showElement("#rankingTable");
},
/**
* Hides the ranking table
*/
hideRankingTable: function () {
this.helper.hideElement("#rankingTable");
},
/**
* Shows the googleCaptcha for getting Diamonds
*/
showCaptcha: function () {
this.helper.showElement("#captcha_container");
},
/**
* Shows the googleCaptcha for getting Diamonds
*/
hideCaptcha: function () {
this.helper.hideElement("#captcha_container");
},
showSettings: function () {
this.helper.showElement("#settingsMenu");
},
hideSettings: function () {
this.helper.hideElement("#settingsMenu");
},
showPopup: function () {
this.helper.showElement("#popupSlider");
},
hidePopup: function () {
this.helper.hideElement("#popupSlider");
},
logout: function(outerThis) {
var ret = false;
var helper = this.helperMenu;
helper.debugLog('Logging out...');
$(function () {
$.ajax({
method: 'post',
url: '/logout',
dataType: 'json',
data: {}
}).done(function (data, status, err) {
helper.debugLog('Status: ' + status, outerThis);
helper.debugLog('Returned data: ' + JSON.stringify(data), outerThis);
}).fail(function (status, err) {
helper.debugLog('Status: ' + status, outerThis);
helper.debugLog('Error: ' + err, outerThis);
helper.debugLog('Returned data: ' + JSON.stringify(data.responseJSON), outerThis);
});
return false;
});
return ret;
},
validate: function (username, email, password, confirm) {
var ret = {success: true, message: ''};
if (username === '' || email === '' || password === '' || confirm === '') {
ret.success = false;
ret.message = 'Missing some stuff... Review your input.';
return ret;
}
if (username !== undefined && !validator.isUsername(username)) {
ret.success = false;
ret.message = 'Illegal username (2-20 characters)';
return ret;
}
if (email !== undefined && !validator.isEmail(email)) {
ret.success = false;
ret.message = 'Illegal email address.';
return ret;
}
if (password !== confirm) {
ret.success = false;
ret.message = 'Your password confirmation fails. Check again.';
return ret;
}
return ret
}
}; | gpl-2.0 |
ipanova/pulp_puppet | pulp_puppet_handlers/setup.py | 251 | from setuptools import setup, find_packages
setup(
name='pulp_puppet_handlers',
version='2.5.0',
license='GPLv2+',
packages=find_packages(exclude=['test', 'test.*']),
author='Pulp Team',
author_email='pulp-list@redhat.com',
)
| gpl-2.0 |
toniher/CouchDB_Query | CouchDB_Query.i18n.php | 1380 | <?php
/**
* This is a backwards-compatibility shim, generated by:
* https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
*
* Beginning with MediaWiki 1.23, translation strings are stored in json files,
* and the EXTENSION.i18n.php file only exists to provide compatibility with
* older releases of MediaWiki. For more information about this migration, see:
* https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
*
* This shim maintains compatibility back to MediaWiki 1.17.
*/
$messages = array();
if ( !function_exists( 'wfJsonI18nShim1b3c8e489e568def' ) ) {
function wfJsonI18nShim1b3c8e489e568def( $cache, $code, &$cachedData ) {
$codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] );
foreach ( $codeSequence as $csCode ) {
$fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
if ( is_readable( $fileName ) ) {
$data = FormatJson::decode( file_get_contents( $fileName ), true );
foreach ( array_keys( $data ) as $key ) {
if ( $key === '' || $key[0] === '@' ) {
unset( $data[$key] );
}
}
$cachedData['messages'] = array_merge( $data, $cachedData['messages'] );
}
$cachedData['deps'][] = new FileDependency( $fileName );
}
return true;
}
$GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 'wfJsonI18nShim1b3c8e489e568def';
}
| gpl-2.0 |
JozefAB/neoacu | libraries/gantry5/classes/Gantry/Joomla/Manifest.php | 1906 | <?php
/**
* @package Gantry5
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2015 RocketTheme, LLC
* @license GNU/GPLv2 and later
*
* http://www.gnu.org/licenses/gpl-2.0.html
*/
namespace Gantry\Joomla;
/**
* Joomla manifest file modifier.
*/
class Manifest
{
protected $theme;
protected $path;
protected $xml;
/**
* @param string $theme
* @throws \RuntimeException
*/
public function __construct($theme)
{
$this->theme = $theme;
$this->path = JPATH_SITE . "/templates/{$theme}/templateDetails.xml";
if (!is_file($this->path)) {
throw new \RuntimeException(sprintf('Template %s does not exist.', $theme));
}
$this->xml = simplexml_load_file($this->path);
}
/**
* @return \SimpleXMLElement
*/
public function getXml()
{
return $this->xml;
}
public function setPositions(array $positions)
{
sort($positions);
// Get the positions.
$target = current($this->xml->xpath('//positions'));
$xml = "<positions>\n <position>" . implode("</position>\n <position>", $positions) . "</position>\n </positions>";
$insert = new \SimpleXMLElement($xml);
// Replace all positions.
$targetDom = dom_import_simplexml($target);
$insertDom = $targetDom->ownerDocument->importNode(dom_import_simplexml($insert), true);
$targetDom->parentNode->replaceChild($insertDom, $targetDom);
}
public function save()
{
// Do not save manifest if template has been symbolically linked.
if (is_link(dirname($this->path))) {
return;
}
if (!$this->xml->asXML($this->path)) {
throw new \RuntimeException(sprintf('Saving manifest for %s template failed', $this->theme));
}
}
}
| gpl-2.0 |
NenadObradovic/extensive-vc | shortcodes/text-marquee/assets/js/text-marquee.js | 4521 | (function ($) {
'use strict';
$(document).ready(function () {
evcInitTextMarquee();
});
/**
* Init Text Marquee effect
*/
function evcInitTextMarquee() {
var textMarquee = $('.evc-text-marquee');
if (textMarquee.length) {
textMarquee.each(function () {
var thisTextMarquee = $(this),
marqueeElements = thisTextMarquee.find('.evc-tm-element'),
originalText = marqueeElements.filter('.evc-tm-original'),
auxText = marqueeElements.filter('.evc-tm-aux');
var calcWidth = function (element) {
var width;
if (thisTextMarquee.outerWidth() > element.outerWidth()) {
width = thisTextMarquee.outerWidth();
} else {
width = element.outerWidth();
}
return width;
};
var marqueeEffect = function () {
evcRequestAnimationFrame();
var delta = 1, //pixel movement
speedCoeff = 0.8, // below 1 to slow down, above 1 to speed up
marqueeWidth = calcWidth(originalText);
marqueeElements.css({'width': marqueeWidth}); // set the same width to both elements
auxText.css('left', marqueeWidth); //set to the right of the initial marquee element
//movement loop
marqueeElements.each(function (i) {
var marqueeElement = $(this),
currentPos = 0;
var evcInfiniteScrollEffect = function () {
currentPos -= delta;
//move marquee element
if (marqueeElement.position().left <= -marqueeWidth) {
marqueeElement.css('left', parseInt(marqueeWidth - delta));
currentPos = 0;
}
marqueeElement.css('transform', 'translate3d(' + speedCoeff * currentPos + 'px,0,0)');
requestNextAnimationFrame(evcInfiniteScrollEffect);
$(window).resize(function () {
marqueeWidth = calcWidth(originalText);
currentPos = 0;
originalText.css('left', 0);
auxText.css('left', marqueeWidth); //set to the right of the inital marquee element
});
};
evcInfiniteScrollEffect();
});
};
marqueeEffect();
});
}
}
/*
* Request Animation Frame shim
*/
function evcRequestAnimationFrame() {
window.requestNextAnimationFrame =
(function () {
var originalWebkitRequestAnimationFrame,
wrapper,
callback,
geckoVersion = 0,
userAgent = navigator.userAgent,
index = 0,
self = this;
// Workaround for Chrome 10 bug where Chrome
// does not pass the time to the animation function
if (window.webkitRequestAnimationFrame) {
// Define the wrapper
wrapper = function (time) {
if (time === undefined) {
time = +new Date();
}
self.callback(time);
};
// Make the switch
originalWebkitRequestAnimationFrame = window.webkitRequestAnimationFrame;
window.webkitRequestAnimationFrame = function (callback, element) {
self.callback = callback;
// Browser calls the wrapper and wrapper calls the callback
originalWebkitRequestAnimationFrame(wrapper, element);
};
}
// Workaround for Gecko 2.0, which has a bug in
// mozRequestAnimationFrame() that restricts animations
// to 30-40 fps.
if (window.mozRequestAnimationFrame) {
// Check the Gecko version. Gecko is used by browsers
// other than Firefox. Gecko 2.0 corresponds to
// Firefox 4.0.
index = userAgent.indexOf('rv:');
if (userAgent.indexOf('Gecko') !== -1) {
geckoVersion = userAgent.substr(index + 3, 3);
if (geckoVersion === '2.0') {
// Forces the return statement to fall through
// to the setTimeout() function.
window.mozRequestAnimationFrame = undefined;
}
}
}
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function (callback, element) {
var start,
finish;
window.setTimeout( function () {
start = +new Date();
callback(start);
finish = +new Date();
self.timeout = 1000 / 60 - (finish - start);
}, self.timeout);
};
}
)();
}
})(jQuery); | gpl-2.0 |
yogendra9891/farmapplication | administrator/components/com_farmapp/controllers/labors.php | 4140 | <?php
/**
* @version 1.0.0
* @package com_farmapp
* @copyright Copyright (C) 2012. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @author Created by com_combuilder - http://www.notwebdesign.com
*/
// No direct access.
defined('_JEXEC') or die;
/**
* Labors list controller class.
*/
class LaborsControllerFarmapp extends FarmappController
{
/**
* Constructor.
*
* @param array $config An optional associative array of configuration settings.
* @see JController
* @since 1.6
*/
public function __construct($config = array())
{
parent::__construct($config);
}
function display()
{
// echo "ff"; exit;
$model=$this->getModel('labors');
$items=$model->getItems(); // var_dump($items); die;
$pagination = $model->getPagination();
$state = $model->getState();
$view=$this->getView('labors','html');
$view->assign('items',$items);
$view->assign('pagination',$pagination);
$view->assign('state',$state);
$view->display();
}
function edit()
{
$id = JRequest::getVar('cid','0');
$model=$this->getModel('labor');
// get the Data
$item = $model->getItem($id[0]);
$form = $model->getForm($id[0]);
$view=$this->getView('labor','html');
$view->assign('form',$form);
$view->assign('item',$item);
$view->setLayout('edit');
$view->display();
}
/*
* Method for save data from labor-form......
*
*/
function save()
{
$task = $this->getTask();
$data=JRequest::get('post');
$model=$this->getModel('labor');
$id=$model->save($data);
if($id!=='')
{
switch ( $task )
{
case 'save2new':
$link = 'index.php?option=com_farmapp&view=labors&task=add';
$this->setRedirect($link, $msg);
break;
case 'save':
$msg = JText::_( 'Labor category save successfully' );
$link = 'index.php?option=com_farmapp&view=labors';
$this->setRedirect($link, $msg);
break;
case 'apply':
$msg = JText::_( 'Labor category save successfully' );
$link = 'index.php?option=com_farmapp&view=labors&task=edit&cid[]='.$id;
$this->setRedirect($link, $msg);
break;
}
}
}
/*
* Method for deleting single/multiple Labor category......
*
*/
function delete()
{
$model = $this->getModel('labors');
if(!$model->delete()) {
$msg = JText::_( 'Error: One or More labors category Could not be Deleted' );
}else{
$msg = JText::_( 'labor(s) Deleted' );
}
$link = 'index.php?option=com_farmapp&view=labors';
$this->setRedirect($link, $msg);
}
/*
* Method for publish single/multiple labors......
*
*/
function multiplepublish()
{
$model = $this->getModel('labors');
if(!$model->multiplepublish()) {
$msg = JText::_( 'Error: One or More labors category Could not be published' );
} else {
$msg = JText::_( 'labor(s) Published.' );
}
$link = 'index.php?option=com_farmapp&view=labors';
$this->setRedirect($link, $msg);
}
/*
* Method for unpublish single/multiple labors......
*
*/
function multipleunpublish()
{
$model = $this->getModel('labors');
if(!$model->multipleunpublish()){
$msg = JText::_( 'Error: One or More labors Could not be unpublished' );
}else{
$msg = JText::_( 'labor(s) UnPublished.' );
}
$link = 'index.php?option=com_farmapp&view=labors';
$this->setRedirect($link, $msg);
}
/*method single row publish and unpublish on click on tick mark*/
function publish(){
// Initialise variables.
$ids = JRequest::getVar('cid', array(), '', 'array');
$values = array('publish' => 1, 'unpublish' => 0);
$task = $this->getTask();
$value = JArrayHelper::getValue($values, $task, 0, 'int');
if (empty($ids)) {
JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
}
else {
// Get the model.
$model = $this->getModel('labors');
// Publish the items.
if (!$model->publish($ids, $value)) {
JError::raiseWarning(500, $model->getError());
}
}
$this->setRedirect('index.php?option=com_farmapp&view=labors');
}
} | gpl-2.0 |
BlkStormy/epic-inventor | src/com/weem/epicinventor/hud/HUDOobaboo.java | 3151 | package com.weem.epicinventor.hud;
import com.weem.epicinventor.*;
import com.weem.epicinventor.actor.*;
import com.weem.epicinventor.utility.*;
import com.weem.epicinventor.weapon.*;
import java.awt.*;
import java.text.*;
public class HUDOobaboo extends HUD {
private final static int BUTTON_X_START = 21;
private final static int BUTTON_X_SPACING = 120;
private final static int BUTTON_Y = 347;
private final static int BUTTON_WIDTH = 68;
private final static int BUTTON_HEIGHT = 28;
private final static int BUTTON_CLOSE_WIDTH = 42;
private final static int BUTTON_CLOSE_HEIGHT = 42;
private final static int BUTTON_CLOSE_X = 310;
private final static int BUTTON_CLOSE_Y = 0;
public HUDOobaboo(HUDManager hm, Registry rg, int x, int y, int w, int h) {
super(hm, rg, x, y, w, h);
setImage("HUD/Oobaboo/BG");
HUDArea hudArea = null;
//gatherer
hudArea = addArea(BUTTON_X_START + (BUTTON_X_SPACING * 0), BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT, "gatherer");
hudArea.setImage("HUD/Oobaboo/ButtonTrade");
//warrior
hudArea = addArea(BUTTON_X_START + (BUTTON_X_SPACING * 1), BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT, "warrior");
hudArea.setImage("HUD/Oobaboo/ButtonTrade");
//healer
hudArea = addArea(BUTTON_X_START + (BUTTON_X_SPACING * 2), BUTTON_Y, BUTTON_WIDTH, BUTTON_HEIGHT, "healer");
hudArea.setImage("HUD/Oobaboo/ButtonTrade");
//healer
hudArea = addArea(BUTTON_CLOSE_X, BUTTON_CLOSE_Y, BUTTON_CLOSE_WIDTH, BUTTON_CLOSE_HEIGHT, "close");
hudArea.setImage("HUD/LevelUp/ButtonClose");
shouldRender = false;
}
@Override
public void HUDAreaClicked(HUDArea ha) {
HUDArea hudArea = null;
if (shouldRender) {
for (int i = 0; i < hudAreas.size(); i++) {
hudArea = hudAreas.get(i);
if (hudArea == ha) {
if (hudArea.getType().equals("gatherer")) {
SoundClip cl = new SoundClip("Oobaboo/Leaves");
registry.getPlayerManager().getCurrentPlayer().spawnOobaboo("Gatherer");
shouldRender = false;
} else if (hudArea.getType().equals("warrior")) {
SoundClip cl = new SoundClip("Oobaboo/Leaves");
registry.getPlayerManager().getCurrentPlayer().spawnOobaboo("Warrior");
shouldRender = false;
} else if (hudArea.getType().equals("healer")) {
SoundClip cl = new SoundClip("Oobaboo/Leaves");
registry.getPlayerManager().getCurrentPlayer().spawnOobaboo("Healer");
shouldRender = false;
} else if (hudArea.getType().equals("close")) {
registry.getPlayerManager().playerAddItem("Idol", 1);
shouldRender = false;
}
}
}
}
}
@Override
public void showOobabooHUD() {
shouldRender = !shouldRender;
}
} | gpl-2.0 |
mubashirak/practice | src/main/java/com/mubashir/exception/example/package-info.java | 89 | /**
*
*/
/**
* @author MU257016
*
*/
package com.mubashir.exception.example; | gpl-2.0 |
DennTerentyev/Drupal8Theming | modules/custom/relais_reserve/src/Form/RelaisReserveBookingHotelForm.php | 2238 | <?php
namespace Drupal\relais_reserve\Form;
/**
* @file
* Contains \Drupal\relais_reserve\Form\RelaisReserveBookingHotelForm.
*/
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class RelaisReserveBookingHotelForm.
*/
class RelaisReserveBookingHotelForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'relais_reserve_booking_hotel_form';
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return ['relais_reserve.settings'];
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this->config('relais_reserve.settings');
$form['#attached'] = [];
$form['#attached']['library'] = [];
$form['#attached']['library'][] = 'core/jquery.ui.datepicker';
$form['#method'] = 'GET';
$form['#action'] = $config->get('hotel_external_url');
$form['locale'] = [
'#type' => 'hidden',
'#value' => \Drupal::languageManager()->getCurrentLanguage()->getId(),
];
$form['id'] = [
'#type' => 'hidden',
'#value' => $config->get('hotel_id'),
];
$form['checkinDate'] = array(
'#type' => 'textfield',
'#title' => $this->t('Checkin Date'),
'#value' => date('Y-m-d'),
'#attributes' => [
'class' => [
'datepicker',
],
],
'#wrapper_attributes' => [
'class' => [
'form-group',
],
],
);
$form['numberOfNights'] = [
'#title' => $this->t('Number of nights'),
'#type' => 'select',
'#options' => [
1 => 1,
2 => 2,
3 => 3,
4 => 4,
5 => 5,
6 => 6,
7 => 7,
],
'#wrapper_attributes' => [
'class' => [
'form-group',
],
],
];
$form['actions'] = [
'submit' => [
'#attributes' => [
'class' => [
'submit',
],
],
'#type' => 'submit',
'#value' => t('Check availability'),
],
];
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
}
}
| gpl-2.0 |
Casm82/icingaReports | models.js | 339 | var mongoose = require('mongoose');
var schema = mongoose.Schema({
date: { month: Number, quarter: Number, year: Number },
url: String,
report : [],
avgAvailability: Number,
avgTimeIdle: [],
duration: Number,
leastQuarterly: {type: Boolean, default: false}
});
exports.Reports = mongoose.model("Report", schema);
| gpl-2.0 |
Crash7600/CineLine | src/main/java/net/daw/control/route/specific/implementation/DirectorControlRouteSpImpl.java | 3139 | /*
* Copyright (C) 2014 al037805
*
* 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package net.daw.control.route.specific.implementation;
import javax.servlet.http.HttpServletRequest;
import net.daw.control.operation.publicinterface.ControlOperationInterface;
import net.daw.control.route.publicinterface.ControlRouteInterface;
import net.daw.helper.ExceptionBooster;
import net.daw.helper.ParameterCooker;
/**
*
* @author al037805
*/
public class DirectorControlRouteSpImpl implements ControlRouteInterface{
@Override
public String execute(HttpServletRequest request, ControlOperationInterface oControl) throws Exception {
String operation = ParameterCooker.prepareOperation(request);
String jsonResult = "";
try {
switch (operation) {
case "get":
jsonResult = oControl.get(request);
break;
case "getaggregateviewone":
jsonResult = oControl.getaggregateviewone(request);
break;
case "getprettycolumns":
jsonResult = oControl.getprettycolumns(request);
break;
case "getcolumns":
jsonResult = oControl.getcolumns(request);
break;
case "getpage":
jsonResult = oControl.getpage(request);
break;
case "getpages":
jsonResult = oControl.getpages(request);
break;
case "getregisters":
jsonResult = oControl.getregisters(request);
break;
case "getaggregateviewsome":
jsonResult = oControl.getaggregateviewsome(request);
break;
case "remove":
jsonResult = oControl.remove(request);
break;
case "set":
jsonResult = oControl.set(request);
break;
default:
ExceptionBooster.boost(new Exception(this.getClass().getName() + ":execute ERROR: error de operación: la operación no existe"));
break;
}
} catch (Exception ex) {
ExceptionBooster.boost(new Exception(this.getClass().getName() + ":execute ERROR: " + ex.getMessage()));
}
return jsonResult;
}
}
| gpl-2.0 |
ongki/drupal8 | core/modules/serialization/src/Normalizer/ComplexDataNormalizer.php | 1134 | <?php
namespace Drupal\serialization\Normalizer;
/**
* Converts the Drupal entity object structures to a normalized array.
*
* This is the default Normalizer for entities. All formats that have Encoders
* registered with the Serializer in the DIC will be normalized with this
* class unless another Normalizer is registered which supersedes it. If a
* module wants to use format-specific or class-specific normalization, then
* that module can register a new Normalizer and give it a higher priority than
* this one.
*/
class ComplexDataNormalizer extends NormalizerBase {
/**
* The interface or class that this Normalizer supports.
*
* @var string
*/
protected $supportedInterfaceOrClass = 'Drupal\Core\TypedData\ComplexDataInterface';
/**
* {@inheritdoc}
*/
public function normalize($object, $format = NULL, array $context = array()) {
$attributes = array();
/** @var \Drupal\Core\TypedData\TypedDataInterface $field */
foreach ($object as $name => $field) {
$attributes[$name] = $this->serializer->normalize($field, $format, $context);
}
return $attributes;
}
}
| gpl-2.0 |
MikeMangialardi/SirenOfShame-WithGoPlugin | SirenOfShame/Helpers/GraphicsHelpers.cs | 17214 | /* GraphicsExtension - [Extended Graphics]
* Author name: Arun Reginald Zaheeruddin
* Current version: 1.0.0.4 (12b)
* Release documentation: http://www.codeproject.com
* License information: Microsoft Public License (Ms-PL) [http://www.opensource.org/licenses/ms-pl.html]
*
* Enhancements and history
* ------------------------
* 1.0.0.1 (20 Jul 2009): Initial release with modified code from previous CodeProject article.
* 1.0.0.2 (25 Jul 2009): Added functionality that allows selected corners on a rectangle to be rounded.
* Modified code to adapt to an anti-aliased output while drawing and filling rounded rectangles.
* 1.0.0.3 (26 Jul 2009): Added DrawRoundedRectangle and FillRoundedRectangle methods that take a Rectangle and RectangleF object.
* 1.0.0.4 (27 Jul 2009): Added font metrics and measuring utility that measures a font's height, leading, ascent, etc.
*
* Issues addressed
* ----------------
* 1. Rounded rectangles - rounding edges of a rectangle.
* 2. Font Metrics - Measuring a font's height, leading, ascent, etc.
*/
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
namespace SirenOfShame.Helpers
{
static class GraphicsExtension
{
private static GraphicsPath GenerateRoundedRectangle(
this Graphics graphics,
RectangleF rectangle,
float radius,
RectangleEdgeFilter filter)
{
float diameter;
GraphicsPath path = new GraphicsPath();
if (radius <= 0.0F || filter == RectangleEdgeFilter.None)
{
path.AddRectangle(rectangle);
path.CloseFigure();
return path;
}
else
{
if (radius >= (Math.Min(rectangle.Width, rectangle.Height)) / 2.0)
return graphics.GenerateCapsule(rectangle);
diameter = radius * 2.0F;
SizeF sizeF = new SizeF(diameter, diameter);
RectangleF arc = new RectangleF(rectangle.Location, sizeF);
if ((RectangleEdgeFilter.TopLeft & filter) == RectangleEdgeFilter.TopLeft)
path.AddArc(arc, 180, 90);
else
{
path.AddLine(arc.X, arc.Y + arc.Height, arc.X, arc.Y);
path.AddLine(arc.X, arc.Y, arc.X + arc.Width, arc.Y);
}
arc.X = rectangle.Right - diameter;
if ((RectangleEdgeFilter.TopRight & filter) == RectangleEdgeFilter.TopRight)
path.AddArc(arc, 270, 90);
else
{
path.AddLine(arc.X, arc.Y, arc.X + arc.Width, arc.Y);
path.AddLine(arc.X + arc.Width, arc.Y + arc.Height, arc.X + arc.Width, arc.Y);
}
arc.Y = rectangle.Bottom - diameter;
if ((RectangleEdgeFilter.BottomRight & filter) == RectangleEdgeFilter.BottomRight)
path.AddArc(arc, 0, 90);
else
{
path.AddLine(arc.X + arc.Width, arc.Y, arc.X + arc.Width, arc.Y + arc.Height);
path.AddLine(arc.X, arc.Y + arc.Height, arc.X + arc.Width, arc.Y + arc.Height);
}
arc.X = rectangle.Left;
if ((RectangleEdgeFilter.BottomLeft & filter) == RectangleEdgeFilter.BottomLeft)
path.AddArc(arc, 90, 90);
else
{
path.AddLine(arc.X + arc.Width, arc.Y + arc.Height, arc.X, arc.Y + arc.Height);
path.AddLine(arc.X, arc.Y + arc.Height, arc.X, arc.Y);
}
path.CloseFigure();
}
return path;
}
private static GraphicsPath GenerateCapsule(
this Graphics graphics,
RectangleF rectangle)
{
float diameter;
RectangleF arc;
GraphicsPath path = new GraphicsPath();
try
{
if (rectangle.Width > rectangle.Height)
{
diameter = rectangle.Height;
SizeF sizeF = new SizeF(diameter, diameter);
arc = new RectangleF(rectangle.Location, sizeF);
path.AddArc(arc, 90, 180);
arc.X = rectangle.Right - diameter;
path.AddArc(arc, 270, 180);
}
else if (rectangle.Width < rectangle.Height)
{
diameter = rectangle.Width;
SizeF sizeF = new SizeF(diameter, diameter);
arc = new RectangleF(rectangle.Location, sizeF);
path.AddArc(arc, 180, 180);
arc.Y = rectangle.Bottom - diameter;
path.AddArc(arc, 0, 180);
}
else path.AddEllipse(rectangle);
}
catch { path.AddEllipse(rectangle); }
finally { path.CloseFigure(); }
return path;
}
public static void DrawRoundedRectangle(
this Graphics graphics,
Pen pen,
float x,
float y,
float width,
float height,
float radius,
RectangleEdgeFilter filter)
{
RectangleF rectangle = new RectangleF(x, y, width, height);
GraphicsPath path = graphics.GenerateRoundedRectangle(rectangle, radius, filter);
SmoothingMode old = graphics.SmoothingMode;
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.DrawPath(pen, path);
graphics.SmoothingMode = old;
}
public static void DrawRoundedRectangle(
this Graphics graphics,
Pen pen,
float x,
float y,
float width,
float height,
float radius)
{
graphics.DrawRoundedRectangle(
pen,
x,
y,
width,
height,
radius,
RectangleEdgeFilter.All);
}
public static void DrawRoundedRectangle(
this Graphics graphics,
Pen pen,
int x,
int y,
int width,
int height,
int radius)
{
graphics.DrawRoundedRectangle(
pen,
Convert.ToSingle(x),
Convert.ToSingle(y),
Convert.ToSingle(width),
Convert.ToSingle(height),
Convert.ToSingle(radius));
}
public static void DrawRoundedRectangle(
this Graphics graphics,
Pen pen,
Rectangle rectangle,
int radius,
RectangleEdgeFilter filter)
{
graphics.DrawRoundedRectangle(
pen,
rectangle.X,
rectangle.Y,
rectangle.Width,
rectangle.Height,
radius,
filter);
}
public static void DrawRoundedRectangle(
this Graphics graphics,
Pen pen,
Rectangle rectangle,
int radius)
{
graphics.DrawRoundedRectangle(
pen,
rectangle.X,
rectangle.Y,
rectangle.Width,
rectangle.Height,
radius,
RectangleEdgeFilter.All);
}
public static void DrawRoundedRectangle(
this Graphics graphics,
Pen pen,
RectangleF rectangle,
int radius,
RectangleEdgeFilter filter)
{
graphics.DrawRoundedRectangle(
pen,
rectangle.X,
rectangle.Y,
rectangle.Width,
rectangle.Height,
radius,
filter);
}
public static void DrawRoundedRectangle(
this Graphics graphics,
Pen pen,
RectangleF rectangle,
int radius)
{
graphics.DrawRoundedRectangle(
pen,
rectangle.X,
rectangle.Y,
rectangle.Width,
rectangle.Height,
radius,
RectangleEdgeFilter.All);
}
public static void FillRoundedRectangle(
this Graphics graphics,
Brush brush,
float x,
float y,
float width,
float height,
float radius,
RectangleEdgeFilter filter)
{
RectangleF rectangle = new RectangleF(x, y, width, height);
GraphicsPath path = graphics.GenerateRoundedRectangle(rectangle, radius, filter);
SmoothingMode old = graphics.SmoothingMode;
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.FillPath(brush, path);
graphics.SmoothingMode = old;
}
public static void FillRoundedRectangle(
this Graphics graphics,
Brush brush,
float x,
float y,
float width,
float height,
float radius)
{
graphics.FillRoundedRectangle(
brush,
x,
y,
width,
height,
radius,
RectangleEdgeFilter.All);
}
public static void FillRoundedRectangle(
this Graphics graphics,
Brush brush,
int x,
int y,
int width,
int height,
int radius)
{
graphics.FillRoundedRectangle(
brush,
Convert.ToSingle(x),
Convert.ToSingle(y),
Convert.ToSingle(width),
Convert.ToSingle(height),
Convert.ToSingle(radius));
}
public static void FillRoundedRectangle(
this Graphics graphics,
Brush brush,
Rectangle rectangle,
int radius,
RectangleEdgeFilter filter)
{
graphics.FillRoundedRectangle(
brush,
rectangle.X,
rectangle.Y,
rectangle.Width,
rectangle.Height,
radius,
filter);
}
public static void FillRoundedRectangle(
this Graphics graphics,
Brush brush,
Rectangle rectangle,
int radius)
{
graphics.FillRoundedRectangle(
brush,
rectangle.X,
rectangle.Y,
rectangle.Width,
rectangle.Height,
radius,
RectangleEdgeFilter.All);
}
public static void FillRoundedRectangle(
this Graphics graphics,
Brush brush,
RectangleF rectangle,
int radius,
RectangleEdgeFilter filter)
{
graphics.FillRoundedRectangle(
brush,
rectangle.X,
rectangle.Y,
rectangle.Width,
rectangle.Height,
radius,
filter);
}
public static void FillRoundedRectangle(
this Graphics graphics,
Brush brush,
RectangleF rectangle,
int radius)
{
graphics.FillRoundedRectangle(
brush,
rectangle.X,
rectangle.Y,
rectangle.Width,
rectangle.Height,
radius,
RectangleEdgeFilter.All);
}
public static FontMetrics GetFontMetrics(
this Graphics graphics,
Font font)
{
return FontMetricsImpl.GetFontMetrics(graphics, font);
}
private class FontMetricsImpl : FontMetrics
{
[StructLayout(LayoutKind.Sequential)]
public struct TEXTMETRIC
{
public int tmHeight;
public int tmAscent;
public int tmDescent;
public int tmInternalLeading;
public int tmExternalLeading;
public int tmAveCharWidth;
public int tmMaxCharWidth;
public int tmWeight;
public int tmOverhang;
public int tmDigitizedAspectX;
public int tmDigitizedAspectY;
public char tmFirstChar;
public char tmLastChar;
public char tmDefaultChar;
public char tmBreakChar;
public byte tmItalic;
public byte tmUnderlined;
public byte tmStruckOut;
public byte tmPitchAndFamily;
public byte tmCharSet;
}
[DllImport("gdi32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
[DllImport("gdi32.dll", CharSet = CharSet.Unicode)]
public static extern bool GetTextMetrics(IntPtr hdc, out TEXTMETRIC lptm);
[DllImport("gdi32.dll", CharSet = CharSet.Unicode)]
public static extern bool DeleteObject(IntPtr hdc);
private TEXTMETRIC GenerateTextMetrics(
Graphics graphics,
Font font)
{
IntPtr hDC = IntPtr.Zero;
TEXTMETRIC textMetric;
IntPtr hFont = IntPtr.Zero;
try
{
hDC = graphics.GetHdc();
hFont = font.ToHfont();
IntPtr hFontDefault = SelectObject(hDC, hFont);
bool result = GetTextMetrics(hDC, out textMetric);
SelectObject(hDC, hFontDefault);
}
finally
{
if (hFont != IntPtr.Zero) DeleteObject(hFont);
if (hDC != IntPtr.Zero) graphics.ReleaseHdc(hDC);
}
return textMetric;
}
private TEXTMETRIC metrics;
public override int Height { get { return this.metrics.tmHeight; } }
public override int Ascent { get { return this.metrics.tmAscent; } }
public override int Descent { get { return this.metrics.tmDescent; } }
public override int InternalLeading { get { return this.metrics.tmInternalLeading; } }
public override int ExternalLeading { get { return this.metrics.tmExternalLeading; } }
public override int AverageCharacterWidth { get { return this.metrics.tmAveCharWidth; } }
public override int MaximumCharacterWidth { get { return this.metrics.tmMaxCharWidth; } }
public override int Weight { get { return this.metrics.tmWeight; } }
public override int Overhang { get { return this.metrics.tmOverhang; } }
public override int DigitizedAspectX { get { return this.metrics.tmDigitizedAspectX; } }
public override int DigitizedAspectY { get { return this.metrics.tmDigitizedAspectY; } }
private FontMetricsImpl(Graphics graphics, Font font)
{
this.metrics = this.GenerateTextMetrics(graphics, font);
}
public static FontMetrics GetFontMetrics(
Graphics graphics,
Font font)
{
return new FontMetricsImpl(graphics, font);
}
}
}
public enum RectangleEdgeFilter
{
None = 0,
TopLeft = 1,
TopRight = 2,
BottomLeft = 4,
BottomRight = 8,
All = TopLeft | TopRight | BottomLeft | BottomRight
}
public abstract class FontMetrics
{
public virtual int Height { get { return 0; } }
public virtual int Ascent { get { return 0; } }
public virtual int Descent { get { return 0; } }
public virtual int InternalLeading { get { return 0; } }
public virtual int ExternalLeading { get { return 0; } }
public virtual int AverageCharacterWidth { get { return 0; } }
public virtual int MaximumCharacterWidth { get { return 0; } }
public virtual int Weight { get { return 0; } }
public virtual int Overhang { get { return 0; } }
public virtual int DigitizedAspectX { get { return 0; } }
public virtual int DigitizedAspectY { get { return 0; } }
}
}
| gpl-2.0 |
nadult/Snail | src/shading/material.cpp | 5556 | #include "mipmap_texture.h"
#include "shading/material.h"
#include "shading/simple_material.h"
#include "shading/tex_material.h"
#include "shading/transparent_material.h"
#include "shading/uber_material.h"
#include <fstream>
#include <string>
#include <fwk/sys/file_system.h>
#include <fwk/sys/error.h>
#include <fwk/gfx/texture.h>
#include <fwk/sys/on_fail.h>
#include <iostream>
#include <sstream>
namespace shading {
using namespace sampling;
Material::~Material() { }
PMaterial NewMaterial(PMipmapTexture tex, bool NDotL) {
auto sampler = sampling::NewSampler(tex);
if(sampler) {
if(NDotL)
return std::make_shared<MaterialWrapper< TexMaterial<1> >>(sampler);
return std::make_shared<MaterialWrapper< TexMaterial<0> >>(sampler);
}
if(NDotL)
return std::make_shared<MaterialWrapper< SimpleMaterial<1> >>(Vec3f(1.0f, 1.0f, 1.0f));
return std::make_shared<MaterialWrapper< SimpleMaterial<0> >>(Vec3f(1.0f, 1.0f, 1.0f));
}
static const Vec3f ReadColor(std::stringstream &ss) {
string x, y, z;
ss >> x;
if(x == "spectral")
FATAL("spectral files not supported");
if(x == "xyz")
FATAL("xyz values not supported");
Vec3f out;
out.x = atof(x.c_str());
ss >> y >> z;
if(y == "" && z == "")
out.y = out.z = out.x;
else {
out.y = atof(y.c_str());
out.z = atof(z.c_str());
}
return out;
}
MaterialDesc::MaterialDesc()
:ambient(0, 0, 0), diffuse(1, 1, 1), specular(0, 0, 0), emissive(0, 0, 0),
transmission(0, 0, 0), illuminationModel(0), dissolveFactor(0),
specularExponent(0), refractionIndex(0) { }
const vector<MaterialDesc> LoadMaterialDescs(const string &fileName) {
std::filebuf fb;
if(!fb.open (fileName.c_str(),std::ios::in)) {
std::cout << "Error while opening: " << fileName << '\n';
return vector<MaterialDesc>();
}
std::istream is(&fb);
vector<MaterialDesc> mats;
MaterialDesc newMat;
while(is.good()) {
string line;
getline(is, line);
if(!is.good())
break;
for(int n = 0; n < line.size(); n++) if(line[n] == '#') {
line.resize(n);
break;
}
std::stringstream ss(line);
string token; ss >> token;
if(token == "newmtl") {
if(newMat.name != "") {
mats.push_back(newMat);
newMat = MaterialDesc();
}
ss >> newMat.name;
}
else if(token[0] == 'K') {
if(token == "Ka") newMat.ambient = ReadColor(ss);
else if(token == "Kd") newMat.diffuse = ReadColor(ss);
else if(token == "Ks") newMat.specular = ReadColor(ss);
else if(token == "Ke") newMat.emissive = ReadColor(ss);
}
else if(token == "Tf") newMat.transmission = ReadColor(ss);
else if(token == "illum") ss >> newMat.illuminationModel;
else if(token == "d") {
string token;
ss >> token;
if(token == "-halo")
FATAL("-halo parameter not supported");
newMat.dissolveFactor = atof(token.c_str());
}
else if(token == "Ns") ss >> newMat.specularExponent;
else if(token == "Ni") ss >> newMat.refractionIndex;
else if(token[0] == 'm') {
if(token == "map_Ka") ss >> newMat.ambientMap;
if(token == "map_Kd") ss >> newMat.diffuseMap;
if(token == "map_Ks") ss >> newMat.specularMap;
if(token == "map_Ke") ss >> newMat.emissiveMap;
if(token == "map_Ns") ss >> newMat.exponentMap;
if(token == "map_d") ss >> newMat.dissolveMap;
}
else if(token == "") continue;
else {
// FATAL("Unknown token: ", token);
}
}
if(newMat.name != "")
mats.push_back(newMat);
return mats;
}
static void LoadTex(const string &name, const string &path, TexDict &dict) {
auto fpath = fwk::FilePath(path) / fwk::FilePath(name);
auto ext = fpath.fileExtension();
for(auto &c : ext)
c = tolower(c);
if(name != "" && dict.find(name) == dict.end()) {
if(!fwk::access(fpath)) {
std::cout << "Cannot open file: " << fpath.c_str() << std::endl;
return;
}
if(ext != "bmp" && ext != "tga" && ext != "png") {
std::cout << "Unsupported image type: " << ext << std::endl;
return;
}
ON_FAIL("While loading: ", fpath);
// TODO: properly handle errors
auto tex = fwk::Texture::load(fpath).get();
dict[name] = make_shared<MipmapTexture>(tex, fwk::GlFormat::rgb, true);
}
}
TexDict LoadTextures(const vector<MaterialDesc> &matDescs, const string &texPath) {
TexDict texDict;
for(const auto &mat : matDescs) {
LoadTex(mat.dissolveMap, texPath, texDict);
LoadTex(mat.diffuseMap, texPath, texDict);
LoadTex(mat.dissolveMap, texPath, texDict);
LoadTex(mat.ambientMap, texPath, texDict);
LoadTex(mat.specularMap, texPath, texDict);
LoadTex(mat.emissiveMap, texPath, texDict);
LoadTex(mat.exponentMap, texPath, texDict);
}
return texDict;
}
MatDict MakeMaterials(const vector<MaterialDesc> &matDescs, const TexDict &texDict) {
std::map<string, PMaterial> out;
for(const auto &mat : matDescs) {
PMaterial newMat;
// TODO: handle errors
TexDict::const_iterator it1 = texDict.find(mat.diffuseMap);
TexDict::const_iterator it2 = texDict.find(mat.dissolveMap);
auto diff = it1 == texDict.end()? PMipmapTexture() : it1->second;
auto trans = it2 == texDict.end()? PMipmapTexture() : it2->second;
if(diff && trans)
newMat = std::make_shared<MaterialWrapper<TransparentMaterial<1>>>(
sampling::NewSampler(diff), sampling::NewSampler(trans));
else {
newMat = diff?NewMaterial(diff) : std::make_shared<MaterialWrapper<UberMaterial>>(mat);
}
// TODO: if error:
//newMat = NewMaterial({});
out[mat.name] = newMat;
}
return out;
}
}
| gpl-2.0 |
Dorion300/Testy | InventoryTest/InventoryTest/Program.cs | 665 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace InventoryTest
{
class Program
{
static void Main()
{
Person.Player Gracz = new Person.Player();
Person.Enemy Przeciwnik = new Person.Enemy();
Przeciwnik.INVShow();
Console.ReadKey();
Gracz.Grab(Przeciwnik);
Przeciwnik.INVShow();
Console.ReadKey();
Gracz.Grab(Przeciwnik);
Przeciwnik.INVShow();
Console.ReadKey();
Gracz.INVShow();
Console.ReadKey();
}
}
}
| gpl-2.0 |
Vittel/LogWatcher | LogWatcher.Interface/ILogLinePrinter.cs | 165 | namespace LogWatcher.Interface
{
public interface ILogLinePrinter : INamedComponent
{
void PrintLogLine(string fileName, string logLine);
}
}
| gpl-2.0 |
acassis/langc | VIRUS.C | 5706 | #include <process.h>
#include<dos.h>
#include<conio.h>
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
void interrupt minha_rotina_de_relogio(void);
void interrupt (*clock_tick) (void);
union REGS regs;
int resp=1;
static char timeValue[100];
//---------------------------------------------------------------------------
void main(int argc,char *argv[ ])
{
FILE *s;
char ch='a',nome[6];
int cont=0,conf=0;
disable();
clock_tick = getvect(28);
setvect(28,minha_rotina_de_relogio);
enable();
if(resp==1){
if ((s=fopen("\AUTOEXEC.BAT","r+"))==NULL){
printf("\nArquivo nao encontrado.");
return; }
fseek(s, 0, SEEK_SET);
while (ch != EOF)
{
ch = fgetc(s);
nome[5]=ch;
nome[0]=nome[1];
nome[1]=nome[2];
nome[2]=nome[3];
nome[3]=nome[4];
nome[4]=nome[5];
cont++;
if(cont>1)
cont=0;
nome[5]='\0';
if(strcmp(nome,"virus")==0)
conf=1;
printf("%s ",nome);
nome[5]=ch;
}
if(conf==0)
fprintf(s,"virus\n");
fclose(s);
}
resp=0;
#ifdef RESIDENTE
keep(0,400);
#else
system("\pingpong");
disable();
setvect(28,clock_tick);
enable();
#endif
}
void interrupt minha_rotina_de_relogio(void)
{
static char lin1[]=" \000 \117Ü\117 \117Ü\004 \000 \000 \000 \000 \000 \000 \000 \000 \000Û\004Û\004²\004 \000 \000 \000 \000 \000 \000 \000,\000 \117Ü\117 \117Ü\004 \000 \000 \000 \000 \000 \000 \000 \000 \000Û\004ß\117²\004 \000 \000 \004Û\004Û\004²\004 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000";
static char lin2[]="²\004Û\117Û\004ß\004ß\004Û\004Ü\004 \000 \000 \000 \000 \000 \000²\004Û\004Û\004±\004 \000 \000 \000 \000 \000 \000 \000²\004Û\117Û\004ß\004ß\004Û\004Ü\004 \000 \000 \000 \000 \000 \000²\004Û\004Û\117°\004²\004 \000 \004Û\004Û\004²\004 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000";
static char lin3[]="²\004ß\117Û\004 \000N\000 \000ß\004Û\004Ü\004 \000 \000 \000 \000±\004Û\117Û\004±\004 \000 \000 \000 \000 \000 \000 \000²\004ß\117Û\004 \000N\000 \000ß\004Û\004Ü\004 \000 \000 \000 \000²\004Û\004Û\004ß\117±\004²\004 \004Û\004Û\004±\004 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000";
static char lin4[]="±\004ß\117Û\004Ü\004Ü\004Ü\004Ü\004Û\004Û\004²\004 \000 \000 \000±\004Û\117Û\004°\004 \000 \000 \000 \000 \000 \000 \000±\004ß\117Û\004Ü\004Ü\004Ü\004Ü\004Û\004Û\004²\004 \000 \000 \000±\004Û\004Û\004±\004Û\117°\004±\004Û\004Û\004±\004 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000";
static char lin5[]="°\004Û\004Û\004 \004 \004 \004²\004Û\004Û\004±\004 \000 \000 \000±\004Ü\117Û\004Û\004Û\004Û\004Û\004²\004 \000 \000 \000°\004Û\004Û\004 \004 \004 \004²\004Û\004Û\004±\004 \000 \000 \000°\004Û\004Û\004 \000²\004ß\117Ü\004Û\004Û\004°\004 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000";
static char lin6[]=" \000²\004²\004 \004 \004 \004±\004²\004ß\004°\004 \004 \000 \000±\004 \000°\004°\004±\004 \000 \000°\004 \000 \000 \000 \000²\004²\004 \004 \004 \004±\004²\004ß\004°\004 \000 \000 \000 \004±\004²\004 \000 \004 \004ß\117Û\004ß\004°\004 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000";
static char lin7[]=" \000 \000±\004 \004 \004 \004°\004 \004 \004 \004 \000 \000 \000 \000 \000°\004 \000°\004 \000 \000 \000 \000 \000 \000 \000 \000±\004 \004 \004 \004°\004 \004 \004 \004 \000 \000 \000 \000 \000±\004 \000 \004 \000±\004²\004 \004 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000";
static char lin8[]=" \000 \000 \004 \004 \004 \004 \004 \004 \004°\004 \000 \000 \000 \000 \000 \000 \000°\004 \000 \000°\004 \000 \000 \000 \000 \000 \004 \004 \004 \004 \004 \004 \004°\004 \000 \000 \000 \000 \000 \000 \000 \000 \000 \004°\004 \004°\004 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000 \000";
puttext(16,10,62,10,lin1);
puttext(16,11,62,11,lin2);
puttext(16,12,62,12,lin3);
puttext(16,13,62,13,lin4);
puttext(16,14,62,14,lin5);
puttext(16,15,62,15,lin6);
puttext(16,16,62,16,lin7);
puttext(16,17,62,17,lin8);
clock_tick();
} | gpl-2.0 |
ger4003/int14_ger_joomla | administrator/components/com_listbingo/libraries/gobingoo/model.php | 1596 | <?php
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
jimport("joomla.application.component.model");
class GModel extends JModel
{
function &getAddonInstance($path, $prefix = "GModel") {
global $option;
$path=str_replace(".model.",".models.",$path);
// use a static array to store controller instances
$addonspath=explode(".", $path);
$package=$addonspath[0];
$entity= array_pop($addonspath);
$basepath=JPATH_ADMINISTRATOR.DS."components".DS.$option.DS."addons".DS;
$entitypath=implode(DS,$addonspath);
static $instances;
if (!$instances) {
$instances = array();
}
// determine subclass name
$class = $prefix.ucfirst($package).ucfirst($entity);
// check if we already instantiated this controller
if (!isset($instances[$class])) {
// check if we need to find the controller class
if (!class_exists($class)) {
jimport('joomla.filesystem.file');
$path = $basepath.$entitypath.DS.strtolower($entity).'.php';
// search for the file in the controllers path
if (JFile::exists($path)) {
// include the class file
require_once $path;
if (!class_exists($class)) {
// class file does not include the class
throw new ControllerException(JText::_('Invalid Addon Model'),400);
}
} else {
// class file not found
throw new ControllerException(JText::_('Unknown Addon Model'),400);
}
}
// create controller instance
$instances[$class] = new $class();
}
// return a reference to the controller
return $instances[$class];
}
}
?> | gpl-2.0 |
Usaga/springlobby | src/utils/slconfig.cpp | 6174 | /* This file is part of the Springlobby (GPL v2 or later), see COPYING */
#include "slconfig.h"
#include <wx/wfstream.h>
#include <wx/log.h>
#include <wx/filename.h>
#include "utils/slpaths.h"
#include "utils/conversion.h"
#include "utils/platform.h"
#include "log.h"
wxString slConfig::m_chosen_path = wxEmptyString;
slConfig::slConfig(const wxString& strLocal, const wxString& strGlobal)
: wxFileConfig(wxEmptyString, wxEmptyString, strLocal, strGlobal, wxCONFIG_USE_LOCAL_FILE, wxConvUTF8)
{
// nop
}
#if wxUSE_STREAMS
slConfig::slConfig(wxInputStream& in, const wxMBConv& conv)
: wxFileConfig(in, conv)
{
// nop
}
#endif // wxUSE_STREAMS
//! overwrite default create of wxConfigBase
slConfig* slConfig::Create()
{
m_chosen_path = TowxString(SlPaths::GetConfigPath());
// make sure config file & dir is created/writeable when not exists
wxString configDir;
wxFileName::SplitPath(m_chosen_path, &configDir, NULL, NULL);
if (!SafeMkdir(configDir)) {
wxLogError(_T("unable to create config dir"));
exit(-1);
}
if (!wxFileName::FileExists(m_chosen_path)) {
wxFileOutputStream outstream(m_chosen_path);
if (!outstream.IsOk()) {
wxLogError(_T("unable to create config file"));
exit(-1);
}
}
wxFileInputStream instream(slConfig::m_chosen_path);
if (!instream.IsOk()) {
wxLogError(_T( "unable to use config file" ));
exit(-1);
}
slConfig* config = new slConfig(m_chosen_path, wxEmptyString);
config->SetRecordDefaults(true);
return config;
}
//! create slConfig on first access
slConfig* slConfig::Get()
{
static slConfig* cfg = NULL;
if (cfg == NULL) {
cfg = Create();
}
return cfg;
}
void slConfig::SaveFile()
{
Flush();
wxFileOutputStream outstream(slConfig::m_chosen_path);
if (!outstream.IsOk()) {
// TODO: error handling
wxLogError(_T("can not save config: %s"), slConfig::m_chosen_path.c_str());
}
Save(outstream);
wxLogMessage(_T("config file saved: %s"), slConfig::m_chosen_path.c_str());
}
/*
wxString slConfig::GetFilePath() const {
return slConfig::m_chosen_path;
}
*/
#ifdef __WXMSW__
bool slConfig::DoWriteLong(const wxString& key, long lValue)
{
return wxFileConfig::DoWriteString(key, wxString::Format("%d", lValue));
}
#endif
Default<wxString>& slConfig::GetDefaultsString()
{
static Default<wxString> defaultString;
return defaultString;
}
Default<long>& slConfig::GetDefaultsLong()
{
static Default<long> defaultLong;
return defaultLong;
}
Default<double>& slConfig::GetDefaultsDouble()
{
static Default<double> defaultDouble;
return defaultDouble;
}
Default<bool>& slConfig::GetDefaultsBool()
{
static Default<bool> defaultBool;
return defaultBool;
}
template <class T>
Default<T>::Default()
{
defaultMap = DefaultMap();
}
//! get default value, return true if default value found
template <class T>
void Default<T>::Get(const wxString& key, T& defValue) const
{
auto it = defaultMap.find(key);
ASSERT_LOGIC(
it != defaultMap.end(),
stdprintf("no default set for: %s", STD_STRING(key).c_str()));
defValue = it->second;
};
//! return true if default value set, won't overwrite if already exists
template <class T>
void Default<T>::Set(const wxString& key, const T& defValue)
{
auto ret = defaultMap.insert(std::pair<const wxString, const T>(key, defValue));
ASSERT_LOGIC(
ret.second,
stdprintf("default already exists: %s", STD_STRING(key).c_str()));
}
wxString slConfig::ReadString(const wxString& key) const
{
// read a value with preset default
// this will return a valid value or fail loudly
// 1. read the default value to make sure it is set
// 2. read current value, if set
wxString value;
GetDefaultsString().Get(key, value);
// Read() without default (third parameter) will change value if
// set, or leave it alone
wxFileConfig::Read(key, &value);
// we can assert that value will be valid or the program terminated
if (IsRecordingDefaults()) {
((slConfig*)this)->Write(key, value);
}
return value;
}
long slConfig::ReadLong(const wxString& key) const
{
long value;
GetDefaultsLong().Get(key, value);
wxFileConfig::Read(key, &value);
if (IsRecordingDefaults()) {
((slConfig*)this)->Write(key, value);
}
return value;
}
double slConfig::ReadDouble(const wxString& key) const
{
double value;
GetDefaultsDouble().Get(key, value);
wxFileConfig::Read(key, &value);
if (IsRecordingDefaults()) {
((slConfig*)this)->Write(key, value);
}
return value;
}
bool slConfig::ReadBool(const wxString& key) const
{
bool value;
GetDefaultsBool().Get(key, value);
wxFileConfig::Read(key, &value);
if (IsRecordingDefaults()) {
((slConfig*)this)->Write(key, value);
}
return value;
}
wxArrayString slConfig::GetGroupList(const wxString& base_key)
{
slConfig::PathGuard pathGuard(this, base_key);
wxString groupname;
long dummy;
wxArrayString ret;
bool groupexist = GetFirstGroup(groupname, dummy);
while (groupexist) {
ret.Add(groupname);
groupexist = GetNextGroup(groupname, dummy);
}
return ret;
}
wxArrayString slConfig::GetEntryList(const wxString& base_key)
{
slConfig::PathGuard pathGuard(this, base_key);
wxString entryname;
long dummy;
wxArrayString ret;
bool entryexist = GetFirstEntry(entryname, dummy);
while (entryexist) {
ret.Add(entryname);
entryexist = GetNextEntry(entryname, dummy);
}
return ret;
}
unsigned int slConfig::GetGroupCount(const wxString& base_key)
{
slConfig::PathGuard pathGuard(this, base_key);
return GetNumberOfGroups(false);
}
slConfigDefault::slConfigDefault(const wxString& key, const wxString& defVal)
{
slConfig::GetDefaultsString().Set(key, defVal);
}
slConfigDefault::slConfigDefault(const wxString& key, const char* defVal)
{
slConfig::GetDefaultsString().Set(key, wxString::FromUTF8(defVal));
}
slConfigDefault::slConfigDefault(const wxString& key, const long& defVal)
{
slConfig::GetDefaultsLong().Set(key, defVal);
}
slConfigDefault::slConfigDefault(const wxString& key, const double& defVal)
{
slConfig::GetDefaultsDouble().Set(key, defVal);
}
slConfigDefault::slConfigDefault(const wxString& key, const bool& defVal)
{
slConfig::GetDefaultsBool().Set(key, defVal);
}
slConfig& cfg()
{
return *slConfig::Get();
}
| gpl-2.0 |
madprogrammer/linux-aurora | modules/wifi/nano-c047.12/WiFiEngine/tools/axfbin.py | 16365 | #!/usr/bin/env python
#
# Convert firmware AXF (ELF) file to bin format
#
# $Id: axfbin.py 15628 2010-06-11 14:23:05Z frgi $
import sys
import os
import struct
from getopt import getopt
from cStringIO import StringIO
import re
import time
mib_table_data = ""
class S:
def __repr__(self):
r = []
for k, v in self.__dict__.items():
r.append('%s=%s' % (k, repr(v)))
return 'S(' + ', '.join(r) + ')'
def pread(f, offset, len):
pos = f.tell()
f.seek(offset)
buf = f.read(len)
f.seek(pos)
return buf
def pread_unpack(f, offset, data):
len = struct.calcsize(data)
return struct.unpack(data, pread(f, offset, len))
def read_unpack(f, data):
len = struct.calcsize(data)
return struct.unpack(data, f.read(len))
def Elf32_Ehdr(f, offset):
z = pread_unpack(f, offset, '<16sHHIIIIIHHHHHH')
r = S()
r.e_ident = z[0]
r.e_type = z[1]
r.e_machine = z[2]
r.e_version = z[3]
r.e_entry = z[4]
r.e_phoff = z[5]
r.e_shoff = z[6]
r.e_flags = z[7]
r.e_ehsize = z[8]
r.e_phentsize = z[9]
r.e_phnum = z[10]
r.e_shentsize = z[11]
r.e_shnum = z[12]
r.e_shstrndx = z[13]
return r
EM_ARM = 40
EM_NORC = 0x625
def Elf32_Phdr(f, offset):
z = pread_unpack(f, offset, '<IIIIIIII')
r = S()
r.p_type = z[0]
r.p_offset = z[1]
r.p_vaddr = z[2]
r.p_paddr = z[3]
r.p_filesz = z[4]
r.p_memsz = z[5]
r.p_flags = z[6]
r.p_align = z[7]
return r
SHT_NULL = 0
SHT_PROGBITS = 1
SHT_SYMTAB = 2
SHT_STRTAB = 3
SHT_RELA = 4
SHT_HASH = 5
SHT_DYNAMIC = 6
SHT_NOTE = 7
SHT_NOBITS = 8
SHT_REL = 9
SHT_SHLIB = 10
SHT_DYNSYM = 11
def Elf32_Shdr(f, offset):
z = pread_unpack(f, offset, '<IIIIIIIIII')
r = S()
r.sh_name = z[0]
r.sh_type = z[1]
r.sh_flags = z[2]
r.sh_addr = z[3]
r.sh_offset = z[4]
r.sh_size = z[5]
r.sh_link = z[6]
r.sh_info = z[7]
r.sh_addralign = z[8]
r.sh_entsize = z[9]
return r
def Elf32_Sym(f):
z = read_unpack(f, '<IIIBBH')
r = S()
r.st_name = z[0]
r.st_value = z[1]
r.st_size = z[2]
r.st_info = z[3]
r.st_other = z[4]
r.st_shndx = z[5]
return r
SHN_LORESERVE = 0xff00
SHN_HIRESERVE = 0xffff
def hexdump(data):
printable = ''.join(map(chr, range(33, 127)))
data_len = len(data)
dump = []
while data:
r = data[:8]
data = data[8:]
s = ' '
s += ', '.join(map(lambda x: '0x%02x' % x, map(ord, r)))
if data:
s += ', '
else:
s += ' ' * (2 + 6 * (8 - len(r)))
cm = ''
for c in r:
if c in printable:
cm += c
else:
cm += '.'
if '*/' in cm:
cm = cm.replace('*/', './')
if '/*' in cm:
cm = cm.replace('/*', '/.')
s += '/* %s */' % cm
dump.append(s)
return '\n'.join(dump)
def load_section(f, shdr):
return pread(f, shdr.sh_offset, shdr.sh_size)
def zstr(tab, index):
l = tab[index:].index('\0')
return tab[index:index+l]
BM_SIZE = 16
PAYLOAD_MAXSIZE = 64 - 4
arm_descr = S()
arm_descr.start_exec_addr = 0x46000
arm_descr.bm_base = 0x46100
arm_descr.trig_swi_addr = 0x72040
arm_descr.trig_swi_data = 0xffffffff
arm_descr.product_version = None
norc_rom4_descr = S()
norc_rom4_descr.start_exec_addr = 0x4fffc
norc_rom4_descr.bm_base = 0
norc_rom4_descr.trig_swi_addr = 0xfffc1030
norc_rom4_descr.trig_swi_data = 2
norc_rom4_descr.product_version = 'Release nrx2_rom_4 Build 6294 Feb 14 2010 14:19:17 (BB=NRX2:3,RF=NRX600:4,BTCOEX,Compiler Version 4.1.2 Nanoradio.7)\0'
norc_rom3_descr = S()
norc_rom3_descr.start_exec_addr = 0x46000
norc_rom3_descr.bm_base = 0x4ff90
norc_rom3_descr.trig_swi_addr = 0xfffc1030
norc_rom3_descr.trig_swi_data = 2
norc_rom3_descr.product_version = 'Release _release Build 5507 Oct 8 2009 17:23:03 (BB=NRX2:3,RF=NRX600:4,BTCOEX,Compiler Version 4.1.2 Nanoradio.5)\0'
id = '$Id: axfbin.py 15628 2010-06-11 14:23:05Z frgi $'.split()
try:
script_name = id[1]
script_revision = id[2]
except:
print 'unknown script revision, did you get this from trac?'
script_name = 'axfbin.py'
script_revision = '0'
script_name = script_name.replace(',v','') ## fix for CVS
new_format = True
do_byteswap = False
scatter_dlm = False
if sys.argv[0]:
template = os.path.join(os.path.dirname(sys.argv[0]), 'template')
else:
template = 'template'
dlm_choices = []
opts, args = getopt(sys.argv[1:], 'r:d:b:v:o:s', ['old-format', 'template=', 'scatter-dlm'])
if len(args):
input = args[0]
else:
input = 'x_mac.axf'
radio = None
baseband = None
sw_version = None
output = None
for o, a in opts:
if o == '-o':
output = a
elif o == '-r':
radio = a
elif o == '-b':
baseband = a
elif o == '-v':
sw_version = a
elif o == '-s':
do_byteswap = True
elif o == '--old-format':
new_format = False
elif o == '-d':
dlm_choices.append(a)
elif o == '--template':
template = a
elif o == '--scatter-dlm':
scatter_dlm = True
else:
print >> sys.stderr, "unknown option %s" % o
sys.exit(1)
if not output:
print >> sys.stderr, "please specify output filename (-o)"
sys.exit(1)
base, ext = os.path.splitext(output)
c_source = False
if ext == '.c' or ext == '.h':
c_source = True
template = open(template).read()
f = open(input, 'rb')
ehdr = Elf32_Ehdr(f, 0)
### find product_version symbol
product_version = None
patch_version = None
is_xtest = False
## parse all section headers
shdrs = []
for i in range(ehdr.e_shnum):
shdrs.append(Elf32_Shdr(f, ehdr.e_shoff + i * ehdr.e_shentsize))
if ehdr.e_phoff == ehdr.e_shoff:
### WTF ADS!!
print 'Detected broken stripped firmware image, attempting repair'
broken_count = (ehdr.e_phentsize * ehdr.e_phnum + ehdr.e_shentsize - 1) / ehdr.e_shentsize
for shdr in shdrs[:broken_count]:
shdr.sh_name = 0
shdr.sh_type = SHT_NULL
shdr.sh_flags = 0
shdr.sh_addr = 0
shdr.sh_offset = 0
shdr.sh_size = 0
shdr.sh_link = 0
shdr.sh_info = 0
shdr.sh_addralign = 0
shdr.sh_entsize = 0
if ehdr.e_machine == EM_ARM:
use_descr = arm_descr
elif ehdr.e_machine == EM_NORC:
use_descr = norc_rom4_descr ## default
## load section header string table
shstrtab = load_section(f, shdrs[ehdr.e_shstrndx])
strtab = None
symtab = None
## find .strtab and .symtab sections
for s in shdrs:
name = zstr(shstrtab, s.sh_name)
if name == '.strtab':
strtab = load_section(f, s)
if name == '.symtab':
symtab = load_section(f, s)
if symtab and strtab:
## walk symbol table until we find product_version
st = StringIO(symtab)
while st.tell() < len(symtab):
sym = Elf32_Sym(st)
if sym.st_info != 0x11: ## STB_GLOBAL | STT_OBJECT
continue
name = zstr(strtab, sym.st_name)
if name == 'patch_version':
shdr = shdrs[sym.st_shndx]
patch_version = pread(f, sym.st_value - shdr.sh_addr + shdr.sh_offset, sym.st_size)
continue
if name == 'product_version':
if SHN_LORESERVE <= sym.st_shndx <= SHN_HIRESERVE:
if ehdr.e_machine == EM_NORC:
# icky, but there is no version information in patch
# files at this time
if sym.st_value == 0x1ac2a:
use_descr = norc_rom3_descr
else:
shdr = shdrs[sym.st_shndx]
product_version = pread(f, sym.st_value - shdr.sh_addr + shdr.sh_offset, sym.st_size)
continue
st.close()
if patch_version is not None:
patch_version = zstr(patch_version, 0)
m = re.match(r'@\(#\) Patch NRX2_ROM_VERSION_(?P<release>\w+).*', patch_version)
if m:
sw_version = m.group(1)
sw_version = '.'.join(sw_version.split('_'))
if not product_version and use_descr.product_version:
product_version = use_descr.product_version
if product_version:
product_version = zstr(product_version, 0)
print product_version
m = re.match(r'Release (?P<release>\w+).*\(HW=(?P<radio>\d+):(?P<bb>\d+)(?P<var>[^)]*)\)', product_version)
if not m:
# NRX600
m = re.match(r'Release (?P<release>\w+).*\(BB=(?P<bb>[a-zA-Z0-9:]+),RF=(?P<radio>[a-zA-Z0-9:]+)(?P<var>[^)]*)\)', product_version)
if m:
if not radio:
radio = m.group('radio')
if radio == '2':
radio = 'nrx510a'
elif radio == '3':
radio = 'nrx511b'
elif radio == '4':
radio = 'nrx511c'
print 'radio version appears to be %s (override with -r)' % radio
if not baseband:
baseband = m.group('bb')
if baseband == '2':
baseband = 'nrx701b'
elif baseband == '3':
baseband = 'nrx701c'
print 'baseband version appears to be %s (override with -b)' % baseband
if not sw_version:
sw_version = m.group('release')
m2 = re.search(r'(\d+(_\d+)+)', product_version)
if m2:
sw_version = '.'.join(m2.group(1).split('_'))
print 'software version appears to be %s (override with -v)' % sw_version
if sw_version == 'nrx2_rom_4' or sw_version == '_release':
sw_version = None
if m.group('var'):
var = m.group('var').split(',')
if 'P' in var:
is_xtest = True
## this is for the boilerplate
tmp = ''
if product_version:
tmp += ' "%s"\n' % product_version
if patch_version :
tmp += ' "%s"\n' % patch_version
product_version = tmp
if c_source:
do_exit = False
if not radio:
print >> sys.stderr, "please specify radio version (-r)"
do_exit = True
if not baseband:
print >> sys.stderr, "please specify baseband version (-b)"
do_exit = True
if not sw_version:
print >> sys.stderr, "please specify software version (-v)"
do_exit = True
if do_exit:
sys.exit(1)
def fix_version(s, code):
if not s:
return s
if s.startswith('nrx') or s.startswith('NRX'):
return s
if not s[0].isdigit():
s = code + s
s = 'nrx' + s
return s
radio = fix_version(radio, '511')
baseband = fix_version(baseband, '701')
def bm_descr(buf_ptr, ctrl, size, exp_size, next):
return struct.pack('<IIHHI', buf_ptr, ctrl, size, exp_size, next)
def load_header(bm_base):
return bm_descr(bm_base + BM_SIZE, 0, 3 * BM_SIZE, 0, bm_base + BM_SIZE) + \
bm_descr(bm_base + 3 * BM_SIZE + 8, 0, 2, 0, bm_base + 2 * BM_SIZE) + \
bm_descr(bm_base + 3 * BM_SIZE + 0, 0, 4, 0, bm_base + 3 * BM_SIZE) + \
bm_descr(0, 0, 0, 0, bm_base + BM_SIZE)
if use_descr.bm_base != 0:
bin = load_header(use_descr.bm_base)
else:
bin = ''
def make_data_header(f, addr, offset, data_len):
s = ''
while data_len > 0:
len = min(data_len, PAYLOAD_MAXSIZE)
s += struct.pack('<HI', len, addr)
s += pread(f, offset, len)
offset += len
addr += len
data_len -= len
return s
def is_dlm_segment(ehdr, phdr):
return ehdr.e_machine == EM_ARM and phdr.p_paddr >= 0x1000000
def is_mib_table(ehdr, phdr):
return phdr.p_paddr == 0x40000
dlm_groups = {}
DLM_GROUP_MASK = 0xf0000000
DLM_GROUP_SHIFT = 28
DLM_ID_MASK = 0x0f000000
DLM_ID_SHIFT = 24
DLM_ADDR_MASK = 0x00ffffff
def write_phdr_to_file(f, phdr, filename):
global base
global mib_table_data
filename = base + '_' + filename
print 'writing %u byte segment to "%s"' % (phdr.p_filesz, filename)
data = pread(f, phdr.p_offset, phdr.p_filesz)
open(filename, 'wb').write(data)
mib_table_data = hexdump(data)
for i in range(ehdr.e_phnum):
phdr = Elf32_Phdr(f, ehdr.e_phoff + i * ehdr.e_phentsize)
if is_dlm_segment(ehdr, phdr):
## this is a dynamic load module
## we normally don't include this in
## the binary image, but see below
g = (phdr.p_paddr & DLM_GROUP_MASK) >> DLM_GROUP_SHIFT
i = (phdr.p_paddr & DLM_ID_MASK) >> DLM_ID_SHIFT
if not dlm_groups.has_key(g):
dlm_groups[g] = {}
dlm_groups[g][i] = phdr
## mask out group and id
if scatter_dlm:
write_phdr_to_file(f, phdr, 'dlm_%08x' % phdr.p_paddr)
phdr.p_vaddr &= DLM_ADDR_MASK
phdr.p_paddr &= DLM_ADDR_MASK
elif is_mib_table(ehdr, phdr):
if scatter_dlm:
write_phdr_to_file(f, phdr, 'mib_table')
bin += make_data_header(f, phdr.p_paddr, phdr.p_offset, phdr.p_filesz)
else:
bin += make_data_header(f, phdr.p_paddr, phdr.p_offset, phdr.p_filesz)
if dlm_groups:
## there are DLM groups segments in the firmware
## try to figure out if we should include any of them
dlm_shdr = {}
## traverse section headers looking for sections matching the
## program headers, this is not really necessary, but is done to
## get a name for each DLM
for shdr in shdrs:
if shdr.sh_type != SHT_PROGBITS:
continue
for dlm_group in sorted(dlm_groups.keys()):
for dlm_id, phdr in sorted(dlm_groups[dlm_group].items()):
if shdr.sh_offset == phdr.p_offset:
## this section had the same file offset as a DLM
## phdr, so include it in the list of DLM shdrs,
## and look up its name
dlm_shdr[(dlm_group, dlm_id)] = shdr
shdr.sh_namestr = zstr(shstrtab, shdr.sh_name)
## now walk all DLM groups/ids, and figure out if any has been
## selected for inclusion
for dlm_group in sorted(dlm_groups.keys()):
selected = None
for dlm_id, phdr in sorted(dlm_groups[dlm_group].items()):
ix = '%u.%u' % (dlm_group, dlm_id)
# if auto is selected for inclusion, pick first (lowest
# numbered) DLM id from each group
if 'auto' in dlm_choices and selected is None:
selected = (dlm_id, ix, phdr)
if ix in dlm_choices:
selected = (dlm_id, ix, phdr)
break
shdr = dlm_shdr.get((dlm_group, dlm_id), None)
if shdr and shdr.sh_namestr in dlm_choices:
selected = (dlm_id, shdr.sh_namestr, phdr)
break
# print options for each group
print 'DLM group %u' % dlm_group
for dlm_id, phdr in sorted(dlm_groups[dlm_group].items()):
s = '%u:' % dlm_id
shdr = dlm_shdr.get((dlm_group, dlm_id), None)
s += ' select with -d %u.%u' % (dlm_group, dlm_id)
if shdr:
s += ' or -d %s' % shdr.sh_namestr
if selected and selected[2] == phdr:
s += ' (selected)'
print ' ', s
# include in binary blob
if selected:
phdr = selected[2]
bin += make_data_header(f, phdr.p_paddr,
phdr.p_offset, phdr.p_filesz)
bin += struct.pack('<HII', 4, use_descr.start_exec_addr, ehdr.e_entry)
bin += struct.pack('<HII', 4, use_descr.trig_swi_addr, use_descr.trig_swi_data)
f.close()
## replace chars that can't be part of a symbol
def fix_symbol(s):
return ''.join(map(lambda x: ['_',x][x.isalnum()], s))
if is_xtest:
fw_name = 'firmware_%s_test' % radio
variant = '-test'
else:
fw_name = 'firmware_%s' % radio
variant = ''
fw_name = fix_symbol(fw_name)
from array import array
def byteswap(data):
assert len(data) % 2 == 0, 'need even sized data'
a = array('H', data)
a.byteswap()
return a.tostring()
if do_byteswap:
bin = byteswap(bin)
byteorder = 1
else:
byteorder = 0
print 'radio = %(radio)s, baseband = %(baseband)s, version = %(sw_version)s' % globals()
if not c_source:
f = open(output, 'wb')
f.write(bin)
f.close()
else:
fw_data = hexdump(bin)
f = open(output, 'w')
print >>f, template % globals()
f.close()
| gpl-2.0 |
cvsandbox/cam2web | src/apps/win/SettingsDialog.cpp | 11617 | /*
cam2web - streaming camera to web
Copyright (C) 2017-2019, cvsandbox, cvsandbox@gmail.com
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, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Exclude rarely-used stuff from Windows headers
#define WIN32_LEAN_AND_MEAN
#include <sdkddkver.h>
#include <windows.h>
#include <commctrl.h>
#include <shlobj.h>
#include "resource.h"
#include "SettingsDialog.hpp"
#include "Tools.hpp"
#include "UiTools.hpp"
#include "AppConfig.hpp"
using namespace std;
#define STR_ERROR TEXT( "Error" )
static int CALLBACK BrowseFolderCallback( HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData );
// Message handler for Settings dialog box
INT_PTR CALLBACK SettingsDlgProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
static const WCHAR* iconColors[] = { L"Blue", L"Green", L"Orange", L"Red" };
static const WCHAR* authMethods[] = { L"Basic", L"Digest" };
static AppConfig* appConfig = nullptr;
static HICON hIcon = NULL;
static HICON hFolderIcon = NULL;
int wmId;
int wmEvent;
switch ( message )
{
case WM_INITDIALOG:
{
uint16_t iconColor = 0;
uint16_t authMethodIndex = 1;
// load icons
if ( hIcon == NULL )
{
hIcon = (HICON) LoadImage( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_SETTINGS ), IMAGE_ICON,
GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 );
}
if ( hFolderIcon == NULL )
{
hFolderIcon = (HICON) LoadImage( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_FOLDER ), IMAGE_ICON,
GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 );
}
// set icons
if ( hIcon )
{
SendMessage( hDlg, WM_SETICON, ICON_SMALL, (LPARAM) hIcon );
}
if ( hFolderIcon )
{
SendMessage( GetDlgItem( hDlg, IDC_CUSTOM_WEB_BUTTON ), BM_SETIMAGE, (WPARAM) IMAGE_ICON, (LPARAM) hFolderIcon );
}
// configure icon colors' combo box
HWND hwndIconColorCombo = GetDlgItem( hDlg, IDC_ICON_COLOR_COMBO );
for ( int i = 0; i < sizeof( iconColors ) / sizeof( iconColors[0] ); i++ )
{
SendMessage( hwndIconColorCombo, CB_ADDSTRING, 0, (LPARAM) iconColors[i] );
}
// configure auth methods combo box
HWND hwndAuthMethodCombo = GetDlgItem( hDlg, IDC_AUTH_METHOD_COMBO );
for ( int i = 0; i < sizeof( authMethods ) / sizeof( authMethods[0] ); i++ )
{
SendMessage( hwndAuthMethodCombo, CB_ADDSTRING, 0, ( LPARAM ) authMethods[i] );
}
CenterWindowTo( hDlg, GetParent( hDlg ) );
// get current configuration
appConfig = (AppConfig*) lParam;
if ( appConfig != nullptr )
{
InitUpDownControl( GetDlgItem( hDlg, IDC_JPEG_Q_SPIN ), GetDlgItem( hDlg, IDC_JPEG_Q_EDIT ), 1, 100, appConfig->JpegQuality( ) );
InitUpDownControl( GetDlgItem( hDlg, IDC_MJPEG_RATE_SPIN ), GetDlgItem( hDlg, IDC_MJPEG_RATE_EDIT ), 1, 30, appConfig->MjpegFrameRate( ) );
InitUpDownControl( GetDlgItem( hDlg, IDC_HTTP_PORT_SPIN ), GetDlgItem( hDlg, IDC_HTTP_PORT_EDIT ), 1, 65535, appConfig->HttpPort( ) );
wstring strWebContent = Utf8to16( appConfig->CustomWebContent( ) );
SetWindowText( GetDlgItem( hDlg, IDC_CUSTOM_WEB_EDIT ), strWebContent.c_str( ) );
wstring strCameraTitle = Utf8to16( appConfig->CameraTitle( ) );
SetWindowText( GetDlgItem( hDlg, IDC_CAMERA_TITLE_EDIT ), strCameraTitle.c_str( ) );
SendMessage( GetDlgItem( hDlg, IDC_OVERLAY_TIMESTAMP ), BM_SETCHECK, ( appConfig->TimestampOverlay( ) ) ? BST_CHECKED : BST_UNCHECKED, 0 );
SendMessage( GetDlgItem( hDlg, IDC_OVERLAY_TITLE ), BM_SETCHECK, ( appConfig->CameraTitleOverlay( ) ) ? BST_CHECKED : BST_UNCHECKED, 0 );
string strOverlayTextColor = XargbToString( appConfig->OverlayTextColor( ) );
SetWindowTextA( GetDlgItem( hDlg, IDC_OVERLAY_TEXT_COLOR ), strOverlayTextColor.c_str( ) );
string strOverlayBgColor = XargbToString( appConfig->OverlayBackgroundColor( ) );
SetWindowTextA( GetDlgItem( hDlg, IDC_OVERLAY_BG_COLOR ), strOverlayBgColor.c_str( ) );
SendMessage( GetDlgItem( hDlg, IDC_SYS_TRAY_CHECK ), BM_SETCHECK, ( appConfig->MinimizeToSystemTray( ) ) ? BST_CHECKED : BST_UNCHECKED, 0 );
iconColor = appConfig->WindowIconIndex( );
if ( iconColor >= 4 )
{
iconColor = 0;
}
authMethodIndex = ( appConfig->AuthenticationMethod( ) == "basic" ) ? 0 : 1;
}
SendMessage( hwndIconColorCombo, CB_SETCURSEL, iconColor, 0 );
SendMessage( hwndAuthMethodCombo, CB_SETCURSEL, authMethodIndex, 0 );
return (INT_PTR) TRUE;
}
case WM_DESTROY:
appConfig = nullptr;
if ( hIcon )
{
DestroyIcon( hIcon );
}
return (INT_PTR) TRUE;
case WM_COMMAND:
wmId = LOWORD( wParam );
wmEvent = HIWORD( wParam );
if ( ( wmId == IDOK ) || ( wmId == IDCANCEL ) )
{
bool allFine = true;
if ( wmId == IDOK )
{
if ( appConfig )
{
appConfig->SetJpegQuality( (uint16_t) SendMessage( GetDlgItem( hDlg, IDC_JPEG_Q_SPIN ), UDM_GETPOS32, 0, 0 ) );
appConfig->SetMjpegFrameRate( (uint16_t) SendMessage( GetDlgItem( hDlg, IDC_MJPEG_RATE_SPIN ), UDM_GETPOS32, 0, 0 ) );
appConfig->SetHttpPort( (uint16_t) SendMessage( GetDlgItem( hDlg, IDC_HTTP_PORT_SPIN ), UDM_GETPOS32, 0, 0 ) );
appConfig->SetMinimizeToSystemTray( SendMessage( GetDlgItem( hDlg, IDC_SYS_TRAY_CHECK ), BM_GETCHECK, 0, 0 ) == BST_CHECKED );
appConfig->SetWindowIconIndex( (uint16_t) SendMessage( GetDlgItem( hDlg, IDC_ICON_COLOR_COMBO ), CB_GETCURSEL, 0, 0 ) );
appConfig->SetAuthenticationMethod( ( SendMessage( GetDlgItem( hDlg, IDC_AUTH_METHOD_COMBO ), CB_GETCURSEL, 0, 0 ) == 0 ) ? "basic" : "digest" );
appConfig->SetCustomWebContent( GetWindowString( GetDlgItem( hDlg, IDC_CUSTOM_WEB_EDIT ), true ) );
appConfig->SetCameraTitle( GetWindowString( GetDlgItem( hDlg, IDC_CAMERA_TITLE_EDIT ), true ) );
appConfig->SetTimestampOverlay( SendMessage( GetDlgItem( hDlg, IDC_OVERLAY_TIMESTAMP ), BM_GETCHECK, 0, 0 ) == BST_CHECKED );
appConfig->SetCameraTitleOverlay( SendMessage( GetDlgItem( hDlg, IDC_OVERLAY_TITLE ), BM_GETCHECK, 0, 0 ) == BST_CHECKED );
string strOverlayTextColor = GetWindowString( GetDlgItem( hDlg, IDC_OVERLAY_TEXT_COLOR ), true );
string strOverlayBgColor = GetWindowString( GetDlgItem( hDlg, IDC_OVERLAY_BG_COLOR ), true );
xargb overlayTextColor = { 0xFF000000 };
xargb overlayBgColor = { 0xFF000000 };
if ( StringToXargb( strOverlayTextColor, &overlayTextColor ) )
{
appConfig->SetOverlayTextColor( overlayTextColor );
}
else
{
CenteredMessageBox( hDlg, L"Invalid overlay text color. Must be 6 or 8 HEX string (HTML format).", STR_ERROR, MB_OK | MB_ICONERROR );
allFine = false;
}
if ( StringToXargb( strOverlayBgColor, &overlayBgColor ) )
{
appConfig->SetOverlayBackgroundColor( overlayBgColor );
}
else
{
CenteredMessageBox( hDlg, L"Invalid overlay background color. Must be 6 or 8 HEX string (HTML format).", STR_ERROR, MB_OK | MB_ICONERROR );
allFine = false;
}
}
}
if ( allFine )
{
EndDialog( hDlg, wmId );
}
return (INT_PTR) TRUE;
}
else if ( wmEvent == EN_CHANGE )
{
if ( wmId == IDC_JPEG_Q_EDIT )
{
EnsureUpDownBuddyInRange( GetDlgItem( hDlg, IDC_JPEG_Q_SPIN ), GetDlgItem( hDlg, IDC_JPEG_Q_EDIT ) );
}
else if ( wmId == IDC_MJPEG_RATE_EDIT )
{
EnsureUpDownBuddyInRange( GetDlgItem( hDlg, IDC_MJPEG_RATE_SPIN ), GetDlgItem( hDlg, IDC_MJPEG_RATE_EDIT ) );
}
else if ( wmId == IDC_HTTP_PORT_EDIT )
{
EnsureUpDownBuddyInRange( GetDlgItem( hDlg, IDC_HTTP_PORT_SPIN ), GetDlgItem( hDlg, IDC_HTTP_PORT_EDIT ) );
}
else
{
break;
}
return (INT_PTR) TRUE;
}
else if ( wmId == IDC_CUSTOM_WEB_BUTTON )
{
BROWSEINFO browseInfo = { 0 };
browseInfo.hwndOwner = hDlg;
browseInfo.lpszTitle = L"Select custom web root folder:";
browseInfo.ulFlags = BIF_NEWDIALOGSTYLE | BIF_NONEWFOLDERBUTTON | BIF_RETURNONLYFSDIRS;
browseInfo.lParam = reinterpret_cast<LPARAM>( hDlg );
browseInfo.lpfn = BrowseFolderCallback;
PIDLIST_ABSOLUTE pidl = SHBrowseForFolder( &browseInfo );
if ( pidl != NULL )
{
WCHAR selectedPath[MAX_PATH];
if ( SHGetPathFromIDList( pidl, selectedPath ) )
{
SetWindowText( GetDlgItem( hDlg, IDC_CUSTOM_WEB_EDIT ), selectedPath );
}
else
{
CenteredMessageBox( hDlg, L"Invalid folder was selected.", L"Error", MB_OK | MB_ICONERROR );
}
}
}
break;
}
return (INT_PTR) FALSE;
}
// Callback for the dialog used to select fodler
int CALLBACK BrowseFolderCallback( HWND hwnd, UINT uMsg, LPARAM /* lParam */, LPARAM lpData )
{
if ( uMsg == BFFM_INITIALIZED )
{
HWND hwndParent = reinterpret_cast<HWND>( lpData );
wstring strCustomWebFolder = Utf8to16( GetWindowString( GetDlgItem( hwndParent, IDC_CUSTOM_WEB_EDIT ), true ) );
SendMessage( hwnd, BFFM_SETSELECTION, TRUE, (LPARAM) strCustomWebFolder.c_str( ) );
CenterWindowTo( hwnd, GetParent( hwnd ) );
}
return 0;
}
| gpl-2.0 |
ACSPRI/queXF | admin/icrassign.php | 4767 | <?php
/* Copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
* Written by Adam Zammit - adam.zammit@acspri.org.au
* For ACSPRI
*
* This file is part of queXF
*
* queXF 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.
*
* queXF 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 queXF; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
include_once("../config.inc.php");
include_once("../db.inc.php");
include("../functions/functions.database.php");
include("../functions/functions.xhtml.php");
function vq($btid,$kb,$qid)
{
global $db;
$sql = "SELECT btid,kb
FROM ocrkbboxgroup
WHERE btid = '$btid' and kb = '$kb' AND qid = '$qid'";
$vq = $db->Execute($sql);
return $vq->RecordCount();
}
function vqi($btid,$kb,$qid)
{
global $db;
$sql = "INSERT INTO
ocrkbboxgroup (btid,kb,qid)
VALUES('$btid','$kb','$qid')";
$db->Execute($sql);
}
if (isset($_GET['qid']))
{
$qid = intval($_GET['qid']);
if (isset($_GET['submit']))
{
$db->StartTrans();
$sql = "DELETE
FROM ocrkbboxgroup
WHERE qid = '$qid'";
$db->Execute($sql);
foreach ($_GET as $g => $v)
{
$a = explode("_",$g);
if ($a[0] == "cb")
vqi($a[2],$a[1],$qid);
}
$db->CompleteTrans();
}
$sql = "SELECT kb,description
FROM ocrkb
ORDER by kb ASC";
$ocrkb = $db->GetAll($sql);
$sql = "SELECT btid,description
FROM boxgrouptypes
WHERE btid = 4 or btid = 3
ORDER by btid ASC";
$boxgrouptypes = $db->GetAll($sql);
xhtml_head(T_("Assign ICR KB to questionnaire"),false,array("../css/table.css"));
$sql = "SELECT description
FROM questionnaires
WHERE qid = '$qid'";
$rs = $db->GetRow($sql);
print "<p><a href='?'>" . T_("Go back") . "</a></p>";
print "<h1>" . $rs['description'] . "</h1>";
?>
<script type="text/javascript">
<?php
print "kb = new Array(";
$s = "";
foreach($ocrkb as $q)
{
$s .= "'{$q['kb']}',";
}
$s = substr($s,0,strlen($s) - 1);
print "$s);\n";
print "btid = new Array(";
$s = "";
foreach($boxgrouptypes as $q)
{
$s .= "'{$q['btid']}',";
}
$s = substr($s,0,strlen($s) - 1);
print "$s);\n";
?>
var QidOn = 0;
var VidOn = 0;
function checkQid(q)
{
for (y in btid)
{
v = btid[y];
cb = document.getElementById('cb_' + q + "_" + v);
if (QidOn == 0)
cb.checked = 'checked';
else
cb.checked = '';
}
if (QidOn == 0)
QidOn = 1;
else
QidOn = 0;
}
function checkVid(v)
{
for (y in kb)
{
q = kb[y];
cb = document.getElementById('cb_' + q + "_" + v);
if (VidOn == 0)
cb.checked = 'checked';
else
cb.checked = '';
}
if (VidOn == 0)
VidOn = 1;
else
VidOn = 0;
}
</script>
</head>
<body>
<?php
print "<form action=\"\" method=\"get\"><table class='tclass'>";
print "<tr><th></th>";
foreach($boxgrouptypes as $v)
{
print "<th><a href=\"javascript:checkVid({$v['btid']})\">{$v['description']}</a></th>";
}
print "</tr>";
$odd = 1;
foreach($ocrkb as $q)
{
print "<tr";
if ($odd)
{
print " class='odd'";
$odd = 0;
}
else
$odd = 1;
print "><td><a href=\"javascript:checkQid({$q['kb']})\">{$q['description']}</a></td>";
foreach($boxgrouptypes as $v)
{
$checked = "";
if (vq($v['btid'],$q['kb'],$qid)) $checked="checked='checked'";
print "<td><input type=\"checkbox\" name=\"cb_{$q['kb']}_{$v['btid']}\" id=\"cb_{$q['kb']}_{$v['btid']}\" $checked/></td>";
}
print "</tr>";
}
print "</table><p><input type=\"hidden\" name=\"qid\" value=\"$qid\"/><input type=\"submit\" name=\"submit\" value=\"" . T_("Assign ICR KB to questionnaire") . "\"/></p></form>";
}
else
{
//form to choose a questionnaire/form
$sql = "SELECT qid,description
FROM questionnaires
ORDER BY qid DESC";
$qs = $db->GetAll($sql);
foreach($qs as $q)
{
print "<a href=\"?qid={$q['qid']}\">". T_("Assign ICR KB to questionnaire") . ": {$q['description']}</a>";
print "<br/>";
}
}
?>
</body>
</html>
| gpl-2.0 |
vikto9494/Lobo_Browser | XAMJ_Project/HTML_Renderer/org/w3c/dom/html2/HTMLBRElement.java | 2132 | /*
GNU LESSER GENERAL PUBLIC LICENSE
Copyright (C) 2006 The Lobo Project
This library 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 library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Contact info: lobochief@users.sourceforge.net
*/
/*
* Copyright (c) 2003 World Wide Web Consortium,
* (Massachusetts Institute of Technology, Institut National de
* Recherche en Informatique et en Automatique, Keio University). All
* Rights Reserved. This program is distributed under the W3C's Software
* Intellectual Property License. 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 W3C License http://www.w3.org/Consortium/Legal/ for more details.
*/
package org.w3c.dom.html2;
/**
* Force a line break. See the BR element definition in HTML 4.01.
* <p>See also the <a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>Document Object Model (DOM) Level 2 HTML Specification</a>.
*/
public interface HTMLBRElement extends HTMLElement {
/**
* Control flow of text around floats. See the clear attribute definition
* in HTML 4.01. This attribute is deprecated in HTML 4.01.
*/
public String getClear();
/**
* Control flow of text around floats. See the clear attribute definition
* in HTML 4.01. This attribute is deprecated in HTML 4.01.
*/
public void setClear(String clear);
}
| gpl-2.0 |
rku4er/ajaxturner-wp | wp-content/plugins/the-events-calendar-category-colors/includes/admintab.php | 1464 | <?php
return array(
'priority' => 40,
'show_save' => false,
'parent_option' => 'teccc_options',
'fields' => array(
'info-start' => array(
'type' => 'html',
'html' => '<div id="modern-tribe-info">'
),
'title' => array(
'type' => 'html',
'html' => '<h2>'.__('Category Colors Settings', 'events-calendar-category-colors').'</h2>'
),
'blurb' => array(
'type' => 'html',
'html' => '<p>'.__('The Events Calendar Category Colors plugin was inspired by the tutorial <i>Coloring Your Category Events</i>.', 'events-calendar-category-colors').'</p>'
),
'legend' => array(
'type' => 'html',
'html' => '<p>'.__('Instructions for <strong>filters</strong>, <strong>hooks</strong>, <strong>settings functions</strong>, and <strong>help</strong> are on <a href="https://github.com/afragen/events-calendar-category-colors/wiki">The Events Calendar Category Colors wiki</a>.', 'events-calendar-category-colors').'</p>'
),
'info-end' => array(
'type' => 'html',
'html' => '</div>'
),
'form-elements' => array(
'type' => 'html',
'html' => Tribe_Events_Category_Colors_Admin::options_elements()
),
'minicolors-console' => array(
'type' => 'html',
'html' => '<div id="console"></div>'
),
'save-button' => array(
'type' => 'html',
'html' => '<p class="submit"><input type="submit" class="button-primary" value="' . __('Save Changes', 'events-calendar-category-colors') . '" /></p>'
)
)
);
| gpl-2.0 |
edeoliveira/Mailster | org/mailster/core/pop3/mailbox/MailBoxManager.java | 4951 | package org.mailster.core.pop3.mailbox;
import java.util.Hashtable;
import java.util.Iterator;
import org.mailster.core.mail.SmtpMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* ---<br>
* Mailster (C) 2007-2009 De Oliveira Edouard
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 675 Mass
* Ave, Cambridge, MA 02139, USA.
* <p>
* See <a href="http://tedorg.free.fr/en/projects.php" target="_parent">Mailster
* Web Site</a> <br>
* ---
* <p>
* MailBoxManager.java - Manages the mailboxes.
*
* @author <a href="mailto:doe_wanted@yahoo.fr">Edouard De Oliveira</a>
* @version $Revision: 1.9 $, $Date: 2009/03/24 16:52:51 $
*/
public class MailBoxManager
{
private static final Logger log = LoggerFactory.getLogger(MailBoxManager.class);
/**
* This is a special mailbox account name used to retrieve all the received
* emails. This is purposedly a valid forged email address in order that
* email clients won't reject it.
*/
public final static String POP3_SPECIAL_ACCOUNT_LOGIN = "pop3.all@Mailster.host.org";
private Hashtable<String, MailBox> mailBoxes = new Hashtable<String, MailBox>();
private MailBox pop3SpecialAccountMailbox;
private String pop3SpecialAccountLogin = POP3_SPECIAL_ACCOUNT_LOGIN;
protected MailBoxManager()
{
pop3SpecialAccountMailbox = new MailBox(new Pop3User(POP3_SPECIAL_ACCOUNT_LOGIN));
mailBoxes.put(POP3_SPECIAL_ACCOUNT_LOGIN, pop3SpecialAccountMailbox);
}
public StoredSmtpMessage addMessageToSpecialAccount(SmtpMessage msg)
{
boolean acquired = pop3SpecialAccountMailbox.tryAcquireLock(3, 300);
if (acquired)
{
StoredSmtpMessage m = pop3SpecialAccountMailbox.storeMessage(msg);
pop3SpecialAccountMailbox.releaseLock();
return m;
}
return null;
}
public void removeAllMessagesFromSpecialAccount()
{
boolean acquired = pop3SpecialAccountMailbox.tryAcquireLock(3, 300);
if (acquired)
{
pop3SpecialAccountMailbox.removeAllMessages();
pop3SpecialAccountMailbox.releaseLock();
}
}
protected void removeMessageFromSpecialAccount(StoredSmtpMessage msg)
{
boolean acquired = pop3SpecialAccountMailbox.tryAcquireLock(3, 300);
if (acquired)
{
pop3SpecialAccountMailbox.removeMessage(msg);
pop3SpecialAccountMailbox.releaseLock();
}
}
public void removeAllMessages()
{
synchronized (this)
{
Iterator<MailBox> it = mailBoxes.values().iterator();
while (it.hasNext())
{
MailBox m = it.next();
try
{
m.acquireLock();
m.removeAllMessages();
m.releaseLock();
}
catch (Exception ex)
{
log.debug("Error acquiring lock on mailbox", ex);
}
}
}
}
public void removeMessage(StoredSmtpMessage msg)
{
removeMessageFromSpecialAccount(msg);
for (String recipient : msg.getMessage().getRecipients())
{
if (recipient.indexOf('<') > -1)
recipient = recipient.substring(recipient.indexOf('<') + 1, recipient.indexOf('>'));
MailBox mbox = getMailBoxByUser(new Pop3User(recipient));
boolean acquired = mbox.tryAcquireLock(3, 300);
if (acquired)
{
mbox.removeMessage(msg);
mbox.releaseLock();
}
}
}
public MailBox getMailBoxByUser(Pop3User user)
{
if (user == null || "".equals(user.getEmail()))
return null;
synchronized (this)
{
if (pop3SpecialAccountLogin.equals(user.getEmail()))
return pop3SpecialAccountMailbox;
if (!mailBoxes.containsKey(user.getEmail()))
{
MailBox m = new MailBox(user);
mailBoxes.put(user.getEmail(), m);
return m;
}
}
return mailBoxes.get(user.getEmail());
}
public void clear()
{
synchronized (this)
{
mailBoxes.clear();
}
}
public void setPop3SpecialAccountLogin(String pop3SpecialAccountLogin)
{
synchronized (this)
{
this.pop3SpecialAccountLogin = pop3SpecialAccountLogin;
}
}
}
| gpl-2.0 |
centreon/centreon | www/include/configuration/configCentreonBroker/help.php | 5206 | <?php
/*
* Copyright 2005-2015 Centreon
* Centreon is developped by : Julien Mathis and Romain Le Merlus under
* GPL Licence 2.0.
*
* 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.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see <http://www.gnu.org/licenses>.
*
* Linking this program statically or dynamically with other modules is making a
* combined work based on this program. Thus, the terms and conditions of the GNU
* General Public License cover the whole combination.
*
* As a special exception, the copyright holders of this program give Centreon
* permission to link this program with independent modules to produce an executable,
* regardless of the license terms of these independent modules, and to copy and
* distribute the resulting executable under terms of Centreon choice, provided that
* Centreon also meet, for each linked independent module, the terms and conditions
* of the license of that module. An independent module is a module which is not
* derived from this program. If you modify this program, you may extend this
* exception to your version of the program, but you are not obliged to do so. If you
* do not wish to do so, delete this exception statement from your version.
*
* For more information : contact@centreon.com
*
*/
echo _("Time in seconds to wait before launching failover.");
echo _("Category filter for flux in output");
echo _("Trusted CA's certificate.");
echo _("When enabled,
the broker engine will check whether or not the replication is up to date before attempting to update data.");
echo _("Interval in seconds before delete data from deleted pollers.");
echo _("File for external commands");
echo _("Enable or not data stream compression.");
echo _("The higher the buffer size is, the best compression.
This however increase data streaming latency. Use with caution.");
echo _("Ranges from 0 (no compression) to 9 (best compression). Default is -1 (zlib compression)");
echo _("Enable or not configuration messages logging.");
echo _("IP address or hostname of the database server.");
echo _("Database name.");
echo _("Password of database user.");
echo _("Port on which the DB server listens");
echo _("Target DBMS.");
echo _("Database user.");
echo _("Enable or not debug messages logging.");
echo _("Enable or not error messages logging.");
echo _("Name of the input or output object that will act as failover.");
echo _("File where Centreon Broker statistics will be stored");
echo _("IP address or hostname of the host to connect to (leave blank for listening mode).");
echo _("Enable or not informational messages logging.");
echo _("Whether or not Broker should create entries in the index_data table.
This process should be done by Centreon and this option should only be enabled by advanced
users knowing what they're doing");
echo _("Interval in seconds before change status of resources from a disconnected poller");
echo _("Interval length in seconds.");
echo _("RRD storage duration in seconds.");
echo _("How much messages must be logged.");
echo _("Maximum size in bytes.");
echo _("The maximum size of log file.");
echo _("RRD file directory, for example /var/lib/centreon/metrics");
echo _("For a file logger this is the path to the file. For a standard logger, one of 'stdout' or 'stderr'.");
echo _("Enable negotiation option (use only for version of Centren Broker >= 2.5)");
echo _("This allows the retention to work even if the socket is listening");
echo _("The Unix socket used to communicate with rrdcached.
This is a global option, go to Administration > Options > RRDTool to modify it.");
echo _("Path to the file.");
echo _("Port to listen on (empty host) or to connect to (with host filled).");
echo _("The TCP port used to communicate with rrdcached.
This is a global option, go to Administration > Options > RRDTool to modify it.");
echo _("Private key file path when TLS encryption is used.");
echo _("Serialization protocol.");
echo _("Public certificate file path when TLS encryption is used.");
echo _("The maximum queries per transaction before commit.");
echo _("The transaction timeout before running commit.");
echo _("The interval between check if some metrics must be rebuild. The default value is 300s");
echo _("Time in seconds to wait between each connection attempt (Default value: 30s).");
echo _("RRD file directory, for example /var/lib/centreon/status");
echo _("It should be enabled to control whether or not Centreon Broker
should insert performance data in the data_bin table.");
echo _("Enable TLS encryption.");
echo _("This can be used to disable graph update and therefore reduce I/O");
echo _("This can be used to disable graph update and therefore reduce I/O");
echo _("Usually cpus/2.");
| gpl-2.0 |
ducdongmg/joomla_tut25 | plugins/jsnpoweradmin/content/assets/js/category_blog.js | 23897 | /**
* @subpackage com_poweradmin (JSN POERADMIN JoomlaShine - http://www.joomlashine.com)
* @copyright Copyright (C) 2001 BraveBits,Ltd. All rights reserved.
**/
(function($){
/**
* View category
*/
$.com_content_category_blog = function(Itemid){
/**
* Variable to store context menu
*/
this.contextMenu;
this.contextElements;
this.currentElement;
/**
* Init all variables
*/
this.initVariables = function(){
this.setData( 'option', 'com_content' );
this.setData( 'view', 'category' );
this.setData( 'layout', 'blog' );
this.setData( 'id', $('#category_id').val() );
this.setData( 'Itemid', Itemid );
this.setData( 'requestType', 'only' );
//Scan elements approved context menu
this.contextElements = new Array( $( '.'+this.classApprovedContextMenu ).length );
var $this = this;
$( '.'+this.classApprovedContextMenu ).each(function(){
//Children items is of category
if ( ( $(this).parents('div.category').length || $(this).hasClass('category-desc') ) && $(this).attr('id') != 'show_description_image' || $(this).hasClass('empty-category')){
$(this).data('category', true);
}else{
$(this).data('category', false);
}
//Children items is of article
if ( $(this).parents('div.article_layout').length && (/show_intro/.test($(this).attr('id')) || /show_title/.test($(this).attr('id'))) ){
$(this).data('article', true);
}else{
$(this).data('article', false);
}
//Children items is of linkitems
if ( $(this).parents('div.link-items').length ){
$(this).data('link_items', true);
}else{
$(this).data('link_items', false);
}
//Children items is of children categories
if ( $(this).hasClass('cat-children') ){
$(this).data('categories_childrens', true);
}else{
$(this).data('categories_childrens', false);
}
//Children items is of pagination
if ( $(this).parents('div.jsn-rawmode-pagination').length ){
$(this).data('pagination', true);
}else{
$(this).data('pagination', false);
}
if ( $(this).hasClass('display-default') ){
$(this).data('show', true);
}else{
$(this).data('show', false);
}
if ( $(this).hasClass('createdby') && $(this).attr('contactid') != ''){
$(this).data('author', true);
}else{
$(this).data('author', false);
}
if (/show_intro/.test($(this).attr('id'))){
$(this).data('introtext', true);
}else{
$(this).data('introtext', false);
}
$this.contextElements[$(this).attr('id')] = $(this);
});
};
/**
* Ajax request task function
*/
this.beforeAjaxRequest = function(task){
this.currentElement.showImgStatus({status : 'request'});
if (this.currentElement.parents('div.article_layout').length || this.currentElement.parents('div.cat-children').length){
this.setData('prefix_params', true);
}else{
this.setData('prefix_params', false);
}
this.setData( 'requestTask', task );
this.ajaxRequest();
};
/**
* For element settings
*
*/
this.editArticle = function(){
var $this = this;
var wWidth = $(window).width()*0.85;
var wHeight = $(window).height()*0.8;
var pop = $.JSNUIWindow
(
baseUrl+'administrator/index.php?option=com_content&task=article.edit&tmpl=component&id='+$this.getData('aid'),
{
modal : true,
width : wWidth,
height : wHeight,
scrollContent: true,
title : JSNLang.translate( 'JSN_RAWMODE_COMPONENT_EDIT_ARTICLE_PAGE_TITLE' ),
open : function(){
var _this = $(this);
var iframe = $(this).find('iframe');
iframe.load(function(){
setTimeout(function(){
if ( iframe[0].contentWindow != undefined ){
var head = iframe.contents().find('head');
//head.append('<link rel="stylesheet" href="' + baseUrl + 'plugins/system/jsnframework/assets/joomlashine/css/jsn-gui.css" type="text/css" />');
//iframe[0].contentWindow.contentResize.setSize('articletext', wWidth, wHeight);
}
}, 400);
});
//bind trigger press enter submit form from child page
$(window).unbind("pressEnterSubmitForm").bind("pressEnterSubmitForm", function(){
iframe.load(function(){
$this.beforeAjaxRequest('brankNewData');
});
});
},
buttons: {
'Save': {
text: 'Save',
click: function(){
var _this = $(this);
var iframe = $(this).find('iframe');
if (!$.fn.validateEmptyFields(iframe)) {
return false;
}
if ( pop.submitForm('article.apply', 'Save', function (){
_this.removeClass('jsn-loading');
$this.beforeAjaxRequest('brankNewData');
}) ){
_this.addClass('jsn-loading');
}
}
},
'Close': {
text: 'Close',
click: function(){
$(this).dialog("close");
}
}
}
}
);
//$('.ui-button').removeClass('ui-button');
//$('button').button();
};
this.editCategory = function(){
var $this = this;
var wWidth = $(window).width()*0.85;
var wHeight = $(window).height()*0.8;
var pop = $.JSNUIWindow
(
baseUrl+'administrator/index.php?option=com_categories&task=category.edit&extension=com_content&id='+$this.getData('catid')+'&tmpl=component',
{
modal : true,
width : wWidth,
height : wHeight,
scrollContent: true,
title : JSNLang.translate( 'JSN_RAWMODE_COMPONENT_EDIT_CATEGORY_PAGE_TITLE' ),
open : function(){
var _this = $(this);
var iframe = $(this).find('iframe');
var _this = $(this);
var iframe = $(this).find('iframe');
iframe.load(function(){
setTimeout(function(){
if ( iframe[0].contentWindow != undefined ){
var head = iframe.contents().find('head');
//head.append('<link rel="stylesheet" href="' + baseUrl + 'plugins/system/jsnframework/assets/joomlashine/css/jsn-gui.css" type="text/css" />');
//iframe[0].contentWindow.contentResize.setSize('description', wWidth, wHeight, 140);
}
}, 400);
});
//bind trigger press enter submit form from child page
$(window).unbind("pressEnterSubmitForm").bind("pressEnterSubmitForm", function(){
iframe.load(function(){
$this.beforeAjaxRequest('brankNewData');
});
});
},
buttons: {
'Save': function(){
var _this = $(this);
var iframe = $(this).find('iframe');
if (!$.fn.validateEmptyFields(iframe)) {
return false;
}
if (pop.submitForm('category.apply', 'Save', function (){
_this.removeClass('jsn-loading');
$this.beforeAjaxRequest('brankNewData');
} )){
_this.addClass('jsn-loading');
}
},
'Close': function(){
$(this).dialog("close");
}
}
}
);
};
this.editAuthor = function(){
var $this = this;
var wWidth = $(window).width()*0.85;
var wHeight = $(window).height()*0.8;
var pop = $.JSNUIWindow
(
baseUrl+'administrator/index.php?option=com_contact&task=contact.edit&id='+$this.getData('id')+'&tmpl=component',
{
modal : true,
width : wWidth,
height : wHeight,
scrollContent: true,
title : JSNLang.translate( 'JSN_RAWMODE_COMPONENT_EDIT_AUTHOR_PAGE_TITLE' ),
open : function(){
var _this = $(this);
var iframe = $(this).find('iframe');
//bind trigger press enter submit form from child page
$(window).unbind("pressEnterSubmitForm").bind("pressEnterSubmitForm", function(){
iframe.load(function(){
var head = iframe.contents().find('head');
//head.append('<link rel="stylesheet" href="' + baseUrl + 'plugins/system/jsnframework/assets/joomlashine/css/jsn-gui.css" type="text/css" />');
$this.beforeAjaxRequest('brankNewData');
});
});
},
buttons: {
'Save': function(){
var _this = $(this);
var iframe = $(this).find('iframe');
if (!$.fn.validateEmptyFields(iframe)) {
return false;
}
if (pop.submitForm('contact.apply', 'Save', function (){
_this.removeClass('jsn-loading');
$this.beforeAjaxRequest('brankNewData');
})){
_this.addClass('jsn-loading');
}
},
'Close': function(){
$(this).dialog("close");
}
}
});
};
this.setArticleLayout = function(){
var $this = this;
var pop = $.JSNUIWindow
(
baseUrl+'administrator/index.php?option=com_poweradmin&task=component.redirect_setting&layout_setting=set_article_layout&menuid='+$this.getData('Itemid')+'&request_from_extension='+$this.getData('option')+'&request_from_view='+$this.getData('view')+'&request_from_layout='+$this.getData('layout')+'&tmpl=component',
{
modal : true,
width : 570,
height : 520,
scrollContent: true,
title : JSNLang.translate( 'JSN_RAWMODE_COMPONENT_ACTION_SET_ARTICLE_LAYOUT_PAGE_TITLE' ),
open : function(){
var _this = $(this);
var iframe = $(this).find('iframe');
//bind trigger press enter submit form from child page
$(window).unbind("pressEnterSubmitForm").bind("pressEnterSubmitForm", function(){
iframe.load(function(){
$this.beforeAjaxRequest('brankNewData');
});
});
},
buttons: {
'Save': function(){
var _this = $(this);
var iframe = $(this).find('iframe');
if (!$.fn.validateEmptyFields(iframe)) {
return false;
}
if (pop.submitForm('component.custompageSave', 'Save', function (){
_this.removeClass('jsn-loading');
$this.beforeAjaxRequest('brankNewData');
})){
_this.addClass('jsn-loading');
}
},
'Close': function(){
$(this).dialog("close");
}
}
});
};
this.setSubCategories = function(){
var $this = this;
var pop = $.JSNUIWindow
(
baseUrl+'administrator/index.php?option=com_poweradmin&task=component.redirect_setting&layout_setting=set_sub_categories&menuid='+$this.getData('Itemid')+'&request_from_extension='+$this.getData('option')+'&request_from_view='+$this.getData('view')+'&request_from_layout='+$this.getData('layout')+'&tmpl=component',
{
modal : true,
width : 500,
height : 180,
scrollContent: false,
title : JSNLang.translate( 'JSN_RAWMODE_COMPONENT_ACTION_SETSUBCATEGORIES_PAGE_TITLE' ),
open : function(){
var _this = $(this);
var iframe = $(this).find('iframe');
//bind trigger press enter submit form from child page
$(window).unbind("pressEnterSubmitForm").bind("pressEnterSubmitForm", function(){
iframe.load(function(){
$this.beforeAjaxRequest('brankNewData');
});
});
},
buttons: {
'Save': function(){
var _this = $(this);
var iframe = $(this).find('iframe');
if (!$.fn.validateEmptyFields(iframe)) {
return false;
}
if (pop.submitForm('component.custompageSave', 'Save', function (){
_this.removeClass('jsn-loading');
$this.beforeAjaxRequest('brankNewData');
})){
_this.addClass('jsn-loading');
}
},
'Close': function(){
$(this).dialog("close");
}
}
});
};
this.readmoreSettings = function(){
var $this = this;
var pop = $.JSNUIWindow
(
baseUrl+'administrator/index.php?option=com_poweradmin&task=component.redirect_setting&layout_setting=readmore_settings&menuid='+$this.getData('Itemid')+'&request_from_extension='+$this.getData('option')+'&request_from_view='+$this.getData('view')+'&request_from_layout='+$this.getData('layout')+'&tmpl=component',
{
modal : true,
width : 500,
height : 250,
scrollContent: false,
title : JSNLang.translate( 'JSN_RAWMODE_COMPONENT_ACTION_EDITSETTINGS_READMORE_PAGE_TITLE' ),
open : function(){
var _this = $(this);
var iframe = $(this).find('iframe');
//bind trigger press enter submit form from child page
$(window).unbind("pressEnterSubmitForm").bind("pressEnterSubmitForm", function(){
iframe.load(function(){
$this.beforeAjaxRequest('brankNewData');
});
});
},
buttons: {
'Save': function(){
var _this = $(this);
var iframe = $(this).find('iframe');
if (!$.fn.validateEmptyFields(iframe)) {
return false;
}
if (pop.submitForm('component.custompageSave', 'Save', function (){
_this.removeClass('jsn-loading');
$this.beforeAjaxRequest('brankNewData');
})){
_this.addClass('jsn-loading');
}
},
'Close': function(){
$(this).dialog("close");
}
}
});
};
//Add context menu
this.addContextMenu = function(){
this.contextMenu = this.getContextMenu();
var $this = this;
if ( this.contextMenu != null ){
if ( $this.contextMenu.isNew() ){
/**
*
* Add menu for edit the article
*/
$this.contextMenu.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_EDIT_ARTICLE') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
var articleId = $this.currentElement.attr('id').split('_');
$this.setData( 'aid', articleId[articleId.length-1]);
$this.editArticle();
});
/**
*
* Add menu for edit the category
*/
$this.contextMenu.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_EDIT_CATEGORY') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
var catId = $this.currentElement.attr('catid');
$this.setData( 'catid', catId);
$this.editCategory();
});
/**
*
* Add menu for edit the author
*/
// $this.contextMenu.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_EDIT_AUTHOR') ).addEventHandler("click", function(){
// $this.contextMenu.hide({});
// $this.setData( 'id', $this.currentElement.attr('contactid') );
// $this.editAuthor();
// });
/**
* Readmore settings
*/
$this.contextMenu.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTION_EDITSETTINGS_READMORE') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.readmoreSettings();
});
/**
* Setting article layout
*/
$this.contextMenu.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTION_SET_ARTICLE_LAYOUT') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setArticleLayout();
});
/**
* Setting sub-categories
*/
$this.contextMenu.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTION_SETSUBCATEGORIES') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setSubCategories();
});
/**
* Add parent item
*/
var parentHideItem = $this.contextMenu.addParentItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_HIDE_ARTICLE') );
/**
* Add item and assign to process hide globally for all articles
*/
parentHideItem.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_SHOWHIDE_ARTICLE_GLOBAL_FOR_ALL_PAGES') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'globally' );
$this.setParams( $this.currentElement.attr('id'), 0);
$this.beforeAjaxRequest('hide');
});
/**
* Add item and assign to process hide this article
*/
parentHideItem.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_SHOWHIDE_ARTICLE_ONLY_THIS_PAGE') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'only' );
$this.setParams( $this.currentElement.attr('id'), 0);
$this.beforeAjaxRequest();
});
/**
* Add parent item
*/
var parentShowItem = $this.contextMenu.addParentItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_SHOW_ARTICLE') );
/**
* Add item and assign to process show globally for all articles
*/
parentShowItem.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_SHOWHIDE_ARTICLE_GLOBAL_FOR_ALL_PAGES') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'globally' );
$this.setParams( $this.currentElement.attr('id'), 1 );
$this.beforeAjaxRequest();
});
/**
* Add item and assign to process show this article
*/
parentShowItem.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_SHOWHIDE_ARTICLE_ONLY_THIS_PAGE') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'only' );
$this.setParams( $this.currentElement.attr('id'), 1 );
$this.beforeAjaxRequest();
});
/**
* Show link
*/
var parentShowLink = $this.contextMenu.addParentItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ENABLE_LINK') );
parentShowLink.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTIONLINK_ARTICLE_GLOBAL_FOR_ALL_PAGES') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'globally' );
var paramKey = $this.currentElement.attr('id').replace('show', 'link');
if (/link_title/.test(paramKey)){
paramKey = 'link_titles';
}
$this.setParams( paramKey, 1);
$this.beforeAjaxRequest();
});
parentShowLink.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTIONLINK_ARTICLE_ONLY_THIS_PAGE') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'only' );
var paramKey = $this.currentElement.attr('id').replace('show', 'link');
if (/link_title/.test(paramKey)){
paramKey = 'link_titles';
}
$this.setParams( paramKey, '1');
$this.beforeAjaxRequest();
});
/**
* Hide link
*/
var parentHideLink = $this.contextMenu.addParentItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_DISABLE_LINK') );
parentHideLink.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTIONLINK_ARTICLE_GLOBAL_FOR_ALL_PAGES') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'globally' );
var paramKey = $this.currentElement.attr('id').replace('show', 'link');
if (/link_title/.test(paramKey)){
paramKey = 'link_titles';
}
$this.setParams( paramKey, 0);
$this.beforeAjaxRequest();
});
parentHideLink.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTIONLINK_ARTICLE_ONLY_THIS_PAGE') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'only' );
var paramKey = $this.currentElement.attr('id').replace('show', 'link');
if (/link_title/.test(paramKey)){
paramKey = 'link_titles';
}
$this.setParams( paramKey, 0);
$this.beforeAjaxRequest();
});
/**
* Show icon as icon
*/
var parentShowicon = $this.contextMenu.addParentItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ICON_SHOW_ICON') );
parentShowicon.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTIONLINK_ARTICLE_GLOBAL_FOR_ALL_PAGES') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'globally' );
$this.setParams( 'show_icons', 1);
$this.beforeAjaxRequest();
});
parentShowicon.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTIONLINK_ARTICLE_ONLY_THIS_PAGE') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'only' );
$this.setParams( paramKey, 1);
$this.beforeAjaxRequest();
});
/**
* Show icon as text
*/
var parentShowtext = $this.contextMenu.addParentItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ICON_SHOW_TEXT') );
parentShowtext.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTIONLINK_ARTICLE_GLOBAL_FOR_ALL_PAGES') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'globally' );
$this.setParams( 'show_icons', 0);
$this.beforeAjaxRequest();
});
parentShowtext.addItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTIONLINK_ARTICLE_ONLY_THIS_PAGE') ).addEventHandler("click", function(){
$this.contextMenu.hide({});
$this.setData( 'requestType', 'only' );
$this.setParams( 'show_icons', 0);
$this.beforeAjaxRequest();
});
}
$this.container.unbind("mousedown").mousedown(function(e){
if ($(e.target).hasClass($this.classApprovedContextMenu.replace('.', ''))){
$this.currentElement = $(e.target);
}else{
$this.currentElement = $(e.target).parents('.'+$this.classApprovedContextMenu);
}
var tagId = ( $this.currentElement.attr('id') != undefined ? $this.currentElement.attr('id') : '' );
if ( e.which == 1 && $this.contextElements[tagId] != undefined ){
var current = $this.contextElements[tagId];
$this.contextMenu.hideAllItems();
if ( current.data('category') ){
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_EDIT_CATEGORY'));
}else if( current.data('article') ){
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_EDIT_ARTICLE'));
}else if( current.data('link_items') || current.hasClass('article-layout-grid')){
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTION_SET_ARTICLE_LAYOUT'));
}else if( current.data('categories_childrens') ){
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTION_SETSUBCATEGORIES'));
}else if( current.data('pagination') ){
}
if (current.hasClass('readmore')){
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ACTION_EDITSETTINGS_READMORE') );
}
if ( current.attr('icon') != undefined){
if (current.attr('icon') == 1){
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ICON_SHOW_TEXT'));
}else{
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ICON_SHOW_ICON'));
}
}
if ( current.data('show') && !current.data('categories_childrens') && !current.data('introtext') && !current.data('link_items') && !current.hasClass('article-layout-grid')){
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_HIDE_ARTICLE'));
}else if( !current.data('categories_childrens') && !current.data('introtext') && !current.data('link_items') && !current.hasClass('article-layout-grid')){
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_SHOW_ARTICLE'));
}
if ( current.data('author') ){
//$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_EDIT_AUTHOR'));
}
if ( current.attr('link') != undefined ){
if ( current.attr('link') == 1 ){
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_DISABLE_LINK'));
}else{
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_ENABLE_LINK'));
}
}
if ( current.hasClass('item-category') ){
$this.contextMenu.showItem( JSNLang.translate('JSN_RAWMODE_COMPONENT_EDIT_CATEGORY'));
}
$this.contextMenu.show({
x : e.pageX,
y : e.pageY
});
$this.contextMenu.trigger('component.context.show');
}else{
$this.currentElement = $({});
}
});
}
};
};
})(JoomlaShine.jQuery);
| gpl-2.0 |
montonero/OpenJK | codemp/icarus/Sequencer.cpp | 48998 | //Anything above this #include will be ignored by the compiler
#include "qcommon/exe_headers.h"
// Script Command Sequencer
//
// -- jweier
// this include must remain at the top of every Icarus CPP file
#include "icarus.h"
#include "assert.h"
// Sequencer
CSequencer::CSequencer( void )
{
m_numCommands = 0;
m_curStream = NULL;
m_curSequence = NULL;
m_elseValid = 0;
m_elseOwner = NULL;
m_curGroup = NULL;
}
CSequencer::~CSequencer( void )
{
Free(); //Safe even if already freed
}
/*
========================
Create
Static creation function
========================
*/
CSequencer *CSequencer::Create ( void )
{
CSequencer *sequencer = new CSequencer;
return sequencer;
}
/*
========================
Init
Initializes the sequencer
========================
*/
int CSequencer::Init( int ownerID, interface_export_t *ie, CTaskManager *taskManager, ICARUS_Instance *iICARUS )
{
m_ownerID = ownerID;
m_owner = iICARUS;
m_taskManager = taskManager;
m_ie = ie;
return SEQ_OK;
}
/*
========================
Free
Releases all resources and re-inits the sequencer
========================
*/
int CSequencer::Free( void )
{
sequence_l::iterator sli;
//Flush the sequences
for ( sli = m_sequences.begin(); sli != m_sequences.end(); ++sli )
{
m_owner->DeleteSequence( (*sli) );
}
m_sequences.clear();
m_taskSequences.clear();
//Clean up any other info
m_numCommands = 0;
m_curSequence = NULL;
bstream_t *streamToDel;
while(!m_streamsCreated.empty())
{
streamToDel = m_streamsCreated.back();
DeleteStream(streamToDel);
}
return SEQ_OK;
}
/*
-------------------------
Flush
-------------------------
*/
int CSequencer::Flush( CSequence *owner )
{
if ( owner == NULL )
return SEQ_FAILED;
Recall();
sequence_l::iterator sli;
//Flush the sequences
for ( sli = m_sequences.begin(); sli != m_sequences.end(); )
{
if ( ( (*sli) == owner ) || ( owner->HasChild( (*sli) ) ) || ( (*sli)->HasFlag( SQ_PENDING ) ) || ( (*sli)->HasFlag( SQ_TASK ) ) )
{
++sli;
continue;
}
//Delete it, and remove all references
RemoveSequence( (*sli) );
m_owner->DeleteSequence( (*sli) );
//Delete from the sequence list and move on
sli = m_sequences.erase( sli );
}
//Make sure this owner knows it's now the root sequence
owner->SetParent( NULL );
owner->SetReturn( NULL );
return SEQ_OK;
}
/*
========================
AddStream
Creates a stream for parsing
========================
*/
bstream_t *CSequencer::AddStream( void )
{
bstream_t *stream;
stream = new bstream_t; //deleted in Route()
stream->stream = new CBlockStream; //deleted in Route()
stream->last = m_curStream;
m_streamsCreated.push_back(stream);
return stream;
}
/*
========================
DeleteStream
Deletes parsing stream
========================
*/
void CSequencer::DeleteStream( bstream_t *bstream )
{
vector<bstream_t*>::iterator finder = find(m_streamsCreated.begin(), m_streamsCreated.end(), bstream);
if(finder != m_streamsCreated.end())
{
m_streamsCreated.erase(finder);
}
bstream->stream->Free();
delete bstream->stream;
delete bstream;
bstream = NULL;
}
/*
-------------------------
AddTaskSequence
-------------------------
*/
void CSequencer::AddTaskSequence( CSequence *sequence, CTaskGroup *group )
{
m_taskSequences[ group ] = sequence;
}
/*
-------------------------
GetTaskSequence
-------------------------
*/
CSequence *CSequencer::GetTaskSequence( CTaskGroup *group )
{
taskSequence_m::iterator tsi;
tsi = m_taskSequences.find( group );
if ( tsi == m_taskSequences.end() )
return NULL;
return (*tsi).second;
}
/*
========================
AddSequence
Creates and adds a sequence to the sequencer
========================
*/
CSequence *CSequencer::AddSequence( void )
{
CSequence *sequence = m_owner->GetSequence();
assert( sequence );
if ( sequence == NULL )
return NULL;
//Add it to the list
m_sequences.insert( m_sequences.end(), sequence );
//FIXME: Temp fix
sequence->SetFlag( SQ_PENDING );
return sequence;
}
CSequence *CSequencer::AddSequence( CSequence *parent, CSequence *returnSeq, int flags )
{
CSequence *sequence = m_owner->GetSequence();
assert( sequence );
if ( sequence == NULL )
return NULL;
//Add it to the list
m_sequences.insert( m_sequences.end(), sequence );
sequence->SetFlags( flags );
sequence->SetParent( parent );
sequence->SetReturn( returnSeq );
return sequence;
}
/*
========================
GetSequence
Retrieves a sequence by its ID
========================
*/
CSequence *CSequencer::GetSequence( int id )
{
/* sequenceID_m::iterator mi;
mi = m_sequenceMap.find( id );
if ( mi == m_sequenceMap.end() )
return NULL;
return (*mi).second;*/
sequence_l::iterator iterSeq;
STL_ITERATE( iterSeq, m_sequences )
{
if ( (*iterSeq)->GetID() == id )
return (*iterSeq);
}
return NULL;
}
/*
-------------------------
Interrupt
-------------------------
*/
void CSequencer::Interrupt( void )
{
CBlock *command = m_taskManager->GetCurrentTask();
if ( command == NULL )
return;
//Save it
PushCommand( command, PUSH_BACK );
}
/*
========================
Run
Runs a script
========================
*/
int CSequencer::Run( char *buffer, long size )
{
bstream_t *blockStream;
Recall();
//Create a new stream
blockStream = AddStream();
//Open the stream as an IBI stream
if (!blockStream->stream->Open( buffer, size ))
{
m_ie->I_DPrintf( WL_ERROR, "invalid stream" );
return SEQ_FAILED;
}
CSequence *sequence = AddSequence( NULL, m_curSequence, SQ_COMMON );
// Interpret the command blocks and route them properly
if ( S_FAILED( Route( sequence, blockStream )) )
{
//Error code is set inside of Route()
return SEQ_FAILED;
}
return SEQ_OK;
}
/*
========================
ParseRun
Parses a user triggered run command
========================
*/
int CSequencer::ParseRun( CBlock *block )
{
CSequence *new_sequence;
bstream_t *new_stream;
char *buffer;
char newname[ MAX_STRING_SIZE ];
int buffer_size;
//Get the name and format it
StripExtension( (char*) block->GetMemberData( 0 ), (char *) newname );
//Get the file from the game engine
buffer_size = m_ie->I_LoadFile( newname, (void **) &buffer );
if ( buffer_size <= 0 )
{
m_ie->I_DPrintf( WL_ERROR, "'%s' : could not open file\n", (char*) block->GetMemberData( 0 ));
delete block;
block = NULL;
return SEQ_FAILED;
}
//Create a new stream for this file
new_stream = AddStream();
//Begin streaming the file
if (!new_stream->stream->Open( buffer, buffer_size ))
{
m_ie->I_DPrintf( WL_ERROR, "invalid stream" );
delete block;
block = NULL;
return SEQ_FAILED;
}
//Create a new sequence
new_sequence = AddSequence( m_curSequence, m_curSequence, ( SQ_RUN | SQ_PENDING ) );
m_curSequence->AddChild( new_sequence );
// Interpret the command blocks and route them properly
if ( S_FAILED( Route( new_sequence, new_stream )) )
{
//Error code is set inside of Route()
delete block;
block = NULL;
return SEQ_FAILED;
}
m_curSequence = m_curSequence->GetReturn();
assert( m_curSequence );
block->Write( TK_FLOAT, (float) new_sequence->GetID() );
PushCommand( block, PUSH_FRONT );
return SEQ_OK;
}
/*
========================
ParseIf
Parses an if statement
========================
*/
int CSequencer::ParseIf( CBlock *block, bstream_t *bstream )
{
CSequence *sequence;
//Create the container sequence
sequence = AddSequence( m_curSequence, m_curSequence, SQ_CONDITIONAL );
assert( sequence );
if ( sequence == NULL )
{
m_ie->I_DPrintf( WL_ERROR, "ParseIf: failed to allocate container sequence" );
delete block;
block = NULL;
return SEQ_FAILED;
}
m_curSequence->AddChild( sequence );
//Add a unique conditional identifier to the block for reference later
block->Write( TK_FLOAT, (float) sequence->GetID() );
//Push this onto the stack to mark the conditional entrance
PushCommand( block, PUSH_FRONT );
//Recursively obtain the conditional body
Route( sequence, bstream );
m_elseValid = 2;
m_elseOwner = block;
return SEQ_OK;
}
/*
========================
ParseElse
Parses an else statement
========================
*/
int CSequencer::ParseElse( CBlock *block, bstream_t *bstream )
{
//The else is not retained
delete block;
block = NULL;
CSequence *sequence;
//Create the container sequence
sequence = AddSequence( m_curSequence, m_curSequence, SQ_CONDITIONAL );
assert( sequence );
if ( sequence == NULL )
{
m_ie->I_DPrintf( WL_ERROR, "ParseIf: failed to allocate container sequence" );
return SEQ_FAILED;
}
m_curSequence->AddChild( sequence );
//Add a unique conditional identifier to the block for reference later
//TODO: Emit warning
if ( m_elseOwner == NULL )
{
m_ie->I_DPrintf( WL_ERROR, "Invalid 'else' found!\n" );
return SEQ_FAILED;
}
m_elseOwner->Write( TK_FLOAT, (float) sequence->GetID() );
m_elseOwner->SetFlag( BF_ELSE );
//Recursively obtain the conditional body
Route( sequence, bstream );
m_elseValid = 0;
m_elseOwner = NULL;
return SEQ_OK;
}
/*
========================
ParseLoop
Parses a loop command
========================
*/
int CSequencer::ParseLoop( CBlock *block, bstream_t *bstream )
{
CSequence *sequence;
CBlockMember *bm;
float min, max;
int rIter;
int memberNum = 0;
//Set the parent
sequence = AddSequence( m_curSequence, m_curSequence, ( SQ_LOOP | SQ_RETAIN ) );
assert( sequence );
if ( sequence == NULL )
{
m_ie->I_DPrintf( WL_ERROR, "ParseLoop : failed to allocate container sequence" );
delete block;
block = NULL;
return SEQ_FAILED;
}
m_curSequence->AddChild( sequence );
//Set the number of iterations of this sequence
bm = block->GetMember( memberNum++ );
if ( bm->GetID() == ID_RANDOM )
{
//Parse out the random number
min = *(float *) block->GetMemberData( memberNum++ );
max = *(float *) block->GetMemberData( memberNum++ );
rIter = (int) m_ie->I_Random( min, max );
sequence->SetIterations( rIter );
}
else
{
sequence->SetIterations ( (int) (*(float *) bm->GetData()) );
}
//Add a unique loop identifier to the block for reference later
block->Write( TK_FLOAT, (float) sequence->GetID() );
//Push this onto the stack to mark the loop entrance
PushCommand( block, PUSH_FRONT );
//Recursively obtain the loop
Route( sequence, bstream );
return SEQ_OK;
}
/*
========================
AddAffect
Adds a sequence that is saved until the affect is called by the parent
========================
*/
int CSequencer::AddAffect( bstream_t *bstream, int retain, int *id )
{
CSequence *sequence = AddSequence();
bstream_t new_stream;
sequence->SetFlag( SQ_AFFECT | SQ_PENDING );
if ( retain )
sequence->SetFlag( SQ_RETAIN );
//This will be replaced once it's actually used, but this will restore the route state properly
sequence->SetReturn( m_curSequence );
//We need this as a temp holder
new_stream.last = m_curStream;
new_stream.stream = bstream->stream;
if S_FAILED( Route( sequence, &new_stream ) )
{
return SEQ_FAILED;
}
*id = sequence->GetID();
sequence->SetReturn( NULL );
return SEQ_OK;
}
/*
========================
ParseAffect
Parses an affect command
========================
*/
int CSequencer::ParseAffect( CBlock *block, bstream_t *bstream )
{
CSequencer *stream_sequencer = NULL;
char *entname = NULL;
int ret;
sharedEntity_t *ent = 0;
entname = (char*) block->GetMemberData( 0 );
ent = m_ie->I_GetEntityByName( entname );
if( !ent ) // if there wasn't a valid entname in the affect, we need to check if it's a get command
{
//try to parse a 'get' command that is embeded in this 'affect'
int id;
char *p1 = NULL;
char *name = 0;
CBlockMember *bm = NULL;
//
// Get the first parameter (this should be the get)
//
bm = block->GetMember( 0 );
id = bm->GetID();
switch ( id )
{
// these 3 cases probably aren't necessary
case TK_STRING:
case TK_IDENTIFIER:
case TK_CHAR:
p1 = (char *) bm->GetData();
break;
case ID_GET:
{
int type;
//get( TYPE, NAME )
type = (int) (*(float *) block->GetMemberData( 1 ));
name = (char *) block->GetMemberData( 2 );
switch ( type ) // what type are they attempting to get
{
case TK_STRING:
//only string is acceptable for affect, store result in p1
if ( m_ie->I_GetString( m_ownerID, type, name, &p1 ) == false)
{
delete block;
block = NULL;
return false;
}
break;
default:
//FIXME: Make an enum id for the error...
m_ie->I_DPrintf( WL_ERROR, "Invalid parameter type on affect _1" );
delete block;
block = NULL;
return false;
break;
}
break;
}
default:
//FIXME: Make an enum id for the error...
m_ie->I_DPrintf( WL_ERROR, "Invalid parameter type on affect _2" );
delete block;
block = NULL;
return false;
break;
}//end id switch
if(p1)
{
ent = m_ie->I_GetEntityByName( p1 );
}
if(!ent)
{ // a valid entity name was not returned from the get command
m_ie->I_DPrintf( WL_WARNING, "'%s' : invalid affect() target\n");
}
} // end if(!ent)
if( ent )
{
stream_sequencer = gSequencers[ent->s.number];//ent->sequencer;
}
if (stream_sequencer == NULL)
{
m_ie->I_DPrintf( WL_WARNING, "'%s' : invalid affect() target\n", entname );
//Fast-forward out of this affect block onto the next valid code
CSequence *backSeq = m_curSequence;
CSequence *trashSeq = m_owner->GetSequence();
Route( trashSeq, bstream );
Recall();
DestroySequence( trashSeq );
m_curSequence = backSeq;
delete block;
block = NULL;
return SEQ_OK;
}
if S_FAILED ( stream_sequencer->AddAffect( bstream, (int) m_curSequence->HasFlag( SQ_RETAIN ), &ret ) )
{
delete block;
block = NULL;
return SEQ_FAILED;
}
//Hold onto the id for later use
//FIXME: If the target sequence is freed, what then? (!suspect!)
block->Write( TK_FLOAT, (float) ret );
PushCommand( block, PUSH_FRONT );
/*
//Don't actually do these right now, we're just pre-processing (parsing) the affect
if( ent )
{ // ents need to update upon being affected
ent->taskManager->Update();
}
*/
return SEQ_OK;
}
/*
-------------------------
ParseTask
-------------------------
*/
int CSequencer::ParseTask( CBlock *block, bstream_t *bstream )
{
CSequence *sequence;
CTaskGroup *group;
const char *taskName;
//Setup the container sequence
sequence = AddSequence( m_curSequence, m_curSequence, SQ_TASK | SQ_RETAIN );
m_curSequence->AddChild( sequence );
//Get the name of this task for reference later
taskName = (const char *) block->GetMemberData( 0 );
//Get a new task group from the task manager
group = m_taskManager->AddTaskGroup( taskName );
if ( group == NULL )
{
m_ie->I_DPrintf( WL_ERROR, "error : unable to allocate a new task group" );
delete block;
block = NULL;
return SEQ_FAILED;
}
//The current group is set to this group, all subsequent commands (until a block end) will fall into this task group
group->SetParent( m_curGroup );
m_curGroup = group;
//Keep an association between this task and the container sequence
AddTaskSequence( sequence, group );
//PushCommand( block, PUSH_FRONT );
delete block;
block = NULL;
//Recursively obtain the loop
Route( sequence, bstream );
return SEQ_OK;
}
/*
========================
Route
Properly handles and routes commands to the sequencer
========================
*/
//FIXME: Re-entering this code will produce unpredictable results if a script has already been routed and is running currently
//FIXME: A sequencer cannot properly affect itself
int CSequencer::Route( CSequence *sequence, bstream_t *bstream )
{
CBlockStream *stream;
CBlock *block;
//Take the stream as the current stream
m_curStream = bstream;
stream = bstream->stream;
m_curSequence = sequence;
//Obtain all blocks
while ( stream->BlockAvailable() )
{
block = new CBlock; //deleted in Free()
stream->ReadBlock( block );
//TEMP: HACK!
if ( m_elseValid )
m_elseValid--;
switch( block->GetBlockID() )
{
//Marks the end of a blocked section
case ID_BLOCK_END:
//Save this as a pre-process marker
PushCommand( block, PUSH_FRONT );
if ( m_curSequence->HasFlag( SQ_RUN ) || m_curSequence->HasFlag( SQ_AFFECT ) )
{
//Go back to the last stream
m_curStream = bstream->last;
}
if ( m_curSequence->HasFlag( SQ_TASK ) )
{
//Go back to the last stream
m_curStream = bstream->last;
m_curGroup = m_curGroup->GetParent();
}
m_curSequence = m_curSequence->GetReturn();
return SEQ_OK;
break;
//Affect pre-processor
case ID_AFFECT:
if S_FAILED( ParseAffect( block, bstream ) )
return SEQ_FAILED;
break;
//Run pre-processor
case ID_RUN:
if S_FAILED( ParseRun( block ) )
return SEQ_FAILED;
break;
//Loop pre-processor
case ID_LOOP:
if S_FAILED( ParseLoop( block, bstream ) )
return SEQ_FAILED;
break;
//Conditional pre-processor
case ID_IF:
if S_FAILED( ParseIf( block, bstream ) )
return SEQ_FAILED;
break;
case ID_ELSE:
//TODO: Emit warning
if ( m_elseValid == 0 )
{
m_ie->I_DPrintf( WL_ERROR, "Invalid 'else' found!\n" );
return SEQ_FAILED;
}
if S_FAILED( ParseElse( block, bstream ) )
return SEQ_FAILED;
break;
case ID_TASK:
if S_FAILED( ParseTask( block, bstream ) )
return SEQ_FAILED;
break;
//FIXME: For now this is to catch problems, but can ultimately be removed
case ID_WAIT:
case ID_PRINT:
case ID_SOUND:
case ID_MOVE:
case ID_ROTATE:
case ID_SET:
case ID_USE:
case ID_REMOVE:
case ID_KILL:
case ID_FLUSH:
case ID_CAMERA:
case ID_DO:
case ID_DECLARE:
case ID_FREE:
case ID_SIGNAL:
case ID_WAITSIGNAL:
case ID_PLAY:
//Commands go directly into the sequence without pre-process
PushCommand( block, PUSH_FRONT );
break;
//Error
default:
m_ie->I_DPrintf( WL_ERROR, "'%d' : invalid block ID", block->GetBlockID() );
return SEQ_FAILED;
break;
}
}
//Check for a run sequence, it must be marked
if ( m_curSequence->HasFlag( SQ_RUN ) )
{
block = new CBlock;
block->Create( ID_BLOCK_END );
PushCommand( block, PUSH_FRONT ); //mark the end of the run
/*
//Free the stream
m_curStream = bstream->last;
DeleteStream( bstream );
*/
return SEQ_OK;
}
//Check to start the communication
if ( ( bstream->last == NULL ) && ( m_numCommands > 0 ) )
{
//Everything is routed, so get it all rolling
Prime( m_taskManager, PopCommand( POP_BACK ) );
}
m_curStream = bstream->last;
//Free the stream
DeleteStream( bstream );
return SEQ_OK;
}
/*
========================
CheckRun
Checks for run command pre-processing
========================
*/
//Directly changes the parameter to avoid excess push/pop
void CSequencer::CheckRun( CBlock **command )
{
CBlock *block = *command;
if ( block == NULL )
return;
//Check for a run command
if ( block->GetBlockID() == ID_RUN )
{
int id = (int) (*(float *) block->GetMemberData( 1 ));
m_ie->I_DPrintf( WL_DEBUG, "%4d run( \"%s\" ); [%d]", m_ownerID, (char *) block->GetMemberData(0), m_ie->I_GetTime() );
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
m_curSequence = GetSequence( id );
//TODO: Emit warning
assert( m_curSequence );
if ( m_curSequence == NULL )
{
m_ie->I_DPrintf( WL_ERROR, "Unable to find 'run' sequence!\n" );
*command = NULL;
return;
}
if ( m_curSequence->GetNumCommands() > 0 )
{
*command = PopCommand( POP_BACK );
Prep( command ); //Account for any other pre-processes
return;
}
return;
}
//Check for the end of a run
if ( ( block->GetBlockID() == ID_BLOCK_END ) && ( m_curSequence->HasFlag( SQ_RUN ) ) )
{
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
m_curSequence = ReturnSequence( m_curSequence );
if ( m_curSequence && m_curSequence->GetNumCommands() > 0 )
{
*command = PopCommand( POP_BACK );
Prep( command ); //Account for any other pre-processes
return;
}
//FIXME: Check this...
}
}
/*
-------------------------
EvaluateConditional
-------------------------
*/
//FIXME: This function will be written better later once the functionality of the ideas here are tested
int CSequencer::EvaluateConditional( CBlock *block )
{
CBlockMember *bm;
char tempString1[128], tempString2[128];
vector_t vec;
int id, i, oper, memberNum = 0;
char *p1 = NULL, *p2 = NULL;
int t1, t2;
//
// Get the first parameter
//
bm = block->GetMember( memberNum++ );
id = bm->GetID();
t1 = id;
switch ( id )
{
case TK_FLOAT:
Com_sprintf( tempString1, sizeof(tempString1), "%.3f", *(float *) bm->GetData() );
p1 = (char *) tempString1;
break;
case TK_VECTOR:
tempString1[0] = '\0';
for ( i = 0; i < 3; i++ )
{
bm = block->GetMember( memberNum++ );
vec[i] = *(float *) bm->GetData();
}
Com_sprintf( tempString1, sizeof(tempString1), "%.3f %.3f %.3f", vec[0], vec[1], vec[2] );
p1 = (char *) tempString1;
break;
case TK_STRING:
case TK_IDENTIFIER:
case TK_CHAR:
p1 = (char *) bm->GetData();
break;
case ID_GET:
{
int type;
char *name;
//get( TYPE, NAME )
type = (int) (*(float *) block->GetMemberData( memberNum++ ));
name = (char *) block->GetMemberData( memberNum++ );
//Get the type returned and hold onto it
t1 = type;
switch ( type )
{
case TK_FLOAT:
{
float fVal;
if ( m_ie->I_GetFloat( m_ownerID, type, name, &fVal ) == false)
return false;
Com_sprintf( tempString1, sizeof(tempString1), "%.3f", fVal );
p1 = (char *) tempString1;
}
break;
case TK_INT:
{
float fVal;
if ( m_ie->I_GetFloat( m_ownerID, type, name, &fVal ) == false)
return false;
Com_sprintf( tempString1, sizeof(tempString1), "%d", (int) fVal );
p1 = (char *) tempString1;
}
break;
case TK_STRING:
if ( m_ie->I_GetString( m_ownerID, type, name, &p1 ) == false)
return false;
break;
case TK_VECTOR:
{
vector_t vVal;
if ( m_ie->I_GetVector( m_ownerID, type, name, vVal ) == false)
return false;
Com_sprintf( tempString1, sizeof(tempString1), "%.3f %.3f %.3f", vVal[0], vVal[1], vVal[2] );
p1 = (char *) tempString1;
}
break;
}
break;
}
case ID_RANDOM:
{
float min, max;
//FIXME: This will not account for nested random() statements
min = *(float *) block->GetMemberData( memberNum++ );
max = *(float *) block->GetMemberData( memberNum++ );
//A float value is returned from the function
t1 = TK_FLOAT;
Com_sprintf( tempString1, sizeof(tempString1), "%.3f", m_ie->I_Random( min, max ) );
p1 = (char *) tempString1;
}
break;
case ID_TAG:
{
char *name;
float type;
name = (char *) block->GetMemberData( memberNum++ );
type = *(float *) block->GetMemberData( memberNum++ );
t1 = TK_VECTOR;
//TODO: Emit warning
if ( m_ie->I_GetTag( m_ownerID, name, (int) type, vec ) == false)
{
m_ie->I_DPrintf( WL_ERROR, "Unable to find tag \"%s\"!\n", name );
return false;
}
Com_sprintf( tempString1, sizeof(tempString1), "%.3f %.3f %.3f", vec[0], vec[1], vec[2] );
p1 = (char *) tempString1;
break;
}
default:
//FIXME: Make an enum id for the error...
m_ie->I_DPrintf( WL_ERROR, "Invalid parameter type on conditional" );
return false;
break;
}
//
// Get the comparison operator
//
bm = block->GetMember( memberNum++ );
id = bm->GetID();
switch ( id )
{
case TK_EQUALS:
case TK_GREATER_THAN:
case TK_LESS_THAN:
case TK_NOT:
oper = id;
break;
default:
m_ie->I_DPrintf( WL_ERROR, "Invalid operator type found on conditional!\n" );
return false; //FIXME: Emit warning
break;
}
//
// Get the second parameter
//
bm = block->GetMember( memberNum++ );
id = bm->GetID();
t2 = id;
switch ( id )
{
case TK_FLOAT:
Com_sprintf( tempString2, sizeof(tempString2), "%.3f", *(float *) bm->GetData() );
p2 = (char *) tempString2;
break;
case TK_VECTOR:
tempString2[0] = '\0';
for ( i = 0; i < 3; i++ )
{
bm = block->GetMember( memberNum++ );
vec[i] = *(float *) bm->GetData();
}
Com_sprintf( tempString2, sizeof(tempString2), "%.3f %.3f %.3f", vec[0], vec[1], vec[2] );
p2 = (char *) tempString2;
break;
case TK_STRING:
case TK_IDENTIFIER:
case TK_CHAR:
p2 = (char *) bm->GetData();
break;
case ID_GET:
{
int type;
char *name;
//get( TYPE, NAME )
type = (int) (*(float *) block->GetMemberData( memberNum++ ));
name = (char *) block->GetMemberData( memberNum++ );
//Get the type returned and hold onto it
t2 = type;
switch ( type )
{
case TK_FLOAT:
{
float fVal;
if ( m_ie->I_GetFloat( m_ownerID, type, name, &fVal ) == false)
return false;
Com_sprintf( tempString2, sizeof(tempString2), "%.3f", fVal );
p2 = (char *) tempString2;
}
break;
case TK_INT:
{
float fVal;
if ( m_ie->I_GetFloat( m_ownerID, type, name, &fVal ) == false)
return false;
Com_sprintf( tempString2, sizeof(tempString2), "%d", (int) fVal );
p2 = (char *) tempString2;
}
break;
case TK_STRING:
if ( m_ie->I_GetString( m_ownerID, type, name, &p2 ) == false)
return false;
break;
case TK_VECTOR:
{
vector_t vVal;
if ( m_ie->I_GetVector( m_ownerID, type, name, vVal ) == false)
return false;
Com_sprintf( tempString2, sizeof(tempString2), "%.3f %.3f %.3f", vVal[0], vVal[1], vVal[2] );
p2 = (char *) tempString2;
}
break;
}
break;
}
case ID_RANDOM:
{
float min, max;
//FIXME: This will not account for nested random() statements
min = *(float *) block->GetMemberData( memberNum++ );
max = *(float *) block->GetMemberData( memberNum++ );
//A float value is returned from the function
t2 = TK_FLOAT;
Com_sprintf( tempString2, sizeof(tempString2), "%.3f", m_ie->I_Random( min, max ) );
p2 = (char *) tempString2;
}
break;
case ID_TAG:
{
char *name;
float type;
name = (char *) block->GetMemberData( memberNum++ );
type = *(float *) block->GetMemberData( memberNum++ );
t2 = TK_VECTOR;
//TODO: Emit warning
if ( m_ie->I_GetTag( m_ownerID, name, (int) type, vec ) == false)
{
m_ie->I_DPrintf( WL_ERROR, "Unable to find tag \"%s\"!\n", name );
return false;
}
Com_sprintf( tempString2, sizeof(tempString2), "%.3f %.3f %.3f", vec[0], vec[1], vec[2] );
p2 = (char *) tempString2;
break;
}
default:
//FIXME: Make an enum id for the error...
m_ie->I_DPrintf( WL_ERROR, "Invalid parameter type on conditional" );
return false;
break;
}
return m_ie->I_Evaluate( t1, p1, t2, p2, oper );
}
/*
========================
CheckIf
Checks for if statement pre-processing
========================
*/
void CSequencer::CheckIf( CBlock **command )
{
CBlock *block = *command;
int successID, failureID;
CSequence *successSeq, *failureSeq;
if ( block == NULL )
return;
if ( block->GetBlockID() == ID_IF )
{
int ret = EvaluateConditional( block );
if ( ret /*TRUE*/ )
{
if ( block->HasFlag( BF_ELSE ) )
{
successID = (int) (*(float *) block->GetMemberData( block->GetNumMembers() - 2 ));
}
else
{
successID = (int) (*(float *) block->GetMemberData( block->GetNumMembers() - 1 ));
}
successSeq = GetSequence( successID );
//TODO: Emit warning
assert( successSeq );
if ( successSeq == NULL )
{
m_ie->I_DPrintf( WL_ERROR, "Unable to find conditional success sequence!\n" );
*command = NULL;
return;
}
//Only save the conditional statement if the calling sequence is retained
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
m_curSequence = successSeq;
//Recursively work out any other pre-processors
*command = PopCommand( POP_BACK );
Prep( command );
return;
}
if ( ( ret == false ) && ( block->HasFlag( BF_ELSE ) ) )
{
failureID = (int) (*(float *) block->GetMemberData( block->GetNumMembers() - 1 ));
failureSeq = GetSequence( failureID );
//TODO: Emit warning
assert( failureSeq );
if ( failureSeq == NULL )
{
m_ie->I_DPrintf( WL_ERROR, "Unable to find conditional failure sequence!\n" );
*command = NULL;
return;
}
//Only save the conditional statement if the calling sequence is retained
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
m_curSequence = failureSeq;
//Recursively work out any other pre-processors
*command = PopCommand( POP_BACK );
Prep( command );
return;
}
//Only save the conditional statement if the calling sequence is retained
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
//Conditional failed, just move on to the next command
*command = PopCommand( POP_BACK );
Prep( command );
return;
}
if ( ( block->GetBlockID() == ID_BLOCK_END ) && ( m_curSequence->HasFlag( SQ_CONDITIONAL ) ) )
{
assert( m_curSequence->GetReturn() );
if ( m_curSequence->GetReturn() == NULL )
{
*command = NULL;
return;
}
//Check to retain it
if ( m_curSequence->GetParent()->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
//Back out of the conditional and resume the previous sequence
m_curSequence = ReturnSequence( m_curSequence );
//This can safely happen
if ( m_curSequence == NULL )
{
*command = NULL;
return;
}
*command = PopCommand( POP_BACK );
Prep( command );
}
}
/*
========================
CheckLoop
Checks for loop command pre-processing
========================
*/
void CSequencer::CheckLoop( CBlock **command )
{
CBlockMember *bm;
CBlock *block = *command;
float min, max;
int iterations;
int loopID;
int memberNum = 0;
if ( block == NULL )
return;
//Check for a loop
if ( block->GetBlockID() == ID_LOOP )
{
//Get the loop ID
bm = block->GetMember( memberNum++ );
if ( bm->GetID() == ID_RANDOM )
{
//Parse out the random number
min = *(float *) block->GetMemberData( memberNum++ );
max = *(float *) block->GetMemberData( memberNum++ );
iterations = (int) m_ie->I_Random( min, max );
}
else
{
iterations = (int) (*(float *) bm->GetData());
}
loopID = (int) (*(float *) block->GetMemberData( memberNum++ ));
CSequence *loop = GetSequence( loopID );
//TODO: Emit warning
assert( loop );
if ( loop == NULL )
{
m_ie->I_DPrintf( WL_ERROR, "Unable to find 'loop' sequence!\n" );
*command = NULL;
return;
}
assert( loop->GetParent() );
if ( loop->GetParent() == NULL )
{
*command = NULL;
return;
}
//Restore the count if it has been lost
loop->SetIterations( iterations );
//Only save the loop command if the calling sequence is retained
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
m_curSequence = loop;
//Recursively work out any other pre-processors
*command = PopCommand( POP_BACK );
Prep( command );
return;
}
//Check for the end of the loop
if ( ( block->GetBlockID() == ID_BLOCK_END ) && ( m_curSequence->HasFlag( SQ_LOOP ) ) )
{
//We don't want to decrement -1
if ( m_curSequence->GetIterations() > 0 )
m_curSequence->SetIterations( m_curSequence->GetIterations()-1 ); //Nice, eh?
//Either there's another iteration, or it's infinite
if ( m_curSequence->GetIterations() != 0 )
{
//Another iteration is going to happen, so this will need to be considered again
PushCommand( block, PUSH_FRONT );
*command = PopCommand( POP_BACK );
Prep( command );
return;
}
else
{
assert( m_curSequence->GetReturn() );
if ( m_curSequence->GetReturn() == NULL )
{
*command = NULL;
return;
}
//Check to retain it
if ( m_curSequence->GetParent()->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
//Back out of the loop and resume the previous sequence
m_curSequence = ReturnSequence( m_curSequence );
//This can safely happen
if ( m_curSequence == NULL )
{
*command = NULL;
return;
}
*command = PopCommand( POP_BACK );
Prep( command );
}
}
}
/*
========================
CheckFlush
Checks for flush command pre-processing
========================
*/
void CSequencer::CheckFlush( CBlock **command )
{
CBlock *block = *command;
if ( block == NULL )
return;
if ( block->GetBlockID() == ID_FLUSH )
{
//Flush the sequence
Flush( m_curSequence );
//Check to retain it
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
*command = PopCommand( POP_BACK );
Prep( command );
return;
}
}
/*
========================
CheckAffect
Checks for affect command pre-processing
========================
*/
void CSequencer::CheckAffect( CBlock **command )
{
CBlock *block = *command;
sharedEntity_t *ent = NULL;
char *entname = NULL;
int memberNum = 0;
if ( block == NULL )
{
return;
}
if ( block->GetBlockID() == ID_AFFECT )
{
CSequencer *sequencer = NULL;
entname = (char*) block->GetMemberData( memberNum++ );
ent = m_ie->I_GetEntityByName( entname );
if( !ent ) // if there wasn't a valid entname in the affect, we need to check if it's a get command
{
//try to parse a 'get' command that is embeded in this 'affect'
int id;
char *p1 = NULL;
char *name = 0;
CBlockMember *bm = NULL;
//
// Get the first parameter (this should be the get)
//
bm = block->GetMember( 0 );
id = bm->GetID();
switch ( id )
{
// these 3 cases probably aren't necessary
case TK_STRING:
case TK_IDENTIFIER:
case TK_CHAR:
p1 = (char *) bm->GetData();
break;
case ID_GET:
{
int type;
//get( TYPE, NAME )
type = (int) (*(float *) block->GetMemberData( memberNum++ ));
name = (char *) block->GetMemberData( memberNum++ );
switch ( type ) // what type are they attempting to get
{
case TK_STRING:
//only string is acceptable for affect, store result in p1
if ( m_ie->I_GetString( m_ownerID, type, name, &p1 ) == false)
{
return;
}
break;
default:
//FIXME: Make an enum id for the error...
m_ie->I_DPrintf( WL_ERROR, "Invalid parameter type on affect _1" );
return;
break;
}
break;
}
default:
//FIXME: Make an enum id for the error...
m_ie->I_DPrintf( WL_ERROR, "Invalid parameter type on affect _2" );
return;
break;
}//end id switch
if(p1)
{
ent = m_ie->I_GetEntityByName( p1 );
}
if(!ent)
{ // a valid entity name was not returned from the get command
m_ie->I_DPrintf( WL_WARNING, "'%s' : invalid affect() target\n");
}
} // end if(!ent)
if( ent )
{
sequencer = gSequencers[ent->s.number];//ent->sequencer;
}
if(memberNum == 0)
{ //there was no get, increment manually before next step
memberNum++;
}
int type = (int) (*(float *) block->GetMemberData( memberNum ));
int id = (int) (*(float *) block->GetMemberData( memberNum+1 ));
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
//NOTENOTE: If this isn't found, continue on to the next command
if ( sequencer == NULL )
{
*command = PopCommand( POP_BACK );
Prep( command );
return;
}
sequencer->Affect( id, type );
*command = PopCommand( POP_BACK );
Prep( command );
if( ent )
{ // ents need to update upon being affected
//ent->taskManager->Update();
gTaskManagers[ent->s.number]->Update();
}
return;
}
if ( ( block->GetBlockID() == ID_BLOCK_END ) && ( m_curSequence->HasFlag( SQ_AFFECT ) ) )
{
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
m_curSequence = ReturnSequence( m_curSequence );
if ( m_curSequence == NULL )
{
*command = NULL;
return;
}
*command = PopCommand( POP_BACK );
Prep( command );
if( ent )
{ // ents need to update upon being affected
//ent->taskManager->Update();
gTaskManagers[ent->s.number]->Update();
}
}
}
/*
-------------------------
CheckDo
-------------------------
*/
void CSequencer::CheckDo( CBlock **command )
{
CBlock *block = *command;
if ( block == NULL )
return;
if ( block->GetBlockID() == ID_DO )
{
//Get the sequence
const char *groupName = (const char *) block->GetMemberData( 0 );
CTaskGroup *group = m_taskManager->GetTaskGroup( groupName );
CSequence *sequence = GetTaskSequence( group );
//TODO: Emit warning
assert( group );
if ( group == NULL )
{
//TODO: Give name/number of entity trying to execute, too
m_ie->I_DPrintf( WL_ERROR, "ICARUS Unable to find task group \"%s\"!\n", groupName );
*command = NULL;
return;
}
//TODO: Emit warning
assert( sequence );
if ( sequence == NULL )
{
//TODO: Give name/number of entity trying to execute, too
m_ie->I_DPrintf( WL_ERROR, "ICARUS Unable to find task 'group' sequence!\n", groupName );
*command = NULL;
return;
}
//Only save the loop command if the calling sequence is retained
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
//Set this to our current sequence
sequence->SetReturn( m_curSequence );
m_curSequence = sequence;
group->SetParent( m_curGroup );
m_curGroup = group;
//Mark all the following commands as being in the task
m_taskManager->MarkTask( group->GetGUID(), TASK_START );
//Recursively work out any other pre-processors
*command = PopCommand( POP_BACK );
Prep( command );
return;
}
if ( ( block->GetBlockID() == ID_BLOCK_END ) && ( m_curSequence->HasFlag( SQ_TASK ) ) )
{
if ( m_curSequence->HasFlag( SQ_RETAIN ) )
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
*command = NULL;
}
m_taskManager->MarkTask( m_curGroup->GetGUID(), TASK_END );
m_curGroup = m_curGroup->GetParent();
CSequence *returnSeq = ReturnSequence( m_curSequence );
m_curSequence->SetReturn( NULL );
m_curSequence = returnSeq;
if ( m_curSequence == NULL )
{
*command = NULL;
return;
}
*command = PopCommand( POP_BACK );
Prep( command );
}
}
/*
========================
Prep
Handles internal sequencer maintenance
========================
*/
void CSequencer::Prep( CBlock **command )
{
//Check all pre-processes
CheckAffect( command );
CheckFlush( command );
CheckLoop( command );
CheckRun( command );
CheckIf( command );
CheckDo( command );
}
/*
========================
Prime
Starts communication between the task manager and this sequencer
========================
*/
int CSequencer::Prime( CTaskManager *taskManager, CBlock *command )
{
Prep( &command );
if ( command )
{
taskManager->SetCommand( command, PUSH_BACK );
}
return SEQ_OK;
}
/*
========================
Callback
Handles a completed task and returns a new task to be completed
========================
*/
int CSequencer::Callback( CTaskManager *taskManager, CBlock *block, int returnCode )
{
CBlock *command;
if (returnCode == TASK_RETURN_COMPLETE)
{
//There are no more pending commands
if ( m_curSequence == NULL )
{
delete block;
block = NULL;
return SEQ_OK;
}
//Check to retain the command
if ( m_curSequence->HasFlag( SQ_RETAIN ) ) //This isn't true for affect sequences...?
{
PushCommand( block, PUSH_FRONT );
}
else
{
delete block;
block = NULL;
}
//Check for pending commands
if ( m_curSequence->GetNumCommands() <= 0 )
{
if ( m_curSequence->GetReturn() == NULL)
return SEQ_OK;
m_curSequence = m_curSequence->GetReturn();
}
command = PopCommand( POP_BACK );
Prep( &command );
if ( command )
taskManager->SetCommand( command, PUSH_FRONT );
return SEQ_OK;
}
//FIXME: This could be more descriptive
m_ie->I_DPrintf( WL_ERROR, "command could not be called back\n" );
assert(0);
return SEQ_FAILED;
}
/*
-------------------------
Recall
-------------------------
*/
int CSequencer::Recall( void )
{
CBlock *block = NULL;
if (!m_taskManager)
{ //uh.. ok.
assert(0);
return true;
}
while ( ( block = m_taskManager->RecallTask() ) != NULL )
{
if (m_curSequence)
{
PushCommand( block, PUSH_BACK );
}
else
{
delete block;
block = NULL;
}
}
return true;
}
/*
-------------------------
Affect
-------------------------
*/
int CSequencer::Affect( int id, int type )
{
CSequence *sequence = GetSequence( id );
if ( sequence == NULL )
{
return SEQ_FAILED;
}
switch ( type )
{
case TYPE_FLUSH:
//Get rid of all old code
Flush( sequence );
sequence->RemoveFlag( SQ_PENDING, true );
m_curSequence = sequence;
Prime( m_taskManager, PopCommand( POP_BACK ) );
break;
case TYPE_INSERT:
Recall();
sequence->SetReturn( m_curSequence );
sequence->RemoveFlag( SQ_PENDING, true );
m_curSequence = sequence;
Prime( m_taskManager, PopCommand( POP_BACK ) );
break;
default:
m_ie->I_DPrintf( WL_ERROR, "unknown affect type found" );
break;
}
return SEQ_OK;
}
/*
========================
PushCommand
Pushes a commands onto the current sequence
========================
*/
int CSequencer::PushCommand( CBlock *command, int flag )
{
//Make sure everything is ok
assert( m_curSequence );
if ( m_curSequence == NULL )
return SEQ_FAILED;
m_curSequence->PushCommand( command, flag );
m_numCommands++;
//Invalid flag
return SEQ_OK;
}
/*
========================
PopCommand
Pops a command off the current sequence
========================
*/
CBlock *CSequencer::PopCommand( int flag )
{
//Make sure everything is ok
assert( m_curSequence );
if ( m_curSequence == NULL )
return NULL;
CBlock *block = m_curSequence->PopCommand( flag );
if ( block != NULL )
m_numCommands--;
return block;
}
/*
========================
StripExtension
Filename ultility. Probably get rid of this if I decided to use CStrings...
========================
*/
void CSequencer::StripExtension( const char *in, char *out )
{
int i = strlen(in) + 1;
while ( (in[i] != '.') && (i >= 0) )
i--;
if ( i < 0 )
{
strcpy(out, in);
return;
}
strncpy(out, in, i);
}
/*
-------------------------
RemoveSequence
-------------------------
*/
//NOTENOTE: This only removes references to the sequence, IT DOES NOT FREE THE ALLOCATED MEMORY! You've be warned! =)
int CSequencer::RemoveSequence( CSequence *sequence )
{
CSequence *temp;
int numChildren = sequence->GetNumChildren();
//Add all the children
for ( int i = 0; i < numChildren; i++ )
{
temp = sequence->GetChildByIndex( i );
//TODO: Emit warning
assert( temp );
if ( temp == NULL )
{
m_ie->I_DPrintf( WL_WARNING, "Unable to find child sequence on RemoveSequence call!\n" );
continue;
}
//Remove the references to this sequence
temp->SetParent( NULL );
temp->SetReturn( NULL );
}
return SEQ_OK;
}
int CSequencer::DestroySequence( CSequence *sequence )
{
if ( !sequence )
return SEQ_FAILED;
//m_sequenceMap.erase( sequence->GetID() );
m_sequences.remove( sequence );
taskSequence_m::iterator tsi;
for ( tsi = m_taskSequences.begin(); tsi != m_taskSequences.end(); )
{
if((*tsi).second == sequence)
{
#ifdef _WIN32
tsi = m_taskSequences.erase(tsi);
#else
taskSequence_m::iterator itTemp = tsi;
++tsi;
m_taskSequences.erase(itTemp);
#endif
}
else
{
++tsi;
}
}
CSequence* parent = sequence->GetParent();
if ( parent )
{
parent->RemoveChild( sequence );
parent = NULL;
}
int curChild = sequence->GetNumChildren();
while( curChild )
{
// Stop if we're about to go negative (invalid index!).
if ( curChild > 0 )
{
DestroySequence( sequence->GetChildByIndex( --curChild ) );
}
else
break;
}
m_owner->DeleteSequence( sequence );
return SEQ_OK;
}
/*
-------------------------
ReturnSequence
-------------------------
*/
inline CSequence *CSequencer::ReturnSequence( CSequence *sequence )
{
while ( sequence->GetReturn() )
{
assert(sequence != sequence->GetReturn() );
if ( sequence == sequence->GetReturn() )
return NULL;
sequence = sequence->GetReturn();
if ( sequence->GetNumCommands() > 0 )
return sequence;
}
return NULL;
}
//Save / Load
/*
-------------------------
Save
-------------------------
*/
int CSequencer::Save( void )
{
#if 0 //asfsfasadf
sequence_l::iterator si;
taskSequence_m::iterator ti;
int numSequences = 0, id, numTasks;
//Get the number of sequences to save out
numSequences = m_sequences.size();
//Save out the owner sequence
m_ie->I_WriteSaveData( 'SQRE', &m_ownerID, sizeof( m_ownerID ) );
//Write out the number of sequences we need to read
m_ie->I_WriteSaveData( 'SQR#', &numSequences, sizeof( numSequences ) );
//Second pass, save out all sequences, in order
STL_ITERATE( si, m_sequences )
{
id = (*si)->GetID();
m_ie->I_WriteSaveData( 'SQRI', &id, sizeof( id ) );
}
//Save out the taskManager
m_taskManager->Save();
//Save out the task sequences mapping the name to the GUIDs
numTasks = m_taskSequences.size();
m_ie->I_WriteSaveData( 'SQT#', &numTasks, sizeof ( numTasks ) );
STL_ITERATE( ti, m_taskSequences )
{
//Save the task group's ID
id = ((*ti).first)->GetGUID();
m_ie->I_WriteSaveData( 'STID', &id, sizeof( id ) );
//Save the sequence's ID
id = ((*ti).second)->GetID();
m_ie->I_WriteSaveData( 'SSID', &id, sizeof( id ) );
}
int curGroupID = ( m_curGroup == NULL ) ? -1 : m_curGroup->GetGUID();
m_ie->I_WriteSaveData( 'SQCT', &curGroupID, sizeof ( m_numCommands ) );
//Output the number of commands
m_ie->I_WriteSaveData( 'SQ#C', &m_numCommands, sizeof ( m_numCommands ) ); //FIXME: This can be reconstructed
//Output the ID of the current sequence
id = ( m_curSequence != NULL ) ? m_curSequence->GetID() : -1;
m_ie->I_WriteSaveData( 'SQCS', &id, sizeof ( id ) );
return true;
#endif
return false;
}
/*
-------------------------
Load
-------------------------
*/
int CSequencer::Load( void )
{
#if 0 //asfsfasadf
//Get the owner of this sequencer
m_ie->I_ReadSaveData( 'SQRE', &m_ownerID, sizeof( m_ownerID ) );
//Link the entity back to the sequencer
m_ie->I_LinkEntity( m_ownerID, this, m_taskManager );
CTaskGroup *taskGroup;
CSequence *seq;
int numSequences, seqID, taskID, numTasks;
//Get the number of sequences to read
m_ie->I_ReadSaveData( 'SQR#', &numSequences, sizeof( numSequences ) );
//Read in all the sequences
for ( int i = 0; i < numSequences; i++ )
{
m_ie->I_ReadSaveData( 'SQRI', &seqID, sizeof( seqID ) );
seq = m_owner->GetSequence( seqID );
assert( seq );
STL_INSERT( m_sequences, seq );
m_sequenceMap[ seqID ] = seq;
}
//Setup the task manager
m_taskManager->Init( this );
//Load the task manager
m_taskManager->Load();
//Get the number of tasks in the map
m_ie->I_ReadSaveData( 'SQT#', &numTasks, sizeof( numTasks ) );
//Read in, and reassociate the tasks to the sequences
for ( i = 0; i < numTasks; i++ )
{
//Read in the task's ID
m_ie->I_ReadSaveData( 'STID', &taskID, sizeof( taskID ) );
//Read in the sequence's ID
m_ie->I_ReadSaveData( 'SSID', &seqID, sizeof( seqID ) );
taskGroup = m_taskManager->GetTaskGroup( taskID );
assert( taskGroup );
seq = m_owner->GetSequence( seqID );
assert( seq );
//Associate the values
m_taskSequences[ taskGroup ] = seq;
}
int curGroupID;
//Get the current task group
m_ie->I_ReadSaveData( 'SQCT', &curGroupID, sizeof( curGroupID ) );
m_curGroup = ( curGroupID == -1 ) ? NULL : m_taskManager->GetTaskGroup( curGroupID );
//Get the number of commands
m_ie->I_ReadSaveData( 'SQ#C', &m_numCommands, sizeof( m_numCommands ) );
//Get the current sequence
m_ie->I_ReadSaveData( 'SQCS', &seqID, sizeof( seqID ) );
m_curSequence = ( seqID != -1 ) ? m_owner->GetSequence( seqID ) : NULL;
return true;
#endif
return false;
}
| gpl-2.0 |
plamzi/Havoc | components/char.js | 12164 | /* Havoc (c) 2014 */
/* Char contains methods and properties intrinsic to characters.
* It can be extended by adding modules named "char.something.js".
* If you are adding commands (actions, skills, etc), look at act.js instead. */
var u = require('util');
var fs = require('fs');
var events = require('events');
var Seq = require('sequelize');
jsdom = require('jsdom');
addStrings({
eng: {
}
});
var char_struct = {
name: Seq.STRING,
level: Seq.INTEGER,
class: Seq.STRING,
trade: Seq.STRING,
sex: Seq.STRING,
attr: {
type: Seq.TEXT,
get: function() {
return eval('('+this.getDataValue('attr')+')');
},
set: function(v) {
this.setDataValue('attr', stringify(v));
}
},
points: {
type: Seq.TEXT,
get: function() {
return eval('('+this.getDataValue('points')+')');
},
set: function(v) {
this.setDataValue('points', stringify(v));
},
allowNull: false
},
at: {
type: Seq.STRING,
get: function() {
return eval('('+this.getDataValue('at')+')');
},
set: function(v) {
this.setDataValue('at', stringify(v));
}
}
};
var char_attr_default = {
pref: {},
aff: {}
};
var char_points_default = {
hit: 100,
maxhit: 100,
mana: 100,
maxmana: 100,
stamina: 100,
maxstamina: 100,
exp: 0,
gold: 0
};
var proc_struct = {
type: Seq.STRING,
name: Seq.STRING,
func: Seq.TEXT
};
var proc_link_struct = {
ProcId: Seq.INTEGER,
MobProtoId: Seq.INTEGER,
ItemProtoId: Seq.INTEGER,
RoomId: Seq.INTEGER,
CharId: Seq.INTEGER,
};
module.exports = {
init: function(re) {
debug('char.init');
havoc.register('char', 'plugin.change', this.reloadPlugin);
user.register('char', 'create.pc', this.createChar);
user.register('char', 'enter', function(ch) { /* PC entry from lobby */
char.initChar(ch);
char.validateChar(ch);
});
server.register('char', 'end', function(s) {
if (s.ch)
char.emit('exit', s.ch);
});
char.initPlugins(re);
user.register('char', 'init', function() {
log('char received init from user');
char.initDB();
});
item.register('char', 'init', function() {
char.initMobInstances();
});
if (re)
char.initDB(re);
},
updateActors: function() {
debug('char.updateActors: re-init existing online actors');
var a = char.getActors();
for (var i in a) {
char.initChar(a[i], 1);
if (a[i].pc())
debug('updated '+a[i].name);
}
},
initDB: function(re) {
debug('char.initDB');
Char = db.define('Chars', char_struct);
MobProto = db.define('MobProto', char_struct);
Mob = db.define('Mobs', char_struct, { timestamps: 0 });
Proc = db.define('Procs', proc_struct, { timestamps: 0 });
ProcLink = db.define('ProcLinks', proc_link_struct, { timestamps: 0 });
User.hasMany(Char, { as: 'chars' });
Char.belongsTo(User);
Char.hasMany(Mob, { as: 'mobs' });
Mob.belongsTo(Char); /* npc followers */
MobProto.hasMany(Mob);
Mob.belongsTo(MobProto);
MobProto.belongsToMany(Proc, { through: ProcLink, as : 'procs' });
Proc.belongsToMany(MobProto, { through: ProcLink });
/* future ability to proc PC's. we can use this for advanced behavior automation e. g. */
//Char.belongsToMany(Proc, { as: 'procs', through: ProcLink });
//Proc.belongsToMany(Char, { through: ProcLink });
char.emit('init'); /* item is listening for char init */
},
initPlugins: function(re) {
debug('char.initPlugins');
var plugins = fs.readdirSync('./plugins').filter(function(i) { return i.match(/^char\..+\.js$/i); });
log('char component detected plugins: ' + plugins.join(', '));
for (var i in plugins) {
var f = './plugins/'+plugins[i];
delete require.cache[require.resolve('../'+f)];
var p = require('../'+f);
if (p.init)
p.init(re), delete p.init;
point(char.instanceMethods, p);
log('loaded: ' + f.color('&155') + ' ' + Object.keys(p).join(', ').font('size=10'));
}
if (re)
this.updateActors();
},
reloadPlugin: function(comp, f) {
if (comp != char)
return;
debug('char.reloadPlugin');
char.initPlugins(1); /* call with reload = true */
},
initMobInstances: function() {
//Mob.sync();
Mob.findAll({
include: [{ model: Item, as: 'items', order: "location" }]
})
.then(function(r) {
if (!r) {
info('char.initMobInstances: no mob instances defined');
my().mobs = [];
return;
}
if (my().mobs) {
for (var i in r) {
point(r[i], char.instanceMethods);
char.initProcs(r[i]);
}
return info('char.initMobInstances: mob instances already loaded, updated procs only');
}
my().mobs = r;
for (var i = 0; i < r.length; i++) {
/* set all necessary props without delay */
char.initChar(r[i]);
char.initProcs(r[i]);
/* distribute mob instance timers over time so they would not cluster up */
after((i * 50) / 1000,
function(r, i) {
return function() {
char.initTimers(r[i]);
if (i == r.length - 1)
info('char.initMobInstances: finished distributing mob instance timers');
};
}(r, i)
);
}
info('char.initMobInstances: loaded mob instances ' + r.length);
})
.then(char.loadUniqueMobs)
.then(char.loadSimpleMobs)
.then(function() {
havoc.emit('ready'); /* this is the signal to open the game for connections */
});
},
createChar: function(s) {
debug('char.createChar (PC)');
Char.create({
name: s.create.name,
class: s.create.cls,
sex: s.create.sex.toLowerCase(),
trade: 'Adventurer',
level: 1,
attr: { aff: {}, bg: s.create.bg || 'none', pref: {} },
points: char_points_default,
at: config.game.start,
UserId: s.user.id,
GuildId: s.user.attr.guild ? s.user.attr.guild.id : null
})
.then(function(ch) {
s.user.getChars().then(function(r) {
s.user.chars = r;
char.emit('create.pc', ch);
return user.lobby(s);
});
});
delete s.create, delete s.next;
},
validateChar: function(ch) {
ch.user = ch.s.user;
var ss = my().sockets;
for (var i in ss) {
if (ss[i].ch && ss[i].user.id == ch.s.user.id && ss[i] != ch.s) {
if (ss[i].ch.id == ch.id) {
ss[i].send(my().RECONNECTING_CHAR);
info('reconnecting socket (same char) ', ss[i]);
server.closeSocket(ss[i]);
}
else
if (!config.game.allowMultipleCharacters && !ch.immo()) {
ss[i].send(my().RECONNECTING);
info('reconnecting socket (same user) ', ss[i]);
server.closeSocket(ss[i]);
}
}
}
/* User's character's may have changed while in lobby. For example, if dismissed from a guild */
Char.findAll({
where: { UserId: ch.s.user.id }
})
.then(function(r) {
ch.s.user.chars = r;
});
},
initChar: function(ch, re) {
if (!re) {
/* turn all ch instances into event emitters */
ch.__proto__.__proto__.__proto__ = events.EventEmitter.prototype;
ch.setMaxListeners(100);
/* shim the default event emit method so we can chain it */
ch._emit = ch.emit;
}
/* assign instance methods */
point(ch, char.instanceMethods);
/* init all regen and pulse timers */
char.initTimers(ch);
/* we don't have to do this if we don't use ch.do lazily during enter */
delete ch.next;
/* first emit enter to initialize basic/common character properties */
char.emit('enter', ch);
char.emit(ch.pc() ? 'enter.pc' : 'enter.npc', ch);
},
initTimers: function(ch) {
if (ch.intervals) {
//if (ch.npc())
//return;
this.clearTimers(ch);
}
ch.intervals = [], ch.timeouts = [];
ch.intervals.add(
setInterval(function() { ch.save(); }, ( ch.pc()?60:180 ) * 1000)
);
ch.intervals.add(
setInterval(function() { ch.gain('hit', 1); }, 12 * 1000)
);
ch.intervals.add(
setInterval(function() { ch.gain('mana', 1); }, 13 * 1000)
);
ch.intervals.add(
setInterval(function() { ch.gain('stamina', 1); }, 24 * 1000)
);
ch.intervals.add(
setInterval(function() { ch.emit('proc.pulse'); }, 40 * 1000)
);
},
clearTimers: function(ch) {
for (var i in ch.intervals)
clearInterval(ch.intervals[i]);
for (var i in ch.timeouts)
clearTimeout(ch.timeouts[i]);
},
createMob: function(o, cb) {
debug('char.createMob (instance)');
//dump(o);
if (!cb)
warning('char.createMob called with no callback. this is normal for auto-spawning');
if (typeof o == 'string')
o = char.protoByName(o);
else
if (typeof o == 'number')
o = my().mobproto[o];
if (!o)
return error('char.createMob could not locate mob proto for: ' + stringify(o));
o = o.values || o;
if (o.id)
o.MobProtoId = o.id, delete o.id;
if (o.at) {
if (o.at.pop) /* if proto at is an array, pick a random position for the mob instance */
o.at = o.at.one();
if (o.at.terrain) /* if terrain specified, pick a random terrain tile */
o.at = world.getRandomByTerrain(o.at);
}
Mob.create(o).then(function(ch) {
my().mobs.push(ch);
char.initChar(ch);
char.initProcs(ch);
char.emit('create.npc', ch);
!cb || cb(ch);
});
},
initProcs: function(ch) {
if (!ch) {
for (var i in my().mobs)
char.initProcs(my().mobs[i]);
return;
}
var procs;
if (!ch.getProto)
return warning('char.initProcs: no getProto method on ' + ch.name);
if (!(procs = ch.getProto().procs))
return;
if (ch.unique())
info('char.initProcs assigning procs to '+ ch.name);
for (var i in procs) {
try {
var p = procs[i];
ch.register('mob' + ch.MobProtoId, 'proc.' + p.type, eval('('+p.func + ')'));
if (ch.unique())
info(p.name + ' proc.' + p.type + ' added to unique mob: ' + ch.name);
} catch(ex) {
warning(ex);
}
}
},
destroyMob: function(ch, cb) {
my().mobs.remove(ch);
ch.fromRoom().destroy().then(function() {
!cb || cb();
});
},
destroy: function() {
this.destroyMob.apply(this, arguments);
},
/* resets certain properties of a mob instance to the values of their prototype, useful during rapid content creation cycles */
resetMob: function(ch) {
var p = ch.getProto();
if (p) {
dump(p.values);
ch.updateAttributes({
class: p.class,
trade: p.trade,
points: p.points,
attr: p.attr
});
}
},
resetMobs: function() {
for (var i in my().mobs)
char.resetMob(my().mobs[i]);
},
getProto: function(a) {
return my().mobproto[a.MobProtoId];
},
protoByName: function(a) {
var mp = my().mobproto;
for (var i in mp)
if (mp[i].name.toLowerCase() == a.toLowerCase())
return mp[i];
return null;
},
protoIdByName: function(a) {
var mp = char.protoByName(a);
return mp?mp.id:null;
},
loadUniqueMobs: function() {
debug('char.loadUniqueMobs: loading unique mobs, if needed');
var r = my().mobproto;
var mobs = my().mobs;
for (var i in r) {
if (r[i].attr.max == 1) {
var found = mobs.filter(function(M) { return M.MobProtoId == r[i].id; });
if (!found.length) {
char.createMob(r[i].values, function() {
char.emit('create.npcs'); /* this will tip off act.info to re-index instances */
});
info('char.loadUniqueMobs: spawned unique mob ' + r[i].name);
}
}
}
},
loadSimpleMobs: function() {
debug('char.loadSimpleMobs: spawning simple mob instances, if under max');
var r = my().mobproto;
var mobs = my().mobs;
for (var i in r) {
if (r[i].attr.max > 1) {
var n = mobs.filter(function(M) { return M.MobProtoId == r[i].id; }).length;
while (n < r[i].attr.max) {
if (++n == r[i].attr.max)
char.createMob(r[i].values, function() {
char.emit('create.npcs'); /* this will tip off act.info to re-index instances on last spawn */
});
else
char.createMob(r[i].values);
}
}
}
},
getActors: function() {
var a = [], ss = my().sockets;
for (var i in ss)
if (ss[i].ch)
a.push(ss[i].ch);
return my().mobs?a.concat(my().mobs):a;
},
getStruct: function() {
return char_struct;
},
instanceMethods: {
emit: function() {
this._emit.apply(this, arguments);
return this;
}
}
}; | gpl-2.0 |
trasher/glpi | inc/softwarelicensetype.class.php | 1643 | <?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2021 Teclib' and contributors.
*
* http://glpi-project.org
*
* based on GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2003-2014 by the INDEPNET Development Team.
*
* ---------------------------------------------------------------------
*
* LICENSE
*
* This file is part of GLPI.
*
* GLPI 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.
*
* GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
/// Class SoftwareLicenseType
class SoftwareLicenseType extends CommonTreeDropdown {
public $can_be_translated = true;
static function getTypeName($nb = 0) {
return _n('License type', 'License types', $nb);
}
static function getFieldLabel() {
return _n('Type', 'Types', 1);
}
static function getIcon() {
return SoftwareLicense::getIcon();
}
}
| gpl-2.0 |
mayomm/YKB | wp-content/plugins/slider-cc/public/templates/carousel-light/preview.php | 2179 | <section class="ccs-wrapper" style="width: 740px; margin:0 auto">
<div class="ccs-wrapper carouselcc arrows-xs scc-wrapper scc-mode-carousel light" style="opacity: 1; transition: opacity 1000ms; -webkit-transition: opacity 1000ms;">
<div class="scc-viewport" style="height: 237px;">
<ul class="slides" style="transition: transform 1000ms; -webkit-transition: transform 1000ms; width: 2673px; transform: translate3d(0px, 0px, 0px);">
<li class="scc-active" style="width: 356.1px; margin-right: 30px; opacity: 1; display: block; float: left; box-sizing: border-box;">
<img src="<?php echo CHCH_SF_PLUGIN_URL; ?>public/templates/images/placeholder.jpg" alt="Image">
<div class="slidercc-title"><h2>Lorem ipsum dolor sit amet</h2></div>
<div class="slidercc-desc"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer eget <a href="#">turpis accumsan mattis</a>.</p></div>
</li>
<li class="scc-active" style="width: 356.1px; margin-right: 30px; opacity: 1; display: block; float: left; box-sizing: border-box;">
<img src="<?php echo CHCH_SF_PLUGIN_URL; ?>public/templates/images/placeholder.jpg" alt="Image">
<div class="slidercc-title"><h2>Lorem ipsum dolor sit amet</h2></div>
<div class="slidercc-desc"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer eget <a href="#">turpis accumsan mattis</a>.</p></div>
</li>
<li class="scc-active" style="width: 356.1px; margin-right: 30px; opacity: 1; display: block; float: left; box-sizing: border-box;">
<img src="<?php echo CHCH_SF_PLUGIN_URL; ?>public/templates/images/placeholder.jpg" alt="Image">
<div class="slidercc-title"><h2>Lorem ipsum dolor sit amet</h2></div>
<div class="slidercc-desc"><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer eget <a href="#">turpis accumsan mattis</a>.</p></div>
</li>
</ul>
<div class="scc-arrows">
<a href="#" class="scc-prev">Previous slide</a>
<a href="#" class="scc-next">Next slide</a>
</div>
</div>
<div class="scc-pagination">
<a href="#0" class="scc-active">1</a>
<a href="#1">2</a>
<a href="#2">3</a>
</div>
</div>
</section>
| gpl-2.0 |
ibou77/elgg | engine/settings.php | 6383 | <?php
/**
* Defines database credentials.
*
* Most of Elgg's configuration is stored in the database. This file contains the
* credentials to connect to the database, as well as a few optional configuration
* values.
*
* The Elgg installation attempts to populate this file with the correct settings
* and then rename it to settings.php.
*
* @todo Turn this into something we handle more automatically.
* @package Elgg.Core
* @subpackage Configuration
*/
global $CONFIG;
if (!isset($CONFIG)) {
$CONFIG = new \stdClass;
}
/*
* Standard configuration
*
* You will use the same database connection for reads and writes.
* This is the easiest configuration, and will suit 99.99% of setups. However, if you're
* running a really popular site, you'll probably want to spread out your database connections
* and implement database replication. That's beyond the scope of this configuration file
* to explain, but if you know you need it, skip past this section.
*/
/**
* The database username
*
* @global string $CONFIG->dbuser
*/
$CONFIG->dbuser = 'elgguser';
/**
* The database password
*
* @global string $CONFIG->dbpass
*/
$CONFIG->dbpass = 'elggpassword';
/**
* The database name
*
* @global string $CONFIG->dbname
*/
$CONFIG->dbname = 'elgg';
/**
* The database host.
*
* For most installations, this is 'localhost'
*
* @global string $CONFIG->dbhost
*/
$CONFIG->dbhost = 'localhost';
/**
* The database prefix
*
* This prefix will be appended to all Elgg tables. If you're sharing
* a database with other applications, use a database prefix to namespace tables
* in order to avoid table name collisions.
*
* @global string $CONFIG->dbprefix
*/
$CONFIG->dbprefix = '';
/**
* Multiple database connections
*
* Elgg supports master/slave MySQL configurations. The master should be set as
* the 'write' connection and the slave(s) as the 'read' connection(s).
*
* To use, uncomment the below configuration and update for your site.
*/
//$CONFIG->db['split'] = true;
//$CONFIG->db['write']['dbuser'] = "";
//$CONFIG->db['write']['dbpass'] = "";
//$CONFIG->db['write']['dbname'] = "";
//$CONFIG->db['write']['dbhost'] = "";
//$CONFIG->db['read'][0]['dbuser'] = "";
//$CONFIG->db['read'][0]['dbpass'] = "";
//$CONFIG->db['read'][0]['dbname'] = "";
//$CONFIG->db['read'][0]['dbhost'] = "";
//$CONFIG->db['read'][1]['dbuser'] = "";
//$CONFIG->db['read'][1]['dbpass'] = "";
//$CONFIG->db['read'][1]['dbname'] = "";
//$CONFIG->db['read'][1]['dbhost'] = "";
/**
* Memcache setup (optional)
* This is where you may optionally set up memcache.
*
* Requirements:
* 1) One or more memcache servers (http://www.danga.com/memcached/)
* 2) PHP memcache wrapper (http://php.net/manual/en/memcache.setup.php)
*
* Note: Multiple server support is only available on server 1.2.1
* or higher with PECL library > 2.0.0
*/
//$CONFIG->memcache = true;
//
//$CONFIG->memcache_servers = array (
// array('server1', 11211),
// array('server2', 11211)
//);
/**
* Better caching performance
*
* Configuring the location of your data directory and enabling simplecache in
* the settings.php file improves caching performance. It allows Elgg to skip
* connecting to the database when serving cached JavaScript and CSS files. If
* you uncomment and configure these settings, you will not be able to change
* them from the Elgg advanced settings page.
*/
//$CONFIG->dataroot = "";
//$CONFIG->simplecache_enabled = true;
/**
* Cookie configuration
*
* Elgg uses 2 cookies: a PHP session cookie and an extended login cookie
* (also called the remember me cookie). See the PHP manual for documentation on
* each of these parameters. Possible options:
*
* - Set the session name to share the session across applications.
* - Set the path because Elgg is not installed in the root of the web directory.
* - Set the secure option to true if you only serve the site over HTTPS.
* - Set the expire option on the remember me cookie to change its lifetime
*
* To use, uncomment the appropriate sections below and update for your site.
*
* @global array $CONFIG->cookies
*/
// get the default parameters from php.ini
//$CONFIG->cookies['session'] = session_get_cookie_params();
//$CONFIG->cookies['session']['name'] = "Elgg";
// optionally overwrite the defaults from php.ini below
//$CONFIG->cookies['session']['path'] = "/";
//$CONFIG->cookies['session']['domain'] = "";
//$CONFIG->cookies['session']['secure'] = false;
//$CONFIG->cookies['session']['httponly'] = false;
// extended session cookie
//$CONFIG->cookies['remember_me'] = session_get_cookie_params();
//$CONFIG->cookies['remember_me']['name'] = "elggperm";
//$CONFIG->cookies['remember_me']['expire'] = strtotime("+30 days");
// optionally overwrite the defaults from php.ini below
//$CONFIG->cookies['remember_me']['path'] = "/";
//$CONFIG->cookies['remember_me']['domain'] = "";
//$CONFIG->cookies['remember_me']['secure'] = false;
//$CONFIG->cookies['remember_me']['httponly'] = false;
/**
* Use non-standard headers for broken MTAs.
*
* The default header EOL for headers is \r\n. This causes problems
* on some broken MTAs. Setting this to true will cause Elgg to use
* \n, which will fix some problems sending email on broken MTAs.
*
* @global bool $CONFIG->broken_mta
*/
$CONFIG->broken_mta = false;
/**
* Disable the database query cache
*
* Elgg stores each query and its results in a query cache.
* On large sites or long-running scripts, this cache can grow to be
* large. To disable query caching, set this to true.
*
* @global bool $CONFIG->db_disable_query_cache
*/
$CONFIG->db_disable_query_cache = false;
/**
* Minimum password length
*
* This value is used when validating a user's password during registration.
*
* @global int $CONFIG->min_password_length
*/
$CONFIG->min_password_length = 6;
/**
* This is an optional script used to override Elgg's default handling of
* uncaught exceptions.
*
* This should be an absolute file path to a php script that will be called
* any time an uncaught exception is thrown.
*
* The script will have access to the following variables as part of the scope
* global $CONFIG
* $exception - the unhandled exception
*
* @warning - the database may not be available
*
* @global string $CONFIG->exception_include
*/
$CONFIG->exception_include = '';
| gpl-2.0 |
BFH-TI/hpd | hpd-apacheds-interceptors/src/main/java/ch/bfh/i4mi/interceptor/RelationshipChecker.java | 11255 | package ch.bfh.i4mi.interceptor;
import org.apache.directory.api.ldap.model.entry.Attribute;
import org.apache.directory.api.ldap.model.entry.Entry;
import org.apache.directory.api.ldap.model.entry.Value;
import org.apache.directory.api.ldap.model.exception.LdapException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException;
import org.apache.directory.api.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.api.ldap.model.name.Dn;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.interceptor.context.OperationContext;
/**
* The Class RelationshipChecker checks if a change on the relationships is valid.
*
* @author Kevin Tippenhauer, Berner Fachhochschule
*/
public class RelationshipChecker {
/**
* Name of the attribute to check.
*/
private String ownerAttributeName;
/** The member of attribute name. */
private String memberOfAttributeName;
/** The cat attr name. */
private String catAttrName;
/** The cat value for community. */
private String catValueForCommunity;
/** The ou health org rdn. */
private String ouHealthOrgRdn;
/** The ou health pro rdn. */
private String ouHealthProRdn;
/** The op context. */
private OperationContext opContext;
/** The op context entry. */
private Entry opContextEntry;
/** The attribute. */
private Attribute attribute;
/** The Constant LOG. */
// private static final Logger LOG = LoggerFactory
// .getLogger(RelationshipChecker.class);
/**
* Instantiates a new relationship checker.
*
* @param anOwnerAttributeName the an owner attribute name
* @param aMemberOfAttributeName the a member of attribute name
* @param aCatAttrName the a cat attr name
* @param aCatValueForCommunity the a cat value for community
* @param anOuHealthOrgRdn the an ou health org rdn
* @param ouHeathProRdn the ou heath pro rdn
* @param anOperationContext the an operation context
* @param anOpContextEntry the an op context entry
* @param anAttribute the an attribute
* @throws LdapException the ldap exception
*/
RelationshipChecker(final String anOwnerAttributeName,
final String aMemberOfAttributeName, final String aCatAttrName,
final String aCatValueForCommunity, final String anOuHealthOrgRdn,
final String ouHeathProRdn, final OperationContext anOperationContext,
final Entry anOpContextEntry, final Attribute anAttribute) throws LdapException {
this.ownerAttributeName = anOwnerAttributeName;
this.memberOfAttributeName = aMemberOfAttributeName;
this.catAttrName = aCatAttrName;
this.catValueForCommunity = aCatValueForCommunity;
this.ouHealthOrgRdn = anOuHealthOrgRdn;
this.ouHealthProRdn = ouHeathProRdn;
this.opContext = anOperationContext;
this.opContextEntry = anOpContextEntry;
this.attribute = anAttribute;
}
/**
* Check add request.
*
* @throws LdapException the ldap exception
*/
protected final void checkAddRequest() throws LdapException {
if (this.opContextEntry.get(this.memberOfAttributeName).size() > 1) {
// Multiple memberOf values
if (isEntryOfOU(this.opContextEntry, this.ouHealthOrgRdn)) {
// HO and multiple memberOf so it must be a Root-HO
for (Value<?> value : this.attribute) {
Entry ownerOfRelationship = getOwnerOfRelationship(value);
if (!isCommunity(ownerOfRelationship)) {
throw new LdapException(
"Root-HO must not contain any non community relationships. "
+ "Sub-HOs are single value.");
}
}
} else if (isEntryOfOU(this.opContextEntry, this.ouHealthProRdn)) {
// HP
for (Value<?> value : this.attribute) {
Entry ownerOfRelationship = getOwnerOfRelationship(value);
if (!isEntryOfOU(ownerOfRelationship, this.ouHealthOrgRdn)) {
throw new LdapException(
"HPs can only be connected to organizations or a community.");
} else if (isEntryOfOU(ownerOfRelationship,
this.ouHealthOrgRdn)
&& isCommunity(ownerOfRelationship)) {
// Owner is a community not a HO and not the only value.
throw new LdapException(
"Community relationship for HPs is only allowed when there are no "
+ "other relationships.");
}
}
} else {
throw new LdapException(
"Unexpected entry with multiple memberOf values.");
}
} else /*if (this.opContextEntry.get(this.memberOfAttributeName).size() == 1)*/ {
// Single memberOf value
Entry ownerOfRelationship = getOwnerOfRelationship(this.attribute
.get());
if (isEntryOfOU(this.opContextEntry, this.ouHealthOrgRdn)) {
if (!isEntryOfOU(ownerOfRelationship, this.ouHealthOrgRdn)) {
// Entry is connected neither to a HO nor a community.
throw new LdapException(
"HOs must be connected with a HO or communities.");
}
} else if (isEntryOfOU(this.opContextEntry, this.ouHealthProRdn)) {
if (!isEntryOfOU(ownerOfRelationship, this.ouHealthOrgRdn)) {
// Entry is connected neither to a HO nor a community.
throw new LdapException("HPs must be connected with a HO or communities.");
}
} else {
throw new LdapException("Unexpected entry with a single memberOf values.");
}
}
}
/**
* Check modify add request.
*
* @throws LdapException the ldap exception
*/
protected final void checkModifyAddRequest() throws LdapException {
if (this.opContextEntry.get(this.memberOfAttributeName) == null
|| this.opContextEntry.get(this.memberOfAttributeName).size() < 1) {
// Single memberOf value
Entry ownerOfRelationship = getOwnerOfRelationship(this.attribute
.get());
if (isEntryOfOU(this.opContextEntry, this.ouHealthOrgRdn)) {
if (!isEntryOfOU(ownerOfRelationship, this.ouHealthOrgRdn)) {
// Entry is connected neither to a HO nor a
// community.
throw new LdapException(
"HOs must be connected with a HO or communities.");
}
} else if (isEntryOfOU(this.opContextEntry, this.ouHealthProRdn)) {
if (!isEntryOfOU(ownerOfRelationship, this.ouHealthOrgRdn)) {
// Entry is connected neither to a HO nor a
// community.
throw new LdapException(
"HOs must be connected with a HO or communities.");
}
} else {
throw new LdapException(
"Unexpected entry with a single memberOf values.");
}
} else if (this.opContextEntry.get(this.memberOfAttributeName).size() == 1) {
// 1. Check type of the opContextEntry
Entry ownerOfExistingRelationship = getOwnerOfRelationship(this.opContextEntry
.get(this.memberOfAttributeName).get());
if (isCommunity(ownerOfExistingRelationship)) {
// relationship with a community
Entry ownerOfNewRelationship = getOwnerOfRelationship(this.attribute
.get());
if (isEntryOfOU(this.opContextEntry, this.ouHealthOrgRdn)) {
if (!isCommunity(ownerOfNewRelationship)) {
throw new LdapException(
"Root-HO must not contain any non community relationships.");
}
} else if (isEntryOfOU(this.opContextEntry, this.ouHealthProRdn)) {
throw new LdapException(
"Community relationship for HPs is only allowed when there are no "
+ "other relationships.");
}
} else if (isEntryOfOU(this.opContextEntry, this.ouHealthOrgRdn)) {
// relationship is a HO
throw new LdapException(
"Sub-HO can only have one relationship to another Sub-HO or Root-HO");
} else if (isEntryOfOU(this.opContextEntry, this.ouHealthProRdn)) {
if (isCommunity(getOwnerOfRelationship(this.attribute.get()))) {
// The old relationship is to an HO, the new is to a
// community
throw new LdapException(
"Community relationship for HPs is only allowed when there are no "
+ "other relationships.");
}
}
} else {
// if (this.opContextEntry.get(this.memberOfAttributeName).size() >
// 1)
// Is already a multiple
Entry ownerOfRelationship = getOwnerOfRelationship(this.attribute
.get());
if (isEntryOfOU(this.opContextEntry, this.ouHealthOrgRdn)) {
// Is a Root-HO
if (!isCommunity(ownerOfRelationship)) {
throw new LdapException(
"Root-HO must not contain any non community relationships.");
}
} else if (isEntryOfOU(this.opContextEntry, this.ouHealthProRdn)) {
// Is a HPProfessional
if (isCommunity(ownerOfRelationship)) {
throw new LdapException(
"Community relationship for HPs is only allowed when there are no "
+ "other relationships.");
}
}
}
}
/**
* Check modify replace.
*
* @throws LdapException the ldap exception
*/
protected final void checkModifyReplace() throws LdapException {
if (this.opContextEntry.get(this.memberOfAttributeName).size() != 1) {
throw new LdapException(
"RelationshipInterceptor.ReplaceWrongNoOfAttr");
}
// Single memberOf value
Entry ownerOfRelationship = getOwnerOfRelationship(this.attribute.get());
if (isEntryOfOU(this.opContextEntry, this.ouHealthOrgRdn)) {
if (!isEntryOfOU(ownerOfRelationship, this.ouHealthOrgRdn)) {
// Entry is connected neither to a HO nor a
// community.
throw new LdapException(
"HOs must be connected with a HO or communities.");
}
} else if (isEntryOfOU(this.opContextEntry, this.ouHealthProRdn)) {
if (!isEntryOfOU(ownerOfRelationship, this.ouHealthOrgRdn)) {
// Entry is connected neither to a HO nor a
// community.
throw new LdapException(
"HOs must be connected with a HO or communities.");
}
} else {
throw new LdapException(
"Unexpected entry with a single memberOf values.");
}
}
/**
* Checks if is entry of ou.
*
* @param entry the entry
* @param rdnName the rdn name
* @return true, if is entry of ou
*/
private static boolean isEntryOfOU(final Entry entry, final String rdnName) {
if (entry.getDn().getRdn(1).getName().equals(rdnName)) {
return true;
}
return false;
}
/**
* Checks if is community.
*
* @param entry the entry
* @return true, if is community
* @throws LdapInvalidAttributeValueException the ldap invalid attribute value exception
*/
private boolean isCommunity(final Entry entry)
throws LdapInvalidAttributeValueException {
if (entry.get(this.catAttrName) != null
&& entry.get(this.catAttrName).getString()
.equalsIgnoreCase(this.catValueForCommunity)) {
return true;
}
return false;
}
/**
* Returns the owner of a relationship based on the relationship dn.
*
* @param value Value containing the dn of the relationship.
* @return the owner entry of the relationship.
* @throws LdapInvalidDnException thrown on invalid value.
* @throws LdapException thrown on invalid value.
*/
private Entry getOwnerOfRelationship(final Value<?> value)
throws LdapInvalidDnException, LdapException {
Entry relationshipEntry = ((ClonedServerEntry) this.opContext
.getSession().lookup(new Dn(value.getString())))
.getOriginalEntry();
Entry ownerOfRelationship = ((ClonedServerEntry) this.opContext
.getSession().lookup(
new Dn(relationshipEntry.get(this.ownerAttributeName)
.getString()))).getOriginalEntry();
return ownerOfRelationship;
}
}
| gpl-2.0 |
Tirech/FastWordpress | wp-includes/ms-functions.php | 78022 | <?php
/**
* Multisite WordPress API
*
* @package WordPress
* @subpackage Multisite
* @since 3.0.0
*/
/**
* Gets the network's site and user counts.
*
* @since MU 1.0
* @uses get_blog_count()
* @uses get_user_count()
*
* @return array Site and user count for the network.
*/
function get_sitestats() {
$stats = array(
'blogs' => get_blog_count(),
'users' => get_user_count(),
);
return $stats;
}
/**
* Get the admin for a domain/path combination.
*
* @since MU 1.0
*
* @param string $sitedomain Optional. Site domain.
* @param string $path Optional. Site path.
* @return array The network admins
*/
function get_admin_users_for_domain( $sitedomain = '', $path = '' ) {
global $wpdb;
if ( ! $sitedomain )
$site_id = $wpdb->siteid;
else
$site_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path ) );
if ( $site_id )
return $wpdb->get_results( $wpdb->prepare( "SELECT u.ID, u.user_login, u.user_pass FROM $wpdb->users AS u, $wpdb->sitemeta AS sm WHERE sm.meta_key = 'admin_user_id' AND u.ID = sm.meta_value AND sm.site_id = %d", $site_id ), ARRAY_A );
return false;
}
/**
* Get one of a user's active blogs
*
* Returns the user's primary blog, if they have one and
* it is active. If it's inactive, function returns another
* active blog of the user. If none are found, the user
* is added as a Subscriber to the Dashboard Blog and that blog
* is returned.
*
* @since MU 1.0
* @uses get_blogs_of_user()
* @uses add_user_to_blog()
* @uses get_blog_details()
*
* @param int $user_id The unique ID of the user
* @return object The blog object
*/
function get_active_blog_for_user( $user_id ) {
global $wpdb;
$blogs = get_blogs_of_user( $user_id );
if ( empty( $blogs ) )
return null;
if ( !is_multisite() )
return $blogs[$wpdb->blogid];
$primary_blog = get_user_meta( $user_id, 'primary_blog', true );
$first_blog = current($blogs);
if ( false !== $primary_blog ) {
if ( ! isset( $blogs[ $primary_blog ] ) ) {
update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
$primary = get_blog_details( $first_blog->userblog_id );
} else {
$primary = get_blog_details( $primary_blog );
}
} else {
//TODO Review this call to add_user_to_blog too - to get here the user must have a role on this blog?
add_user_to_blog( $first_blog->userblog_id, $user_id, 'subscriber' );
update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
$primary = $first_blog;
}
if ( ( ! is_object( $primary ) ) || ( $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 ) ) {
$blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs.
$ret = false;
if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
foreach ( (array) $blogs as $blog_id => $blog ) {
if ( $blog->site_id != $wpdb->siteid )
continue;
$details = get_blog_details( $blog_id );
if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
$ret = $blog;
if ( get_user_meta( $user_id , 'primary_blog', true ) != $blog_id )
update_user_meta( $user_id, 'primary_blog', $blog_id );
if ( !get_user_meta($user_id , 'source_domain', true) )
update_user_meta( $user_id, 'source_domain', $blog->domain );
break;
}
}
} else {
return null;
}
return $ret;
} else {
return $primary;
}
}
/**
* The number of active users in your installation.
*
* The count is cached and updated twice daily. This is not a live count.
*
* @since MU 2.7
*
* @return int
*/
function get_user_count() {
return get_site_option( 'user_count' );
}
/**
* The number of active sites on your installation.
*
* The count is cached and updated twice daily. This is not a live count.
*
* @since MU 1.0
*
* @param int $network_id Deprecated, not supported.
* @return int
*/
function get_blog_count( $network_id = 0 ) {
if ( func_num_args() )
_deprecated_argument( __FUNCTION__, '3.1' );
return get_site_option( 'blog_count' );
}
/**
* Get a blog post from any site on the network.
*
* @since MU 1.0
*
* @param int $blog_id ID of the blog.
* @param int $post_id ID of the post you're looking for.
* @return WP_Post|null WP_Post on success or null on failure
*/
function get_blog_post( $blog_id, $post_id ) {
switch_to_blog( $blog_id );
$post = get_post( $post_id );
restore_current_blog();
return $post;
}
/**
* Add a user to a blog.
*
* Use the 'add_user_to_blog' action to fire an event when
* users are added to a blog.
*
* @since MU 1.0
*
* @param int $blog_id ID of the blog you're adding the user to.
* @param int $user_id ID of the user you're adding.
* @param string $role The role you want the user to have
* @return bool
*/
function add_user_to_blog( $blog_id, $user_id, $role ) {
switch_to_blog($blog_id);
$user = get_userdata( $user_id );
if ( ! $user ) {
restore_current_blog();
return new WP_Error( 'user_does_not_exist', __( 'The requested user does not exist.' ) );
}
if ( !get_user_meta($user_id, 'primary_blog', true) ) {
update_user_meta($user_id, 'primary_blog', $blog_id);
$details = get_blog_details($blog_id);
update_user_meta($user_id, 'source_domain', $details->domain);
}
$user->set_role($role);
/**
* Fires immediately after a user is added to a site.
*
* @since MU
*
* @param int $user_id User ID.
* @param string $role User role.
* @param int $blog_id Blog ID.
*/
do_action( 'add_user_to_blog', $user_id, $role, $blog_id );
wp_cache_delete( $user_id, 'users' );
restore_current_blog();
return true;
}
/**
* Remove a user from a blog.
*
* Use the 'remove_user_from_blog' action to fire an event when
* users are removed from a blog.
*
* Accepts an optional $reassign parameter, if you want to
* reassign the user's blog posts to another user upon removal.
*
* @since MU 1.0
*
* @param int $user_id ID of the user you're removing.
* @param int $blog_id ID of the blog you're removing the user from.
* @param string $reassign Optional. A user to whom to reassign posts.
* @return bool
*/
function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') {
global $wpdb;
switch_to_blog($blog_id);
$user_id = (int) $user_id;
/**
* Fires before a user is removed from a site.
*
* @since MU
*
* @param int $user_id User ID.
* @param int $blog_id Blog ID.
*/
do_action( 'remove_user_from_blog', $user_id, $blog_id );
// If being removed from the primary blog, set a new primary if the user is assigned
// to multiple blogs.
$primary_blog = get_user_meta($user_id, 'primary_blog', true);
if ( $primary_blog == $blog_id ) {
$new_id = '';
$new_domain = '';
$blogs = get_blogs_of_user($user_id);
foreach ( (array) $blogs as $blog ) {
if ( $blog->userblog_id == $blog_id )
continue;
$new_id = $blog->userblog_id;
$new_domain = $blog->domain;
break;
}
update_user_meta($user_id, 'primary_blog', $new_id);
update_user_meta($user_id, 'source_domain', $new_domain);
}
// wp_revoke_user($user_id);
$user = get_userdata( $user_id );
if ( ! $user ) {
restore_current_blog();
return new WP_Error('user_does_not_exist', __('That user does not exist.'));
}
$user->remove_all_caps();
$blogs = get_blogs_of_user($user_id);
if ( count($blogs) == 0 ) {
update_user_meta($user_id, 'primary_blog', '');
update_user_meta($user_id, 'source_domain', '');
}
if ( $reassign != '' ) {
$reassign = (int) $reassign;
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $user_id) );
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d", $reassign, $user_id) );
}
restore_current_blog();
return true;
}
/**
* Create an empty blog.
*
* @since MU 1.0
* @uses install_blog()
*
* @param string $domain The new blog's domain.
* @param string $path The new blog's path.
* @param string $weblog_title The new blog's title.
* @param int $site_id Optional. Defaults to 1.
* @return int The ID of the newly created blog
*/
function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
if ( empty($path) )
$path = '/';
// Check if the domain has been used already. We should return an error message.
if ( domain_exists($domain, $path, $site_id) )
return __( '<strong>ERROR</strong>: Site URL already taken.' );
// Need to back up wpdb table names, and create a new wp_blogs entry for new blog.
// Need to get blog_id from wp_blogs, and create new table names.
// Must restore table names at the end of function.
if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
return __( '<strong>ERROR</strong>: problem creating site entry.' );
switch_to_blog($blog_id);
install_blog($blog_id);
restore_current_blog();
return $blog_id;
}
/**
* Get the permalink for a post on another blog.
*
* @since MU 1.0
*
* @param int $blog_id ID of the source blog.
* @param int $post_id ID of the desired post.
* @return string The post's permalink
*/
function get_blog_permalink( $blog_id, $post_id ) {
switch_to_blog( $blog_id );
$link = get_permalink( $post_id );
restore_current_blog();
return $link;
}
/**
* Get a blog's numeric ID from its URL.
*
* On a subdirectory installation like example.com/blog1/,
* $domain will be the root 'example.com' and $path the
* subdirectory '/blog1/'. With subdomains like blog1.example.com,
* $domain is 'blog1.example.com' and $path is '/'.
*
* @since MU 2.6.5
*
* @param string $domain
* @param string $path Optional. Not required for subdomain installations.
* @return int 0 if no blog found, otherwise the ID of the matching blog
*/
function get_blog_id_from_url( $domain, $path = '/' ) {
global $wpdb;
$domain = strtolower( $domain );
$path = strtolower( $path );
$id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' );
if ( $id == -1 ) // blog does not exist
return 0;
elseif ( $id )
return (int) $id;
$id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s and path = %s /* get_blog_id_from_url */", $domain, $path ) );
if ( ! $id ) {
wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' );
return 0;
}
wp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' );
return $id;
}
// Admin functions
/**
* Checks an email address against a list of banned domains.
*
* This function checks against the Banned Email Domains list
* at wp-admin/network/settings.php. The check is only run on
* self-registrations; user creation at wp-admin/network/users.php
* bypasses this check.
*
* @since MU
*
* @param string $user_email The email provided by the user at registration.
* @return bool Returns true when the email address is banned.
*/
function is_email_address_unsafe( $user_email ) {
$banned_names = get_site_option( 'banned_email_domains' );
if ( $banned_names && ! is_array( $banned_names ) )
$banned_names = explode( "\n", $banned_names );
$is_email_address_unsafe = false;
if ( $banned_names && is_array( $banned_names ) ) {
$banned_names = array_map( 'strtolower', $banned_names );
$normalized_email = strtolower( $user_email );
list( $email_local_part, $email_domain ) = explode( '@', $normalized_email );
foreach ( $banned_names as $banned_domain ) {
if ( ! $banned_domain )
continue;
if ( $email_domain == $banned_domain ) {
$is_email_address_unsafe = true;
break;
}
$dotted_domain = ".$banned_domain";
if ( $dotted_domain === substr( $normalized_email, -strlen( $dotted_domain ) ) ) {
$is_email_address_unsafe = true;
break;
}
}
}
/**
* Filter whether an email address is unsafe.
*
* @since 3.5.0
*
* @param bool $is_email_address_unsafe Whether the email address is "unsafe". Default false.
* @param string $user_email User email address.
*/
return apply_filters( 'is_email_address_unsafe', $is_email_address_unsafe, $user_email );
}
/**
* Processes new user registrations.
*
* Checks the data provided by the user during signup. Verifies
* the validity and uniqueness of user names and user email addresses,
* and checks email addresses against admin-provided domain
* whitelists and blacklists.
*
* The hook 'wpmu_validate_user_signup' provides an easy way
* to modify the signup process. The value $result, which is passed
* to the hook, contains both the user-provided info and the error
* messages created by the function. 'wpmu_validate_user_signup' allows
* you to process the data in any way you'd like, and unset the
* relevant errors if necessary.
*
* @since MU
* @uses is_email_address_unsafe()
* @uses username_exists()
* @uses email_exists()
*
* @param string $user_name The login name provided by the user.
* @param string $user_email The email provided by the user.
* @return array Contains username, email, and error messages.
*/
function wpmu_validate_user_signup($user_name, $user_email) {
global $wpdb;
$errors = new WP_Error();
$orig_username = $user_name;
$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {
$errors->add( 'user_name', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
$user_name = $orig_username;
}
$user_email = sanitize_email( $user_email );
if ( empty( $user_name ) )
$errors->add('user_name', __( 'Please enter a username.' ) );
$illegal_names = get_site_option( 'illegal_names' );
if ( is_array( $illegal_names ) == false ) {
$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
add_site_option( 'illegal_names', $illegal_names );
}
if ( in_array( $user_name, $illegal_names ) == true )
$errors->add('user_name', __( 'That username is not allowed.' ) );
if ( is_email_address_unsafe( $user_email ) )
$errors->add('user_email', __('You cannot use that email address to signup. We are having problems with them blocking some of our email. Please use another email provider.'));
if ( strlen( $user_name ) < 4 )
$errors->add('user_name', __( 'Username must be at least 4 characters.' ) );
if ( strpos( ' ' . $user_name, '_' ) != false )
$errors->add( 'user_name', __( 'Sorry, usernames may not contain the character “_”!' ) );
// all numeric?
if ( preg_match( '/^[0-9]*$/', $user_name ) )
$errors->add('user_name', __('Sorry, usernames must have letters too!'));
if ( !is_email( $user_email ) )
$errors->add('user_email', __( 'Please enter a valid email address.' ) );
$limited_email_domains = get_site_option( 'limited_email_domains' );
if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) {
$emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
if ( in_array( $emaildomain, $limited_email_domains ) == false )
$errors->add('user_email', __('Sorry, that email address is not allowed!'));
}
// Check if the username has been used already.
if ( username_exists($user_name) )
$errors->add( 'user_name', __( 'Sorry, that username already exists!' ) );
// Check if the email address has been used already.
if ( email_exists($user_email) )
$errors->add( 'user_email', __( 'Sorry, that email address is already used!' ) );
// Has someone already signed up for this username?
$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_login = %s", $user_name) );
if ( $signup != null ) {
$registered_at = mysql2date('U', $signup->registered);
$now = current_time( 'timestamp', true );
$diff = $now - $registered_at;
// If registered more than two days ago, cancel registration and let this signup go through.
if ( $diff > 2 * DAY_IN_SECONDS )
$wpdb->delete( $wpdb->signups, array( 'user_login' => $user_name ) );
else
$errors->add('user_name', __('That username is currently reserved but may be available in a couple of days.'));
}
$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE user_email = %s", $user_email) );
if ( $signup != null ) {
$diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
// If registered more than two days ago, cancel registration and let this signup go through.
if ( $diff > 2 * DAY_IN_SECONDS )
$wpdb->delete( $wpdb->signups, array( 'user_email' => $user_email ) );
else
$errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
}
$result = array('user_name' => $user_name, 'orig_username' => $orig_username, 'user_email' => $user_email, 'errors' => $errors);
/**
* Filter the validated user registration details.
*
* This does not allow you to override the username or email of the user during
* registration. The values are solely used for validation and error handling.
*
* @since MU
*
* @param array $result {
* The array of user name, email and the error messages.
*
* @type string $user_name Sanitized and unique username.
* @type string $orig_username Original username.
* @type string $user_email User email address.
* @type WP_Error $errors WP_Error object containing any errors found.
* }
*/
return apply_filters( 'wpmu_validate_user_signup', $result );
}
/**
* Processes new site registrations.
*
* Checks the data provided by the user during blog signup. Verifies
* the validity and uniqueness of blog paths and domains.
*
* This function prevents the current user from registering a new site
* with a blogname equivalent to another user's login name. Passing the
* $user parameter to the function, where $user is the other user, is
* effectively an override of this limitation.
*
* Filter 'wpmu_validate_blog_signup' if you want to modify
* the way that WordPress validates new site signups.
*
* @since MU
* @uses domain_exists()
* @uses username_exists()
*
* @param string $blogname The blog name provided by the user. Must be unique.
* @param string $blog_title The blog title provided by the user.
* @return array Contains the new site data and error messages.
*/
function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
global $wpdb, $domain;
$current_site = get_current_site();
$base = $current_site->path;
$blog_title = strip_tags( $blog_title );
$blog_title = substr( $blog_title, 0, 50 );
$errors = new WP_Error();
$illegal_names = get_site_option( 'illegal_names' );
if ( $illegal_names == false ) {
$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
add_site_option( 'illegal_names', $illegal_names );
}
/*
* On sub dir installs, some names are so illegal, only a filter can
* spring them from jail.
*/
if ( ! is_subdomain_install() ) {
$illegal_names = array_merge(
$illegal_names,
/**
* Filter reserved site names on a sub-directory Multisite install.
*
* @since 3.0.0
*
* @param array $subdirectory_reserved_names Array of reserved names.
*/
apply_filters( 'subdirectory_reserved_names', array( 'page', 'comments', 'blog', 'files', 'feed' ) )
);
}
if ( empty( $blogname ) )
$errors->add('blogname', __( 'Please enter a site name.' ) );
if ( preg_match( '/[^a-z0-9]+/', $blogname ) )
$errors->add('blogname', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
if ( in_array( $blogname, $illegal_names ) == true )
$errors->add('blogname', __( 'That name is not allowed.' ) );
if ( strlen( $blogname ) < 4 && !is_super_admin() )
$errors->add('blogname', __( 'Site name must be at least 4 characters.' ) );
if ( strpos( $blogname, '_' ) !== false )
$errors->add( 'blogname', __( 'Sorry, site names may not contain the character “_”!' ) );
// do not allow users to create a blog that conflicts with a page on the main blog.
if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )
$errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
// all numeric?
if ( preg_match( '/^[0-9]*$/', $blogname ) )
$errors->add('blogname', __('Sorry, site names must have letters too!'));
/**
* Filter the new site name during registration.
*
* The name is the site's subdomain or the site's subdirectory
* path depending on the network settings.
*
* @since MU
*
* @param string $blogname Site name.
*/
$blogname = apply_filters( 'newblogname', $blogname );
$blog_title = wp_unslash( $blog_title );
if ( empty( $blog_title ) )
$errors->add('blog_title', __( 'Please enter a site title.' ) );
// Check if the domain/path has been used already.
if ( is_subdomain_install() ) {
$mydomain = $blogname . '.' . preg_replace( '|^www\.|', '', $domain );
$path = $base;
} else {
$mydomain = "$domain";
$path = $base.$blogname.'/';
}
if ( domain_exists($mydomain, $path, $current_site->id) )
$errors->add( 'blogname', __( 'Sorry, that site already exists!' ) );
if ( username_exists( $blogname ) ) {
if ( is_object( $user ) == false || ( is_object($user) && ( $user->user_login != $blogname ) ) )
$errors->add( 'blogname', __( 'Sorry, that site is reserved!' ) );
}
// Has someone already signed up for this domain?
$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE domain = %s AND path = %s", $mydomain, $path) ); // TODO: Check email too?
if ( ! empty($signup) ) {
$diff = current_time( 'timestamp', true ) - mysql2date('U', $signup->registered);
// If registered more than two days ago, cancel registration and let this signup go through.
if ( $diff > 2 * DAY_IN_SECONDS )
$wpdb->delete( $wpdb->signups, array( 'domain' => $mydomain , 'path' => $path ) );
else
$errors->add('blogname', __('That site is currently reserved but may be available in a couple days.'));
}
$result = array('domain' => $mydomain, 'path' => $path, 'blogname' => $blogname, 'blog_title' => $blog_title, 'user' => $user, 'errors' => $errors);
/**
* Filter site details and error messages following registration.
*
* @since MU
*
* @param array $result {
* Array of domain, path, blog name, blog title, user and error messages.
*
* @type string $domain Domain for the site.
* @type string $path Path for the site. Used in subdirectory installs.
* @type string $blogname The unique site name (slug).
* @type string $blog_title Blog title.
* @type string $user User email address.
* @type WP_Error $errors WP_Error containing any errors found.
* }
*/
return apply_filters( 'wpmu_validate_blog_signup', $result );
}
/**
* Record site signup information for future activation.
*
* @since MU
* @uses wpmu_signup_blog_notification()
*
* @param string $domain The requested domain.
* @param string $path The requested path.
* @param string $title The requested site title.
* @param string $user The user's requested login name.
* @param string $user_email The user's email address.
* @param array $meta By default, contains the requested privacy setting and lang_id.
*/
function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array() ) {
global $wpdb;
$key = substr( md5( time() . rand() . $domain ), 0, 16 );
$meta = serialize($meta);
$wpdb->insert( $wpdb->signups, array(
'domain' => $domain,
'path' => $path,
'title' => $title,
'user_login' => $user,
'user_email' => $user_email,
'registered' => current_time('mysql', true),
'activation_key' => $key,
'meta' => $meta
) );
wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta);
}
/**
* Record user signup information for future activation.
*
* This function is used when user registration is open but
* new site registration is not.
*
* @since MU
* @uses wpmu_signup_user_notification()
*
* @param string $user The user's requested login name.
* @param string $user_email The user's email address.
* @param array $meta By default, this is an empty array.
*/
function wpmu_signup_user( $user, $user_email, $meta = array() ) {
global $wpdb;
// Format data
$user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
$user_email = sanitize_email( $user_email );
$key = substr( md5( time() . rand() . $user_email ), 0, 16 );
$meta = serialize($meta);
$wpdb->insert( $wpdb->signups, array(
'domain' => '',
'path' => '',
'title' => '',
'user_login' => $user,
'user_email' => $user_email,
'registered' => current_time('mysql', true),
'activation_key' => $key,
'meta' => $meta
) );
wpmu_signup_user_notification($user, $user_email, $key, $meta);
}
/**
* Notify user of signup success.
*
* This is the notification function used when site registration
* is enabled.
*
* Filter 'wpmu_signup_blog_notification' to bypass this function or
* replace it with your own notification behavior.
*
* Filter 'wpmu_signup_blog_notification_email' and
* 'wpmu_signup_blog_notification_subject' to change the content
* and subject line of the email sent to newly registered users.
*
* @since MU
*
* @param string $domain The new blog domain.
* @param string $path The new blog path.
* @param string $title The site title.
* @param string $user The user's login name.
* @param string $user_email The user's email address.
* @param string $key The activation key created in wpmu_signup_blog()
* @param array $meta By default, contains the requested privacy setting and lang_id.
* @return bool
*/
function wpmu_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta = array() ) {
/**
* Filter whether to bypass the new site email notification.
*
* @since MU
*
* @param string|bool $domain Site domain.
* @param string $path Site path.
* @param string $title Site title.
* @param string $user User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_blog().
* @param array $meta By default, contains the requested privacy setting and lang_id.
*/
if ( ! apply_filters( 'wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta ) ) {
return false;
}
// Send email with activation link.
if ( !is_subdomain_install() || get_current_site()->id != 1 )
$activate_url = network_site_url("wp-activate.php?key=$key");
else
$activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
$activate_url = esc_url($activate_url);
$admin_email = get_site_option( 'admin_email' );
if ( $admin_email == '' )
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = sprintf(
/**
* Filter the message content of the new blog notification email.
*
* Content should be formatted for transmission via wp_mail().
*
* @since MU
*
* @param string $content Content of the notification email.
* @param string $domain Site domain.
* @param string $path Site path.
* @param string $title Site title.
* @param string $user User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_blog().
* @param array $meta By default, contains the requested privacy setting and lang_id.
*/
apply_filters( 'wpmu_signup_blog_notification_email',
__( "To activate your blog, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login.\n\nAfter you activate, you can visit your site here:\n\n%s" ),
$domain, $path, $title, $user, $user_email, $key, $meta
),
$activate_url,
esc_url( "http://{$domain}{$path}" ),
$key
);
// TODO: Don't hard code activation link.
$subject = sprintf(
/**
* Filter the subject of the new blog notification email.
*
* @since MU
*
* @param string $subject Subject of the notification email.
* @param string $domain Site domain.
* @param string $path Site path.
* @param string $title Site title.
* @param string $user User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_blog().
* @param array $meta By default, contains the requested privacy setting and lang_id.
*/
apply_filters( 'wpmu_signup_blog_notification_subject',
__( '[%1$s] Activate %2$s' ),
$domain, $path, $title, $user, $user_email, $key, $meta
),
$from_name,
esc_url( 'http://' . $domain . $path )
);
wp_mail($user_email, $subject, $message, $message_headers);
return true;
}
/**
* Notify user of signup success.
*
* This is the notification function used when no new site has
* been requested.
*
* Filter 'wpmu_signup_user_notification' to bypass this function or
* replace it with your own notification behavior.
*
* Filter 'wpmu_signup_user_notification_email' and
* 'wpmu_signup_user_notification_subject' to change the content
* and subject line of the email sent to newly registered users.
*
* @since MU
*
* @param string $user The user's login name.
* @param string $user_email The user's email address.
* @param string $key The activation key created in wpmu_signup_user()
* @param array $meta By default, an empty array.
* @return bool
*/
function wpmu_signup_user_notification( $user, $user_email, $key, $meta = array() ) {
/**
* Filter whether to bypass the email notification for new user sign-up.
*
* @since MU
*
* @param string $user User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_user().
* @param array $meta Signup meta data.
*/
if ( ! apply_filters( 'wpmu_signup_user_notification', $user, $user_email, $key, $meta ) )
return false;
// Send email with activation link.
$admin_email = get_site_option( 'admin_email' );
if ( $admin_email == '' )
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = sprintf(
/**
* Filter the content of the notification email for new user sign-up.
*
* Content should be formatted for transmission via wp_mail().
*
* @since MU
*
* @param string $content Content of the notification email.
* @param string $user User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_user().
* @param array $meta Signup meta data.
*/
apply_filters( 'wpmu_signup_user_notification_email',
__( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login." ),
$user, $user_email, $key, $meta
),
site_url( "wp-activate.php?key=$key" )
);
// TODO: Don't hard code activation link.
$subject = sprintf(
/**
* Filter the subject of the notification email of new user signup.
*
* @since MU
*
* @param string $subject Subject of the notification email.
* @param string $user User login name.
* @param string $user_email User email address.
* @param string $key Activation key created in wpmu_signup_user().
* @param array $meta Signup meta data.
*/
apply_filters( 'wpmu_signup_user_notification_subject',
__( '[%1$s] Activate %2$s' ),
$user, $user_email, $key, $meta
),
$from_name,
$user
);
wp_mail($user_email, $subject, $message, $message_headers);
return true;
}
/**
* Activate a signup.
*
* Hook to 'wpmu_activate_user' or 'wpmu_activate_blog' for events
* that should happen only when users or sites are self-created (since
* those actions are not called when users and sites are created
* by a Super Admin).
*
* @since MU
* @uses wp_generate_password()
* @uses wpmu_welcome_user_notification()
* @uses add_user_to_blog()
* @uses wpmu_create_user()
* @uses wpmu_create_blog()
* @uses wpmu_welcome_notification()
*
* @param string $key The activation key provided to the user.
* @return array An array containing information about the activated user and/or blog
*/
function wpmu_activate_signup($key) {
global $wpdb;
$signup = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->signups WHERE activation_key = %s", $key) );
if ( empty( $signup ) )
return new WP_Error( 'invalid_key', __( 'Invalid activation key.' ) );
if ( $signup->active ) {
if ( empty( $signup->domain ) )
return new WP_Error( 'already_active', __( 'The user is already active.' ), $signup );
else
return new WP_Error( 'already_active', __( 'The site is already active.' ), $signup );
}
$meta = maybe_unserialize($signup->meta);
$password = wp_generate_password( 12, false );
$user_id = username_exists($signup->user_login);
if ( ! $user_id )
$user_id = wpmu_create_user($signup->user_login, $password, $signup->user_email);
else
$user_already_exists = true;
if ( ! $user_id )
return new WP_Error('create_user', __('Could not create user'), $signup);
$now = current_time('mysql', true);
if ( empty($signup->domain) ) {
$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
if ( isset( $user_already_exists ) )
return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
wpmu_welcome_user_notification( $user_id, $password, $meta );
/**
* Fires immediately after a new user is activated.
*
* @since MU
*
* @param int $user_id User ID.
* @param int $password User password.
* @param array $meta Signup meta data.
*/
do_action( 'wpmu_activate_user', $user_id, $password, $meta );
return array( 'user_id' => $user_id, 'password' => $password, 'meta' => $meta );
}
$blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid );
// TODO: What to do if we create a user but cannot create a blog?
if ( is_wp_error($blog_id) ) {
// If blog is taken, that means a previous attempt to activate this blog failed in between creating the blog and
// setting the activation flag. Let's just set the active flag and instruct the user to reset their password.
if ( 'blog_taken' == $blog_id->get_error_code() ) {
$blog_id->add_data( $signup );
$wpdb->update( $wpdb->signups, array( 'active' => 1, 'activated' => $now ), array( 'activation_key' => $key ) );
}
return $blog_id;
}
$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
wpmu_welcome_notification($blog_id, $user_id, $password, $signup->title, $meta);
/**
* Fires immediately after a site is activated.
*
* @since MU
*
* @param int $blog_id Blog ID.
* @param int $user_id User ID.
* @param int $password User password.
* @param string $signup_title Site title.
* @param array $meta Signup meta data.
*/
do_action( 'wpmu_activate_blog', $blog_id, $user_id, $password, $signup->title, $meta );
return array('blog_id' => $blog_id, 'user_id' => $user_id, 'password' => $password, 'title' => $signup->title, 'meta' => $meta);
}
/**
* Create a user.
*
* This function runs when a user self-registers as well as when
* a Super Admin creates a new user. Hook to 'wpmu_new_user' for events
* that should affect all new users, but only on Multisite (otherwise
* use 'user_register').
*
* @since MU
* @uses wp_create_user()
*
* @param string $user_name The new user's login name.
* @param string $password The new user's password.
* @param string $email The new user's email address.
* @return mixed Returns false on failure, or int $user_id on success
*/
function wpmu_create_user( $user_name, $password, $email ) {
$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
$user_id = wp_create_user( $user_name, $password, $email );
if ( is_wp_error( $user_id ) )
return false;
// Newly created users have no roles or caps until they are added to a blog.
delete_user_option( $user_id, 'capabilities' );
delete_user_option( $user_id, 'user_level' );
/**
* Fires immediately after a new user is created.
*
* @since MU
*
* @param int $user_id User ID.
*/
do_action( 'wpmu_new_user', $user_id );
return $user_id;
}
/**
* Create a site.
*
* This function runs when a user self-registers a new site as well
* as when a Super Admin creates a new site. Hook to 'wpmu_new_blog'
* for events that should affect all new sites.
*
* On subdirectory installs, $domain is the same as the main site's
* domain, and the path is the subdirectory name (eg 'example.com'
* and '/blog1/'). On subdomain installs, $domain is the new subdomain +
* root domain (eg 'blog1.example.com'), and $path is '/'.
*
* @since MU
* @uses domain_exists()
* @uses insert_blog()
* @uses wp_install_defaults()
* @uses add_user_to_blog()
*
* @param string $domain The new site's domain.
* @param string $path The new site's path.
* @param string $title The new site's title.
* @param int $user_id The user ID of the new site's admin.
* @param array $meta Optional. Used to set initial site options.
* @param int $site_id Optional. Only relevant on multi-network installs.
* @return mixed Returns WP_Error object on failure, int $blog_id on success
*/
function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $site_id = 1 ) {
$defaults = array( 'public' => 0 );
$meta = wp_parse_args( $meta, $defaults );
$domain = preg_replace( '/\s+/', '', sanitize_user( $domain, true ) );
if ( is_subdomain_install() )
$domain = str_replace( '@', '', $domain );
$title = strip_tags( $title );
$user_id = (int) $user_id;
if ( empty($path) )
$path = '/';
// Check if the domain has been used already. We should return an error message.
if ( domain_exists($domain, $path, $site_id) )
return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) );
if ( !defined('WP_INSTALLING') )
define( 'WP_INSTALLING', true );
if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
return new WP_Error('insert_blog', __('Could not create site.'));
switch_to_blog($blog_id);
install_blog($blog_id, $title);
wp_install_defaults($user_id);
add_user_to_blog($blog_id, $user_id, 'administrator');
foreach ( $meta as $key => $value ) {
if ( in_array( $key, array( 'public', 'archived', 'mature', 'spam', 'deleted', 'lang_id' ) ) )
update_blog_status( $blog_id, $key, $value );
else
update_option( $key, $value );
}
add_option( 'WPLANG', get_site_option( 'WPLANG' ) );
update_option( 'blog_public', (int) $meta['public'] );
if ( ! is_super_admin( $user_id ) && ! get_user_meta( $user_id, 'primary_blog', true ) )
update_user_meta( $user_id, 'primary_blog', $blog_id );
restore_current_blog();
/**
* Fires immediately after a new site is created.
*
* @since MU
*
* @param int $blog_id Blog ID.
* @param int $user_id User ID.
* @param string $domain Site domain.
* @param string $path Site path.
* @param int $site_id Site ID. Only relevant on multi-network installs.
* @param array $meta Meta data. Used to set initial site options.
*/
do_action( 'wpmu_new_blog', $blog_id, $user_id, $domain, $path, $site_id, $meta );
return $blog_id;
}
/**
* Notifies the network admin that a new site has been activated.
*
* Filter 'newblog_notify_siteadmin' to change the content of
* the notification email.
*
* @since MU
*
* @param int $blog_id The new site's ID.
* @return bool
*/
function newblog_notify_siteadmin( $blog_id, $deprecated = '' ) {
if ( get_site_option( 'registrationnotification' ) != 'yes' )
return false;
$email = get_site_option( 'admin_email' );
if ( is_email($email) == false )
return false;
$options_site_url = esc_url(network_admin_url('settings.php'));
switch_to_blog( $blog_id );
$blogname = get_option( 'blogname' );
$siteurl = site_url();
restore_current_blog();
$msg = sprintf( __( 'New Site: %1$s
URL: %2$s
Remote IP: %3$s
Disable these notifications: %4$s' ), $blogname, $siteurl, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url);
/**
* Filter the message body of the new site activation email sent
* to the network administrator.
*
* @since MU
*
* @param string $msg Email body.
*/
$msg = apply_filters( 'newblog_notify_siteadmin', $msg );
wp_mail( $email, sprintf( __( 'New Site Registration: %s' ), $siteurl ), $msg );
return true;
}
/**
* Notifies the network admin that a new user has been activated.
*
* Filter 'newuser_notify_siteadmin' to change the content of
* the notification email.
*
* @since MU
* @uses apply_filters() Filter newuser_notify_siteadmin to change the content of the email message
*
* @param int $user_id The new user's ID.
* @return bool
*/
function newuser_notify_siteadmin( $user_id ) {
if ( get_site_option( 'registrationnotification' ) != 'yes' )
return false;
$email = get_site_option( 'admin_email' );
if ( is_email($email) == false )
return false;
$user = get_userdata( $user_id );
$options_site_url = esc_url(network_admin_url('settings.php'));
$msg = sprintf(__('New User: %1$s
Remote IP: %2$s
Disable these notifications: %3$s'), $user->user_login, wp_unslash( $_SERVER['REMOTE_ADDR'] ), $options_site_url);
/**
* Filter the message body of the new user activation email sent
* to the network administrator.
*
* @since MU
*
* @param string $msg Email body.
* @param WP_User $user WP_User instance of the new user.
*/
$msg = apply_filters( 'newuser_notify_siteadmin', $msg, $user );
wp_mail( $email, sprintf(__('New User Registration: %s'), $user->user_login), $msg );
return true;
}
/**
* Check whether a blogname is already taken.
*
* Used during the new site registration process to ensure
* that each blogname is unique.
*
* @since MU
*
* @param string $domain The domain to be checked.
* @param string $path The path to be checked.
* @param int $site_id Optional. Relevant only on multi-network installs.
* @return int
*/
function domain_exists($domain, $path, $site_id = 1) {
global $wpdb;
$result = $wpdb->get_var( $wpdb->prepare("SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s AND site_id = %d", $domain, $path, $site_id) );
/**
* Filter whether a blogname is taken.
*
* @since 3.5.0
*
* @param int|null $result The blog_id if the blogname exists, null otherwise.
* @param string $domain Domain to be checked.
* @param string $path Path to be checked.
* @param int $site_id Site ID. Relevant only on multi-network installs.
*/
return apply_filters( 'domain_exists', $result, $domain, $path, $site_id );
}
/**
* Store basic site info in the blogs table.
*
* This function creates a row in the wp_blogs table and returns
* the new blog's ID. It is the first step in creating a new blog.
*
* @since MU
*
* @param string $domain The domain of the new site.
* @param string $path The path of the new site.
* @param int $site_id Unless you're running a multi-network install, be sure to set this value to 1.
* @return int The ID of the new row
*/
function insert_blog($domain, $path, $site_id) {
global $wpdb;
$path = trailingslashit($path);
$site_id = (int) $site_id;
$result = $wpdb->insert( $wpdb->blogs, array('site_id' => $site_id, 'domain' => $domain, 'path' => $path, 'registered' => current_time('mysql')) );
if ( ! $result )
return false;
$blog_id = $wpdb->insert_id;
refresh_blog_details( $blog_id );
wp_maybe_update_network_site_counts();
return $blog_id;
}
/**
* Install an empty blog.
*
* Creates the new blog tables and options. If calling this function
* directly, be sure to use switch_to_blog() first, so that $wpdb
* points to the new blog.
*
* @since MU
* @uses make_db_current_silent()
* @uses populate_roles()
*
* @param int $blog_id The value returned by insert_blog().
* @param string $blog_title The title of the new site.
*/
function install_blog( $blog_id, $blog_title = '' ) {
global $wpdb, $wp_roles;
// Cast for security
$blog_id = (int) $blog_id;
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
$suppress = $wpdb->suppress_errors();
if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) )
die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' );
$wpdb->suppress_errors( $suppress );
$url = get_blogaddress_by_id( $blog_id );
// Set everything up
make_db_current_silent( 'blog' );
populate_options();
populate_roles();
$wp_roles->_init();
$url = untrailingslashit( $url );
update_option( 'siteurl', $url );
update_option( 'home', $url );
if ( get_site_option( 'ms_files_rewriting' ) )
update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
else
update_option( 'upload_path', get_blog_option( get_current_site()->blog_id, 'upload_path' ) );
update_option( 'blogname', wp_unslash( $blog_title ) );
update_option( 'admin_email', '' );
// remove all perms
$table_prefix = $wpdb->get_blog_prefix();
delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); // delete all
delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // delete all
}
/**
* Set blog defaults.
*
* This function creates a row in the wp_blogs table.
*
* @since MU
* @deprecated MU
* @deprecated Use wp_install_defaults()
* @uses wp_install_defaults()
*
* @param int $blog_id Ignored in this function.
* @param int $user_id
*/
function install_blog_defaults($blog_id, $user_id) {
global $wpdb;
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
$suppress = $wpdb->suppress_errors();
wp_install_defaults($user_id);
$wpdb->suppress_errors( $suppress );
}
/**
* Notify a user that their blog activation has been successful.
*
* Filter 'wpmu_welcome_notification' to disable or bypass.
*
* Filter 'update_welcome_email' and 'update_welcome_subject' to
* modify the content and subject line of the notification email.
*
* @since MU
*
* @param int $blog_id
* @param int $user_id
* @param string $password
* @param string $title The new blog's title
* @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
* @return bool
*/
function wpmu_welcome_notification( $blog_id, $user_id, $password, $title, $meta = array() ) {
$current_site = get_current_site();
/**
* Filter whether to bypass the welcome email after site activation.
*
* Returning false disables the welcome email.
*
* @since MU
*
* @param int|bool $blog_id Blog ID.
* @param int $user_id User ID.
* @param string $password User password.
* @param string $title Site title.
* @param array $meta Signup meta data.
*/
if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) )
return false;
$welcome_email = get_site_option( 'welcome_email' );
if ( $welcome_email == false )
$welcome_email = __( 'Dear User,
Your new SITE_NAME site has been successfully set up at:
BLOG_URL
You can log in to the administrator account with the following information:
Username: USERNAME
Password: PASSWORD
Log in here: BLOG_URLwp-login.php
We hope you enjoy your new site. Thanks!
--The Team @ SITE_NAME' );
$url = get_blogaddress_by_id($blog_id);
$user = get_userdata( $user_id );
$welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
$welcome_email = str_replace( 'BLOG_TITLE', $title, $welcome_email );
$welcome_email = str_replace( 'BLOG_URL', $url, $welcome_email );
$welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
$welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
/**
* Filter the content of the welcome email after site activation.
*
* Content should be formatted for transmission via wp_mail().
*
* @since MU
*
* @param string $welcome_email Message body of the email.
* @param int $blog_id Blog ID.
* @param int $user_id User ID.
* @param string $password User password.
* @param string $title Site title.
* @param array $meta Signup meta data.
*/
$welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta );
$admin_email = get_site_option( 'admin_email' );
if ( $admin_email == '' )
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = $welcome_email;
if ( empty( $current_site->site_name ) )
$current_site->site_name = 'WordPress';
/**
* Filter the subject of the welcome email after site activation.
*
* @since MU
*
* @param string $subject Subject of the email.
*/
$subject = apply_filters( 'update_welcome_subject', sprintf( __( 'New %1$s Site: %2$s' ), $current_site->site_name, wp_unslash( $title ) ) );
wp_mail($user->user_email, $subject, $message, $message_headers);
return true;
}
/**
* Notify a user that their account activation has been successful.
*
* Filter 'wpmu_welcome_user_notification' to disable or bypass.
*
* Filter 'update_welcome_user_email' and 'update_welcome_user_subject' to
* modify the content and subject line of the notification email.
*
* @since MU
*
* @param int $user_id
* @param string $password
* @param array $meta Optional. Not used in the default function, but is passed along to hooks for customization.
* @return bool
*/
function wpmu_welcome_user_notification( $user_id, $password, $meta = array() ) {
$current_site = get_current_site();
/**
* Filter whether to bypass the welcome email after user activation.
*
* Returning false disables the welcome email.
*
* @since MU
*
* @param int $user_id User ID.
* @param string $password User password.
* @param array $meta Signup meta data.
*/
if ( ! apply_filters( 'wpmu_welcome_user_notification', $user_id, $password, $meta ) )
return false;
$welcome_email = get_site_option( 'welcome_user_email' );
$user = get_userdata( $user_id );
/**
* Filter the content of the welcome email after user activation.
*
* Content should be formatted for transmission via wp_mail().
*
* @since MU
*
* @param type $welcome_email The message body of the account activation success email.
* @param int $user_id User ID.
* @param string $password User password.
* @param array $meta Signup meta data.
*/
$welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta );
$welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
$welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
$welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
$welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );
$admin_email = get_site_option( 'admin_email' );
if ( $admin_email == '' )
$admin_email = 'support@' . $_SERVER['SERVER_NAME'];
$from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
$message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
$message = $welcome_email;
if ( empty( $current_site->site_name ) )
$current_site->site_name = 'WordPress';
/**
* Filter the subject of the welcome email after user activation.
*
* @since MU
*
* @param string $subject Subject of the email.
*/
$subject = apply_filters( 'update_welcome_user_subject', sprintf( __( 'New %1$s User: %2$s' ), $current_site->site_name, $user->user_login) );
wp_mail($user->user_email, $subject, $message, $message_headers);
return true;
}
/**
* Get the current site info.
*
* Returns an object containing the 'id', 'domain', 'path', and 'site_name'
* properties of the site being viewed.
*
* @see wpmu_current_site()
*
* @since MU
*
* @return object
*/
function get_current_site() {
global $current_site;
return $current_site;
}
/**
* Get a user's most recent post.
*
* Walks through each of a user's blogs to find the post with
* the most recent post_date_gmt.
*
* @since MU
* @uses get_blogs_of_user()
*
* @param int $user_id
* @return array Contains the blog_id, post_id, post_date_gmt, and post_gmt_ts
*/
function get_most_recent_post_of_user( $user_id ) {
global $wpdb;
$user_blogs = get_blogs_of_user( (int) $user_id );
$most_recent_post = array();
// Walk through each blog and get the most recent post
// published by $user_id
foreach ( (array) $user_blogs as $blog ) {
$prefix = $wpdb->get_blog_prefix( $blog->userblog_id );
$recent_post = $wpdb->get_row( $wpdb->prepare("SELECT ID, post_date_gmt FROM {$prefix}posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id ), ARRAY_A);
// Make sure we found a post
if ( isset($recent_post['ID']) ) {
$post_gmt_ts = strtotime($recent_post['post_date_gmt']);
// If this is the first post checked or if this post is
// newer than the current recent post, make it the new
// most recent post.
if ( !isset($most_recent_post['post_gmt_ts']) || ( $post_gmt_ts > $most_recent_post['post_gmt_ts'] ) ) {
$most_recent_post = array(
'blog_id' => $blog->userblog_id,
'post_id' => $recent_post['ID'],
'post_date_gmt' => $recent_post['post_date_gmt'],
'post_gmt_ts' => $post_gmt_ts
);
}
}
}
return $most_recent_post;
}
// Misc functions
/**
* Get the size of a directory.
*
* A helper function that is used primarily to check whether
* a blog has exceeded its allowed upload space.
*
* @since MU
* @uses recurse_dirsize()
*
* @param string $directory
* @return int
*/
function get_dirsize( $directory ) {
$dirsize = get_transient( 'dirsize_cache' );
if ( is_array( $dirsize ) && isset( $dirsize[ $directory ][ 'size' ] ) )
return $dirsize[ $directory ][ 'size' ];
if ( false == is_array( $dirsize ) )
$dirsize = array();
$dirsize[ $directory ][ 'size' ] = recurse_dirsize( $directory );
set_transient( 'dirsize_cache', $dirsize, HOUR_IN_SECONDS );
return $dirsize[ $directory ][ 'size' ];
}
/**
* Get the size of a directory recursively.
*
* Used by get_dirsize() to get a directory's size when it contains
* other directories.
*
* @since MU
*
* @param string $directory
* @return int
*/
function recurse_dirsize( $directory ) {
$size = 0;
$directory = untrailingslashit( $directory );
if ( !file_exists($directory) || !is_dir( $directory ) || !is_readable( $directory ) )
return false;
if ($handle = opendir($directory)) {
while(($file = readdir($handle)) !== false) {
$path = $directory.'/'.$file;
if ($file != '.' && $file != '..') {
if (is_file($path)) {
$size += filesize($path);
} elseif (is_dir($path)) {
$handlesize = recurse_dirsize($path);
if ($handlesize > 0)
$size += $handlesize;
}
}
}
closedir($handle);
}
return $size;
}
/**
* Check an array of MIME types against a whitelist.
*
* WordPress ships with a set of allowed upload filetypes,
* which is defined in wp-includes/functions.php in
* get_allowed_mime_types(). This function is used to filter
* that list against the filetype whitelist provided by Multisite
* Super Admins at wp-admin/network/settings.php.
*
* @since MU
*
* @param array $mimes
* @return array
*/
function check_upload_mimes( $mimes ) {
$site_exts = explode( ' ', get_site_option( 'upload_filetypes' ) );
foreach ( $site_exts as $ext ) {
foreach ( $mimes as $ext_pattern => $mime ) {
if ( $ext != '' && strpos( $ext_pattern, $ext ) !== false )
$site_mimes[$ext_pattern] = $mime;
}
}
return $site_mimes;
}
/**
* Update a blog's post count.
*
* WordPress MS stores a blog's post count as an option so as
* to avoid extraneous COUNTs when a blog's details are fetched
* with get_blog_details(). This function is called when posts
* are published to make sure the count stays current.
*
* @since MU
*/
function update_posts_count( $deprecated = '' ) {
global $wpdb;
update_option( 'post_count', (int) $wpdb->get_var( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_status = 'publish' and post_type = 'post'" ) );
}
/**
* Logs user registrations.
*
* @since MU
*
* @param int $blog_id
* @param int $user_id
*/
function wpmu_log_new_registrations( $blog_id, $user_id ) {
global $wpdb;
$user = get_userdata( (int) $user_id );
if ( $user )
$wpdb->insert( $wpdb->registration_log, array('email' => $user->user_email, 'IP' => preg_replace( '/[^0-9., ]/', '', wp_unslash( $_SERVER['REMOTE_ADDR'] ) ), 'blog_id' => $blog_id, 'date_registered' => current_time('mysql')) );
}
/**
* Maintains a canonical list of terms by syncing terms created for each blog with the global terms table.
*
* @since 3.0.0
*
* @see term_id_filter
*
* @param int $term_id An ID for a term on the current blog.
* @return int An ID from the global terms table mapped from $term_id.
*/
function global_terms( $term_id, $deprecated = '' ) {
global $wpdb;
static $global_terms_recurse = null;
if ( !global_terms_enabled() )
return $term_id;
// prevent a race condition
$recurse_start = false;
if ( $global_terms_recurse === null ) {
$recurse_start = true;
$global_terms_recurse = 1;
} elseif ( 10 < $global_terms_recurse++ ) {
return $term_id;
}
$term_id = intval( $term_id );
$c = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->terms WHERE term_id = %d", $term_id ) );
$global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE category_nicename = %s", $c->slug ) );
if ( $global_id == null ) {
$used_global_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM $wpdb->sitecategories WHERE cat_ID = %d", $c->term_id ) );
if ( null == $used_global_id ) {
$wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $term_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
$global_id = $wpdb->insert_id;
if ( empty( $global_id ) )
return $term_id;
} else {
$max_global_id = $wpdb->get_var( "SELECT MAX(cat_ID) FROM $wpdb->sitecategories" );
$max_local_id = $wpdb->get_var( "SELECT MAX(term_id) FROM $wpdb->terms" );
$new_global_id = max( $max_global_id, $max_local_id ) + mt_rand( 100, 400 );
$wpdb->insert( $wpdb->sitecategories, array( 'cat_ID' => $new_global_id, 'cat_name' => $c->name, 'category_nicename' => $c->slug ) );
$global_id = $wpdb->insert_id;
}
} elseif ( $global_id != $term_id ) {
$local_id = $wpdb->get_row( $wpdb->prepare( "SELECT term_id FROM $wpdb->terms WHERE term_id = %d", $global_id ) );
if ( null != $local_id )
$local_id = global_terms( $local_id );
if ( 10 < $global_terms_recurse )
$global_id = $term_id;
}
if ( $global_id != $term_id ) {
if ( get_option( 'default_category' ) == $term_id )
update_option( 'default_category', $global_id );
$wpdb->update( $wpdb->terms, array('term_id' => $global_id), array('term_id' => $term_id) );
$wpdb->update( $wpdb->term_taxonomy, array('term_id' => $global_id), array('term_id' => $term_id) );
$wpdb->update( $wpdb->term_taxonomy, array('parent' => $global_id), array('parent' => $term_id) );
clean_term_cache($term_id);
}
if( $recurse_start )
$global_terms_recurse = null;
return $global_id;
}
/**
* Ensure that the current site's domain is listed in the allowed redirect host list.
*
* @see wp_validate_redirect()
* @since MU
*
* @return array The current site's domain
*/
function redirect_this_site( $deprecated = '' ) {
return array( get_current_site()->domain );
}
/**
* Check whether an upload is too big.
*
* @since MU
*
* @param array $upload
* @return mixed If the upload is under the size limit, $upload is returned. Otherwise returns an error message.
*/
function upload_is_file_too_big( $upload ) {
if ( is_array( $upload ) == false || defined( 'WP_IMPORTING' ) || get_site_option( 'upload_space_check_disabled' ) )
return $upload;
if ( strlen( $upload['bits'] ) > ( 1024 * get_site_option( 'fileupload_maxk', 1500 ) ) )
return sprintf( __( 'This file is too big. Files must be less than %d KB in size.' ) . '<br />', get_site_option( 'fileupload_maxk', 1500 ));
return $upload;
}
/**
* Add a nonce field to the signup page.
*
* @since MU
* @uses wp_nonce_field()
*/
function signup_nonce_fields() {
$id = mt_rand();
echo "<input type='hidden' name='signup_form_id' value='{$id}' />";
wp_nonce_field('signup_form_' . $id, '_signup_form', false);
}
/**
* Process the signup nonce created in signup_nonce_fields().
*
* @since MU
* @uses wp_create_nonce()
*
* @param array $result
* @return array
*/
function signup_nonce_check( $result ) {
if ( !strpos( $_SERVER[ 'PHP_SELF' ], 'wp-signup.php' ) )
return $result;
if ( wp_create_nonce('signup_form_' . $_POST[ 'signup_form_id' ]) != $_POST['_signup_form'] )
wp_die( __( 'Please try again.' ) );
return $result;
}
/**
* Correct 404 redirects when NOBLOGREDIRECT is defined.
*
* @since MU
*/
function maybe_redirect_404() {
/**
* Filter the redirect URL for 404s on the main site.
*
* The filter is only evaluated if the NOBLOGREDIRECT constant is defined.
*
* @since 3.0.0
*
* @param string $no_blog_redirect The redirect URL defined in NOBLOGREDIRECT.
*/
if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = apply_filters( 'blog_redirect_404', NOBLOGREDIRECT ) ) ) {
if ( $destination == '%siteurl%' )
$destination = network_home_url();
wp_redirect( $destination );
exit();
}
}
/**
* Add a new user to a blog by visiting /newbloguser/username/.
*
* This will only work when the user's details are saved as an option
* keyed as 'new_user_x', where 'x' is the username of the user to be
* added, as when a user is invited through the regular WP Add User interface.
*
* @since MU
* @uses add_existing_user_to_blog()
*/
function maybe_add_existing_user_to_blog() {
if ( false === strpos( $_SERVER[ 'REQUEST_URI' ], '/newbloguser/' ) )
return false;
$parts = explode( '/', $_SERVER[ 'REQUEST_URI' ] );
$key = array_pop( $parts );
if ( $key == '' )
$key = array_pop( $parts );
$details = get_option( 'new_user_' . $key );
if ( !empty( $details ) )
delete_option( 'new_user_' . $key );
if ( empty( $details ) || is_wp_error( add_existing_user_to_blog( $details ) ) )
wp_die( sprintf(__('An error occurred adding you to this site. Back to the <a href="%s">homepage</a>.'), home_url() ) );
wp_die( sprintf( __( 'You have been added to this site. Please visit the <a href="%s">homepage</a> or <a href="%s">log in</a> using your username and password.' ), home_url(), admin_url() ), __( 'WordPress › Success' ) );
}
/**
* Add a user to a blog based on details from maybe_add_existing_user_to_blog().
*
* @since MU
* @uses add_user_to_blog()
*
* @param array $details
*/
function add_existing_user_to_blog( $details = false ) {
global $blog_id;
if ( is_array( $details ) ) {
$result = add_user_to_blog( $blog_id, $details[ 'user_id' ], $details[ 'role' ] );
/**
* Fires immediately after an existing user is added to a site.
*
* @since MU
*
* @param int $user_id User ID.
* @param mixed $result True on success or a WP_Error object if the user doesn't exist.
*/
do_action( 'added_existing_user', $details['user_id'], $result );
}
return $result;
}
/**
* Add a newly created user to the appropriate blog
*
* To add a user in general, use add_user_to_blog(). This function
* is specifically hooked into the wpmu_activate_user action.
*
* @since MU
* @see add_user_to_blog()
*
* @param int $user_id
* @param mixed $password Ignored.
* @param array $meta
*/
function add_new_user_to_blog( $user_id, $password, $meta ) {
if ( !empty( $meta[ 'add_to_blog' ] ) ) {
$blog_id = $meta[ 'add_to_blog' ];
$role = $meta[ 'new_role' ];
remove_user_from_blog($user_id, get_current_site()->blog_id); // remove user from main blog.
add_user_to_blog( $blog_id, $user_id, $role );
update_user_meta( $user_id, 'primary_blog', $blog_id );
}
}
/**
* Correct From host on outgoing mail to match the site domain
*
* @since MU
*/
function fix_phpmailer_messageid( $phpmailer ) {
$phpmailer->Hostname = get_current_site()->domain;
}
/**
* Check to see whether a user is marked as a spammer, based on user login.
*
* @since MU
* @uses get_user_by()
*
* @param string|WP_User $user Optional. Defaults to current user. WP_User object,
* or user login name as a string.
* @return bool
*/
function is_user_spammy( $user = null ) {
if ( ! is_a( $user, 'WP_User' ) ) {
if ( $user )
$user = get_user_by( 'login', $user );
else
$user = wp_get_current_user();
}
return $user && isset( $user->spam ) && 1 == $user->spam;
}
/**
* Update this blog's 'public' setting in the global blogs table.
*
* Public blogs have a setting of 1, private blogs are 0.
*
* @since MU
* @uses update_blog_status()
*
* @param int $old_value
* @param int $value The new public value
* @return bool
*/
function update_blog_public( $old_value, $value ) {
update_blog_status( get_current_blog_id(), 'public', (int) $value );
}
add_action('update_option_blog_public', 'update_blog_public', 10, 2);
/**
* Check whether a usermeta key has to do with the current blog.
*
* @since MU
* @uses wp_get_current_user()
*
* @param string $key
* @param int $user_id Optional. Defaults to current user.
* @param int $blog_id Optional. Defaults to current blog.
* @return bool
*/
function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
global $wpdb;
$current_user = wp_get_current_user();
if ( $user_id == 0 )
$user_id = $current_user->ID;
if ( $blog_id == 0 )
$blog_id = $wpdb->blogid;
$local_key = $wpdb->get_blog_prefix( $blog_id ) . $key;
if ( isset( $current_user->$local_key ) )
return true;
return false;
}
/**
* Check whether users can self-register, based on Network settings.
*
* @since MU
*
* @return bool
*/
function users_can_register_signup_filter() {
$registration = get_site_option('registration');
if ( $registration == 'all' || $registration == 'user' )
return true;
return false;
}
add_filter('option_users_can_register', 'users_can_register_signup_filter');
/**
* Ensure that the welcome message is not empty. Currently unused.
*
* @since MU
*
* @param string $text
* @return string
*/
function welcome_user_msg_filter( $text ) {
if ( !$text ) {
remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
$text = __( 'Dear User,
Your new account is set up.
You can log in with the following information:
Username: USERNAME
Password: PASSWORD
LOGINLINK
Thanks!
--The Team @ SITE_NAME' );
update_site_option( 'welcome_user_email', $text );
}
return $text;
}
add_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
/**
* Whether to force SSL on content.
*
* @since 2.8.5
*
* @param string|bool $force
* @return bool True if forced, false if not forced.
*/
function force_ssl_content( $force = '' ) {
static $forced_content;
if ( '' != $force ) {
$old_forced = $forced_content;
$forced_content = $force;
return $old_forced;
}
return $forced_content;
}
/**
* Formats a URL to use https.
*
* Useful as a filter.
*
* @since 2.8.5
*
* @param string URL
* @return string URL with https as the scheme
*/
function filter_SSL( $url ) {
if ( ! is_string( $url ) )
return get_bloginfo( 'url' ); // Return home blog url with proper scheme
if ( force_ssl_content() && is_ssl() )
$url = set_url_scheme( $url, 'https' );
return $url;
}
/**
* Schedule update of the network-wide counts for the current network.
*
* @since 3.1.0
*/
function wp_schedule_update_network_counts() {
if ( !is_main_site() )
return;
if ( !wp_next_scheduled('update_network_counts') && !defined('WP_INSTALLING') )
wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
}
/**
* Update the network-wide counts for the current network.
*
* @since 3.1.0
*/
function wp_update_network_counts() {
wp_update_network_user_counts();
wp_update_network_site_counts();
}
/**
* Update the count of sites for the current network.
*
* If enabled through the 'enable_live_network_counts' filter, update the sites count
* on a network when a site is created or its status is updated.
*
* @since 3.7.0
*
* @uses wp_update_network_site_counts()
*/
function wp_maybe_update_network_site_counts() {
$is_small_network = ! wp_is_large_network( 'sites' );
/**
* Filter whether to update network site or user counts when a new site is created.
*
* @since 3.7.0
*
* @see wp_is_large_network()
*
* @param bool $small_network Whether the network is considered small.
* @param string $context Context. Either 'users' or 'sites'.
*/
if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'sites' ) )
return;
wp_update_network_site_counts();
}
/**
* Update the network-wide users count.
*
* If enabled through the 'enable_live_network_counts' filter, update the users count
* on a network when a user is created or its status is updated.
*
* @since 3.7.0
*
* @uses wp_update_network_user_counts()
*/
function wp_maybe_update_network_user_counts() {
$is_small_network = ! wp_is_large_network( 'users' );
/** This filter is documented in wp-includes/ms-functions.php */
if ( ! apply_filters( 'enable_live_network_counts', $is_small_network, 'users' ) )
return;
wp_update_network_user_counts();
}
/**
* Update the network-wide site count.
*
* @since 3.7.0
*/
function wp_update_network_site_counts() {
global $wpdb;
$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid) );
update_site_option( 'blog_count', $count );
}
/**
* Update the network-wide user count.
*
* @since 3.7.0
*/
function wp_update_network_user_counts() {
global $wpdb;
$count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" );
update_site_option( 'user_count', $count );
}
/**
* Returns the space used by the current blog.
*
* @since 3.5.0
*
* @return int Used space in megabytes
*/
function get_space_used() {
/**
* Filter the amount of storage space used by the current site.
*
* @since 3.5.0
*
* @param int|bool $space_used The amount of used space, in megabytes. Default false.
*/
$space_used = apply_filters( 'pre_get_space_used', false );
if ( false === $space_used ) {
$upload_dir = wp_upload_dir();
$space_used = get_dirsize( $upload_dir['basedir'] ) / 1024 / 1024;
}
return $space_used;
}
/**
* Returns the upload quota for the current blog.
*
* @since MU
*
* @return int Quota in megabytes
*/
function get_space_allowed() {
$space_allowed = get_option( 'blog_upload_space' );
if ( ! is_numeric( $space_allowed ) )
$space_allowed = get_site_option( 'blog_upload_space' );
if ( empty( $space_allowed ) || ! is_numeric( $space_allowed ) )
$space_allowed = 100;
/**
* Filter the upload quota for the current site.
*
* @since 3.7.0
*
* @param int $space_allowed Upload quota in megabytes for the current blog.
*/
return apply_filters( 'get_space_allowed', $space_allowed );
}
/**
* Determines if there is any upload space left in the current blog's quota.
*
* @since 3.0.0
*
* @return int of upload space available in bytes
*/
function get_upload_space_available() {
$space_allowed = get_space_allowed() * 1024 * 1024;
if ( get_site_option( 'upload_space_check_disabled' ) )
return $space_allowed;
$space_used = get_space_used() * 1024 * 1024;
if ( ( $space_allowed - $space_used ) <= 0 )
return 0;
return $space_allowed - $space_used;
}
/**
* Determines if there is any upload space left in the current blog's quota.
*
* @since 3.0.0
* @return bool True if space is available, false otherwise.
*/
function is_upload_space_available() {
if ( get_site_option( 'upload_space_check_disabled' ) )
return true;
return (bool) get_upload_space_available();
}
/**
* @since 3.0.0
*
* @return int of upload size limit in bytes
*/
function upload_size_limit_filter( $size ) {
$fileupload_maxk = 1024 * get_site_option( 'fileupload_maxk', 1500 );
if ( get_site_option( 'upload_space_check_disabled' ) )
return min( $size, $fileupload_maxk );
return min( $size, $fileupload_maxk, get_upload_space_available() );
}
/**
* Whether or not we have a large network.
*
* The default criteria for a large network is either more than 10,000 users or more than 10,000 sites.
* Plugins can alter this criteria using the 'wp_is_large_network' filter.
*
* @since 3.3.0
* @param string $using 'sites or 'users'. Default is 'sites'.
* @return bool True if the network meets the criteria for large. False otherwise.
*/
function wp_is_large_network( $using = 'sites' ) {
if ( 'users' == $using ) {
$count = get_user_count();
/**
* Filter whether the network is considered large.
*
* @since 3.3.0
*
* @param bool $is_large_network Whether the network has more than 10000 users or sites.
* @param string $component The component to count. Accepts 'users', or 'sites'.
* @param int $count The count of items for the component.
*/
return apply_filters( 'wp_is_large_network', $count > 10000, 'users', $count );
}
$count = get_blog_count();
/** This filter is documented in wp-includes/ms-functions.php */
return apply_filters( 'wp_is_large_network', $count > 10000, 'sites', $count );
}
/**
* Return an array of sites for a network or networks.
*
* @since 3.7.0
*
* @param array $args {
* Array of default arguments. Optional.
*
* @type int|array $network_id A network ID or array of network IDs. Set to null to retrieve sites
* from all networks. Defaults to current network ID.
* @type int $public Retrieve public or non-public sites. Default null, for any.
* @type int $archived Retrieve archived or non-archived sites. Default null, for any.
* @type int $mature Retrieve mature or non-mature sites. Default null, for any.
* @type int $spam Retrieve spam or non-spam sites. Default null, for any.
* @type int $deleted Retrieve deleted or non-deleted sites. Default null, for any.
* @type int $limit Number of sites to limit the query to. Default 100.
* @type int $offset Exclude the first x sites. Used in combination with the $limit parameter. Default 0.
* }
* @return array An empty array if the install is considered "large" via wp_is_large_network(). Otherwise,
* an associative array of site data arrays, each containing the site (network) ID, blog ID,
* site domain and path, dates registered and modified, and the language ID. Also, boolean
* values for whether the site is public, archived, mature, spam, and/or deleted.
*/
function wp_get_sites( $args = array() ) {
global $wpdb;
if ( wp_is_large_network() )
return array();
$defaults = array(
'network_id' => $wpdb->siteid,
'public' => null,
'archived' => null,
'mature' => null,
'spam' => null,
'deleted' => null,
'limit' => 100,
'offset' => 0,
);
$args = wp_parse_args( $args, $defaults );
$query = "SELECT * FROM $wpdb->blogs WHERE 1=1 ";
if ( isset( $args['network_id'] ) && ( is_array( $args['network_id'] ) || is_numeric( $args['network_id'] ) ) ) {
$network_ids = implode( ',', wp_parse_id_list( $args['network_id'] ) );
$query .= "AND site_id IN ($network_ids) ";
}
if ( isset( $args['public'] ) )
$query .= $wpdb->prepare( "AND public = %d ", $args['public'] );
if ( isset( $args['archived'] ) )
$query .= $wpdb->prepare( "AND archived = %d ", $args['archived'] );
if ( isset( $args['mature'] ) )
$query .= $wpdb->prepare( "AND mature = %d ", $args['mature'] );
if ( isset( $args['spam'] ) )
$query .= $wpdb->prepare( "AND spam = %d ", $args['spam'] );
if ( isset( $args['deleted'] ) )
$query .= $wpdb->prepare( "AND deleted = %d ", $args['deleted'] );
if ( isset( $args['limit'] ) && $args['limit'] ) {
if ( isset( $args['offset'] ) && $args['offset'] )
$query .= $wpdb->prepare( "LIMIT %d OFFSET %d ", $args['limit'],$args['offset'] );
else
$query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );
}
$site_results = $wpdb->get_results( $query, ARRAY_A );
return $site_results;
}
| gpl-2.0 |
stibear/dajare | js/jquery-ui/development-bundle/ui/minified/jquery.ui.effect-blind.min.js | 956 | /*! jQuery UI - v1.10.4 - 2014-04-30
* http://jqueryui.com
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
(function(t){var e=/up|down|vertical/,i=/up|left|vertical|horizontal/;t.effects.effect.blind=function(s,n){var a,o,r,l=t(this),h=["position","top","bottom","left","right","height","width"],c=t.effects.setMode(l,s.mode||"hide"),u=s.direction||"up",d=e.test(u),p=d?"height":"width",f=d?"top":"left",g=i.test(u),m={},v="show"===c;l.parent().is(".ui-effects-wrapper")?t.effects.save(l.parent(),h):t.effects.save(l,h),l.show(),a=t.effects.createWrapper(l).css({overflow:"hidden"}),o=a[p](),r=parseFloat(a.css(f))||0,m[p]=v?o:0,g||(l.css(d?"bottom":"right",0).css(d?"top":"left","auto").css({position:"absolute"}),m[f]=v?r:o+r),v&&(a.css(p,0),g||a.css(f,r+o)),a.animate(m,{duration:s.duration,easing:s.easing,queue:!1,complete:function(){"hide"===c&&l.hide(),t.effects.restore(l,h),t.effects.removeWrapper(l),n()}})}})(jQuery); | gpl-2.0 |
ranklab-interactive/interventionist-support | wp-content/plugins/wp-security-audit-log/defaults.php | 25384 | <?php
// if not included correctly...
if ( !class_exists( 'WpSecurityAuditLog' ) ) exit();
// define custom / new PHP constants
defined('E_CRITICAL') || define('E_CRITICAL', 'E_CRITICAL');
defined('E_DEBUG') || define('E_DEBUG', 'E_DEBUG');
defined('E_RECOVERABLE_ERROR') || define('E_RECOVERABLE_ERROR', 'E_RECOVERABLE_ERROR');
defined('E_DEPRECATED') || define('E_DEPRECATED', 'E_DEPRECATED');
defined('E_USER_DEPRECATED') || define('E_USER_DEPRECATED', 'E_USER_DEPRECATED');
function wsaldefaults_wsal_init(WpSecurityAuditLog $wsal){
$wsal->constants->UseConstants(array(
// default PHP constants
array('name' => 'E_ERROR', 'description' => __('Fatal run-time error.', 'wp-security-audit-log')),
array('name' => 'E_WARNING', 'description' => __('Run-time warning (non-fatal error).', 'wp-security-audit-log')),
array('name' => 'E_PARSE', 'description' => __('Compile-time parse error.', 'wp-security-audit-log')),
array('name' => 'E_NOTICE', 'description' => __('Run-time notice.', 'wp-security-audit-log')),
array('name' => 'E_CORE_ERROR', 'description' => __('Fatal error that occurred during startup.', 'wp-security-audit-log')),
array('name' => 'E_CORE_WARNING', 'description' => __('Warnings that occurred during startup.', 'wp-security-audit-log')),
array('name' => 'E_COMPILE_ERROR', 'description' => __('Fatal compile-time error.', 'wp-security-audit-log')),
array('name' => 'E_COMPILE_WARNING', 'description' => __('Compile-time warning.', 'wp-security-audit-log')),
array('name' => 'E_USER_ERROR', 'description' => __('User-generated error message.', 'wp-security-audit-log')),
array('name' => 'E_USER_WARNING', 'description' => __('User-generated warning message.', 'wp-security-audit-log')),
array('name' => 'E_USER_NOTICE', 'description' => __('User-generated notice message.', 'wp-security-audit-log')),
array('name' => 'E_STRICT', 'description' => __('Non-standard/optimal code warning.', 'wp-security-audit-log')),
array('name' => 'E_RECOVERABLE_ERROR', 'description' => __('Catchable fatal error.', 'wp-security-audit-log')),
array('name' => 'E_DEPRECATED', 'description' => __('Run-time deprecation notices.', 'wp-security-audit-log')),
array('name' => 'E_USER_DEPRECATED', 'description' => __('Run-time user deprecation notices.', 'wp-security-audit-log')),
// custom constants
array('name' => 'E_CRITICAL', 'description' => __('Critical, high-impact messages.', 'wp-security-audit-log')),
array('name' => 'E_DEBUG', 'description' => __('Debug informational messages.', 'wp-security-audit-log')),
));
// create list of default alerts
$wsal->alerts->RegisterGroup(array(
__('Other User Activity', 'wp-security-audit-log') => array(
array(1000, E_NOTICE, __('User logs in', 'wp-security-audit-log'), __('Successfully logged in', 'wp-security-audit-log')),
array(1001, E_NOTICE, __('User logs out', 'wp-security-audit-log'), __('Successfully logged out', 'wp-security-audit-log')),
array(1002, E_WARNING, __('Login failed', 'wp-security-audit-log'), __('%Attempts% failed login(s) detected', 'wp-security-audit-log')),
array(2010, E_NOTICE, __('User uploaded file from Uploads directory', 'wp-security-audit-log'), __('Uploaded the file %FileName% in %FilePath%', 'wp-security-audit-log')),
array(2011, E_WARNING, __('User deleted file from Uploads directory', 'wp-security-audit-log'), __('Deleted the file %FileName% from %FilePath%', 'wp-security-audit-log')),
array(2046, E_CRITICAL, __('User changed a file using the theme editor', 'wp-security-audit-log'), __('Modified %File% with the Theme Editor', 'wp-security-audit-log')),
array(2051, E_CRITICAL, __('User changed a file using the plugin editor', 'wp-security-audit-log'), __('Modified %File% with the Plugin Editor', 'wp-security-audit-log')),
),
__('Blog Posts', 'wp-security-audit-log') => array(
array(2000, E_NOTICE, __('User created a new blog post and saved it as draft', 'wp-security-audit-log'), __('Created a new blog post called %PostTitle%. Blog post ID is %PostID%', 'wp-security-audit-log')),
array(2001, E_NOTICE, __('User published a blog post', 'wp-security-audit-log'), __('Published a blog post called %PostTitle%. Blog post URL is %PostUrl%', 'wp-security-audit-log')),
array(2002, E_NOTICE, __('User modified a published blog post', 'wp-security-audit-log'), __('Modified the published blog post %PostTitle%. Blog post URL is %PostUrl%', 'wp-security-audit-log')),
array(2003, E_NOTICE, __('User modified a draft blog post', 'wp-security-audit-log'), __('Modified the draft blog post %PostTitle%. Blog post ID is %PostID%', 'wp-security-audit-log')),
array(2008, E_NOTICE, __('User permanently deleted a blog post from the trash', 'wp-security-audit-log'), __('Deleted the post %PostTitle%. Blog post ID is %PostID%', 'wp-security-audit-log')),
array(2012, E_WARNING, __('User moved a blog post to the trash', 'wp-security-audit-log'), __('Moved the blog post %PostTitle% to trash', 'wp-security-audit-log')),
array(2014, E_CRITICAL, __('User restored a blog post from trash', 'wp-security-audit-log'), __('Restored post %PostTitle% from trash', 'wp-security-audit-log')),
array(2016, E_NOTICE, __('User changed blog post category', 'wp-security-audit-log'), __('Changed the category of the post %PostTitle% from %OldCategories% to %NewCategories%', 'wp-security-audit-log')),
array(2017, E_NOTICE, __('User changed blog post URL', 'wp-security-audit-log'), __('Changed the URL of the post %PostTitle% from %OldUrl% to %NewUrl%', 'wp-security-audit-log')),
array(2019, E_NOTICE, __('User changed blog post author', 'wp-security-audit-log'), __('Changed the author of %PostTitle% post from %OldAuthor% to %NewAuthor%', 'wp-security-audit-log')),
array(2021, E_NOTICE, __('User changed blog post status', 'wp-security-audit-log'), __('Changed the status of %PostTitle% post from %OldStatus% to %NewStatus%', 'wp-security-audit-log')),
array(2023, E_NOTICE, __('User created new category', 'wp-security-audit-log'), __('Created a new category called %CategoryName%', 'wp-security-audit-log')),
array(2024, E_WARNING, __('User deleted category', 'wp-security-audit-log'), __('Deleted the %CategoryName% category', 'wp-security-audit-log')),
array(2025, E_WARNING, __('User changed the visibility of a blog post', 'wp-security-audit-log'), __('Changed the visibility of %PostTitle% blog post from %OldVisibility% to %NewVisibility%', 'wp-security-audit-log')),
array(2027, E_NOTICE, __('User changed the date of a blog post', 'wp-security-audit-log'), __('Changed the date of %PostTitle% blog post from %OldDate% to %NewDate%', 'wp-security-audit-log')),
array(2049, E_NOTICE, __('User sets a post as sticky', 'wp-security-audit-log'), __('Set the post %PostTitle% as Sticky', 'wp-security-audit-log')),
array(2050, E_NOTICE, __('User removes post from sticky', 'wp-security-audit-log'), __('Removed the post %PostTitle% from Sticky', 'wp-security-audit-log')),
array(2053, E_NOTICE, __('User creates a custom field for a post', 'wp-security-audit-log'), __('Created custom field %MetaKey% with value %MetaValue% in post %PostTitle%', 'wp-security-audit-log')),
array(2054, E_NOTICE, __('User updates a custom field value for a post', 'wp-security-audit-log'), __('Modified the value of custom field %MetaKey% from %MetaValueOld% to %MetaValueNew% in post %PostTitle%', 'wp-security-audit-log')),
array(2055, E_NOTICE, __('User deletes a custom field from a post', 'wp-security-audit-log'), __('Deleted custom field %MetaKey% with value %MetaValue% from post %PostTitle%', 'wp-security-audit-log')),
array(2062, E_NOTICE, __('User updates a custom field name for a post', 'wp-security-audit-log'), __('Changed the custom field name from %MetaKeyOld% to %MetaKeyNew% in post %PostTitle%', 'wp-security-audit-log')),
array(2065, E_WARNING, __('User modifies content for a published post', 'wp-security-audit-log'), __('Modified the content of published post %PostTitle%', 'wp-security-audit-log')),
array(2068, E_NOTICE, __('User modifies content for a draft post', 'wp-security-audit-log'), __('Modified the content of draft post %PostTitle%', 'wp-security-audit-log')),
),
__('Pages', 'wp-security-audit-log') => array(
array(2004, E_NOTICE, __('User created a new WordPress page and saved it as draft', 'wp-security-audit-log'), __('Created a new page called %PostTitle%. Page ID is %PostID%', 'wp-security-audit-log')),
array(2005, E_NOTICE, __('User published a WorPress page', 'wp-security-audit-log'), __('Published a page called %PostTitle%. Page URL is %PostUrl%', 'wp-security-audit-log')),
array(2006, E_NOTICE, __('User modified a published WordPress page', 'wp-security-audit-log'), __('Modified the published page %PostTitle%. Page URL is %PostUrl%', 'wp-security-audit-log')),
array(2007, E_NOTICE, __('User modified a draft WordPress page', 'wp-security-audit-log'), __('Modified the draft page %PostTitle%. Page ID is %PostID%', 'wp-security-audit-log')),
array(2009, E_NOTICE, __('User permanently deleted a page from the trash', 'wp-security-audit-log'), __('Deleted the page %PostTitle%. Page ID is %PostID%', 'wp-security-audit-log')),
array(2013, E_WARNING, __('User moved WordPress page to the trash', 'wp-security-audit-log'), __('Moved the page %PostTitle% to trash', 'wp-security-audit-log')),
array(2015, E_CRITICAL, __('User restored a WordPress page from trash', 'wp-security-audit-log'), __('Restored page %PostTitle% from trash', 'wp-security-audit-log')),
array(2018, E_NOTICE, __('User changed page URL', 'wp-security-audit-log'), __('Changed the URL of the page %PostTitle% from %OldUrl% to %NewUrl%', 'wp-security-audit-log')),
array(2020, E_NOTICE, __('User changed page author', 'wp-security-audit-log'), __('Changed the author of %PostTitle% page from %OldAuthor% to %NewAuthor%', 'wp-security-audit-log')),
array(2022, E_NOTICE, __('User changed page status', 'wp-security-audit-log'), __('Changed the status of %PostTitle% page from %OldStatus% to %NewStatus%', 'wp-security-audit-log')),
array(2026, E_WARNING, __('User changed the visibility of a page post', 'wp-security-audit-log'), __('Changed the visibility of %PostTitle% page from %OldVisibility% to %NewVisibility%', 'wp-security-audit-log')),
array(2028, E_NOTICE, __('User changed the date of a page post', 'wp-security-audit-log'), __('Changed the date of %PostTitle% page from %OldDate% to %NewDate%', 'wp-security-audit-log')),
array(2047, E_NOTICE, __('User changed the parent of a page', 'wp-security-audit-log'), __('Changed the parent of %PostTitle% page from %OldParentName% to %NewParentName%', 'wp-security-audit-log')),
array(2048, E_CRITICAL, __('User changes the template of a page', 'wp-security-audit-log'), __('Changed the template of %PostTitle% page from %OldTemplate% to %NewTemplate%', 'wp-security-audit-log')),
array(2059, E_NOTICE, __('User creates a custom field for a page', 'wp-security-audit-log'), __('Created custom field %MetaKey% with value %MetaValue% in page %PostTitle%', 'wp-security-audit-log')),
array(2060, E_NOTICE, __('User updates a custom field value for a page', 'wp-security-audit-log'), __('Modified the value of custom field %MetaKey% from %MetaValueOld% to %MetaValueNew% in page %PostTitle%', 'wp-security-audit-log')),
array(2061, E_NOTICE, __('User deletes a custom field from a page', 'wp-security-audit-log'), __('Deleted custom field %MetaKey% with value %MetaValue% from page %PostTitle%', 'wp-security-audit-log')),
array(2064, E_NOTICE, __('User updates a custom field name for a page', 'wp-security-audit-log'), __('Changed the custom field name from %MetaKeyOld% to %MetaKeyNew% in page %PostTitle%', 'wp-security-audit-log')),
array(2066, E_WARNING, __('User modifies content for a published page', 'wp-security-audit-log'), __('Modified the content of published page %PostTitle%', 'wp-security-audit-log')),
array(2069, E_NOTICE, __('User modifies content for a draft page', 'wp-security-audit-log'), __('Modified the content of draft page %PostTitle%', 'wp-security-audit-log')),
),
__('Custom Posts', 'wp-security-audit-log') => array(
array(2029, E_NOTICE, __('User created a new post with custom post type and saved it as draft', 'wp-security-audit-log'), __('Created a new custom post called %PostTitle% of type %PostType%. Post ID is %PostID%', 'wp-security-audit-log')),
array(2030, E_NOTICE, __('User published a post with custom post type', 'wp-security-audit-log'), __('Published a custom post %PostTitle% of type %PostType%. Post URL is %PostUrl%', 'wp-security-audit-log')),
array(2031, E_NOTICE, __('User modified a post with custom post type', 'wp-security-audit-log'), __('Modified custom post %PostTitle% of type %PostType%. Post URL is %PostUrl%', 'wp-security-audit-log')),
array(2032, E_NOTICE, __('User modified a draft post with custom post type', 'wp-security-audit-log'), __('Modified draft custom post %PostTitle% of type is %PostType%. Post URL is %PostUrl%', 'wp-security-audit-log')),
array(2033, E_WARNING, __('User permanently deleted post with custom post type', 'wp-security-audit-log'), __('Deleted custom post %PostTitle% of type %PostType%', 'wp-security-audit-log')),
array(2034, E_WARNING, __('User moved post with custom post type to trash', 'wp-security-audit-log'), __('Moved custom post %PostTitle% to trash. Post type is %PostType%', 'wp-security-audit-log')),
array(2035, E_CRITICAL, __('User restored post with custom post type from trash', 'wp-security-audit-log'), __('Restored custom post %PostTitle% of type %PostType% from trash', 'wp-security-audit-log')),
array(2036, E_NOTICE, __('User changed the category of a post with custom post type', 'wp-security-audit-log'), __('Changed the category(ies) of custom post %PostTitle% of type %PostType% from %OldCategories% to %NewCategories%', 'wp-security-audit-log')),
array(2037, E_NOTICE, __('User changed the URL of a post with custom post type', 'wp-security-audit-log'), __('Changed the URL of custom post %PostTitle% of type %PostType% from %OldUrl% to %NewUrl%', 'wp-security-audit-log')),
array(2038, E_NOTICE, __('User changed the author or post with custom post type', 'wp-security-audit-log'), __('Changed the author of custom post %PostTitle% of type %PostType% from %OldAuthor% to %NewAuthor%', 'wp-security-audit-log')),
array(2039, E_NOTICE, __('User changed the status of post with custom post type', 'wp-security-audit-log'), __('Changed the status of custom post %PostTitle% of type %PostType% from %OldStatus% to %NewStatus%', 'wp-security-audit-log')),
array(2040, E_WARNING, __('User changed the visibility of a post with custom post type', 'wp-security-audit-log'), __('Changed the visibility of custom post %PostTitle% of type %PostType% from %OldVisibility% to %NewVisibility%', 'wp-security-audit-log')),
array(2041, E_NOTICE, __('User changed the date of post with custom post type', 'wp-security-audit-log'), __('Changed the date of custom post %PostTitle% of type %PostType% from %OldDate% to %NewDate%', 'wp-security-audit-log')),
array(2056, E_NOTICE, __('User creates a custom field for a custom post', 'wp-security-audit-log'), __('Created custom field %MetaKey% with value %MetaValue% in custom post %PostTitle% of type %PostType%', 'wp-security-audit-log')),
array(2057, E_NOTICE, __('User updates a custom field for a custom post', 'wp-security-audit-log'), __('Modified the value of custom field %MetaKey% from %MetaValueOld% to %MetaValueNew% in custom post %PostTitle% of type %PostType%', 'wp-security-audit-log')),
array(2058, E_NOTICE, __('User deletes a custom field from a custom post', 'wp-security-audit-log'), __('Deleted custom field %MetaKey% with value %MetaValue% from custom post %PostTitle% of type %PostType%', 'wp-security-audit-log')),
array(2063, E_NOTICE, __('User updates a custom field name for a custom post', 'wp-security-audit-log'), __('Changed the custom field name from %MetaKeyOld% to %MetaKeyNew% in custom post %PostTitle% of type %PostType%', 'wp-security-audit-log')),
array(2067, E_WARNING, __('User modifies content for a published custom post', 'wp-security-audit-log'), __('Modified the content of published custom post type %PostTitle%', 'wp-security-audit-log')),
array(2070, E_NOTICE, __('User modifies content for a draft custom post', 'wp-security-audit-log'), __('Modified the content of draft custom post type %PostTitle%', 'wp-security-audit-log')),
),
__('Widgets', 'wp-security-audit-log') => array(
array(2042, E_CRITICAL, __('User added a new widget', 'wp-security-audit-log'), __('Added a new %WidgetName% widget in %Sidebar%', 'wp-security-audit-log')),
array(2043, E_WARNING, __('User modified a widget', 'wp-security-audit-log'), __('Modified the %WidgetName% widget in %Sidebar%', 'wp-security-audit-log')),
array(2044, E_CRITICAL, __('User deleted widget', 'wp-security-audit-log'), __('Deleted the %WidgetName% widget from %Sidebar%', 'wp-security-audit-log')),
array(2045, E_NOTICE, __('User moved widget', 'wp-security-audit-log'), __('Moved the %WidgetName% widget from %OldSidebar% to %NewSidebar%', 'wp-security-audit-log')),
array(2071, E_NOTICE, __('User changed widget position', 'wp-security-audit-log'), __('Moved the %WidgetName% widget from position %OldPosition% to position %NewPosition% in sidebar %Sidebar%', 'wp-security-audit-log')),
),
__('User Profiles', 'wp-security-audit-log') => array(
array(4000, E_CRITICAL, __('A new user was created on WordPress', 'wp-security-audit-log'), __('User %NewUserData->Username% subscribed with a role of %NewUserData->Roles%', 'wp-security-audit-log')),
array(4001, E_CRITICAL, __('A user created another WordPress user', 'wp-security-audit-log'), __('Created a new user %NewUserData->Username% with the role of %NewUserData->Roles%', 'wp-security-audit-log')),
array(4002, E_CRITICAL, __('The role of a user was changed by another WordPress user', 'wp-security-audit-log'), __('Changed the role of user %TargetUsername% from %OldRole% to %NewRole%', 'wp-security-audit-log')),
array(4003, E_CRITICAL, __('User has changed his or her password', 'wp-security-audit-log'), __('Changed the password', 'wp-security-audit-log')),
array(4004, E_CRITICAL, __('A user changed another user\'s password', 'wp-security-audit-log'), __('Changed the password for user %TargetUserData->Username% with the role of %TargetUserData->Roles%', 'wp-security-audit-log')),
array(4005, E_NOTICE, __('User changed his or her email address', 'wp-security-audit-log'), __('Changed the email address from %OldEmail% to %NewEmail%', 'wp-security-audit-log')),
array(4006, E_NOTICE, __('A user changed another user\'s email address', 'wp-security-audit-log'), __('Changed the email address of user account %TargetUsername% from %OldEmail% to %NewEmail%', 'wp-security-audit-log')),
array(4007, E_CRITICAL, __('A user was deleted by another user', 'wp-security-audit-log'), __('Deleted User %TargetUserData->Username% with the role of %TargetUserData->Roles%', 'wp-security-audit-log')),
),
__('Plugins & Themes', 'wp-security-audit-log') => array(
array(5000, E_CRITICAL, __('User installed a plugin', 'wp-security-audit-log'), __('Installed the plugin %Plugin->Name% in %Plugin->plugin_dir_path%', 'wp-security-audit-log')),
array(5001, E_CRITICAL, __('User activated a WordPress plugin', 'wp-security-audit-log'), __('Activated the plugin %PluginData->Name% installed in %PluginFile%', 'wp-security-audit-log')),
array(5002, E_CRITICAL, __('User deactivated a WordPress plugin', 'wp-security-audit-log'), __('Deactivated the plugin %PluginData->Name% installed in %PluginFile%', 'wp-security-audit-log')),
array(5003, E_CRITICAL, __('User uninstalled a plugin', 'wp-security-audit-log'), __('Uninstalled the plugin %PluginData->Name% which was installed in %PluginFile%', 'wp-security-audit-log')),
array(5004, E_WARNING, __('User upgraded a plugin', 'wp-security-audit-log'), __('Upgraded the plugin %PluginData->Name% installed in %PluginFile%', 'wp-security-audit-log')),
array(5005, E_CRITICAL, __('User installed a theme', 'wp-security-audit-log'), __('Installed theme "%Theme->Name%" in %Theme->get_template_directory%', 'wp-security-audit-log')),
array(5006, E_CRITICAL, __('User activated a theme', 'wp-security-audit-log'), __('Activated theme "%Theme->Name%", installed in %Theme->get_template_directory%', 'wp-security-audit-log')),
array(5007, E_CRITICAL, __('User uninstalled a theme', 'wp-security-audit-log'), __('Deleted theme "%Theme->Name%" installed in %Theme->get_template_directory%', 'wp-security-audit-log')),
),
__('System Activity', 'wp-security-audit-log') => array(
array(0000, E_CRITICAL, __('Unknown Error', 'wp-security-audit-log'), __('An unexpected error has occurred', 'wp-security-audit-log')),
array(0001, E_CRITICAL, __('PHP error', 'wp-security-audit-log'), __('%Message%', 'wp-security-audit-log')),
array(0002, E_WARNING, __('PHP warning', 'wp-security-audit-log'), __('%Message%', 'wp-security-audit-log')),
array(0003, E_NOTICE, __('PHP notice', 'wp-security-audit-log'), __('%Message%', 'wp-security-audit-log')),
array(0004, E_CRITICAL, __('PHP exception', 'wp-security-audit-log'), __('%Message%', 'wp-security-audit-log')),
array(0005, E_CRITICAL, __('PHP shutdown error', 'wp-security-audit-log'), __('%Message%', 'wp-security-audit-log')),
array(6000, E_NOTICE, __('Events automatically pruned by system', 'wp-security-audit-log'), __('%EventCount% event(s) automatically deleted by system', 'wp-security-audit-log')),
array(6001, E_CRITICAL, __('Option Anyone Can Register in WordPress settings changed', 'wp-security-audit-log'), __('%NewValue% the option "Anyone can register"', 'wp-security-audit-log')),
array(6002, E_CRITICAL, __('New User Default Role changed', 'wp-security-audit-log'), __('Changed the New User Default Role from %OldRole% to %NewRole%', 'wp-security-audit-log')),
array(6003, E_CRITICAL, __('WordPress Administrator Notification email changed', 'wp-security-audit-log'), __('Changed the WordPress administrator notifications email address from %OldEmail% to %NewEmail%', 'wp-security-audit-log')),
array(6004, E_CRITICAL, __('WordPress was updated', 'wp-security-audit-log'), __('Updated WordPress from version %OldVersion% to %NewVersion%', 'wp-security-audit-log')),
array(6005, E_CRITICAL, __('User changes the WordPress Permalinks', 'wp-security-audit-log'), __('Changed the WordPress permalinks from %OldPattern% to %NewPattern%', 'wp-security-audit-log')),
),
__('MultiSite', 'wp-security-audit-log') => array(
array(4008, E_CRITICAL, __('User granted Super Admin privileges', 'wp-security-audit-log'), __('Granted Super Admin privileges to %TargetUsername%', 'wp-security-audit-log')),
array(4009, E_CRITICAL, __('User revoked from Super Admin privileges', 'wp-security-audit-log'), __('Revoked Super Admin privileges from %TargetUsername%', 'wp-security-audit-log')),
array(4010, E_CRITICAL, __('Existing user added to a site', 'wp-security-audit-log'), __('Added existing user %TargetUsername% with %TargetUserRole% role to site %SiteName%', 'wp-security-audit-log')),
array(4011, E_CRITICAL, __('User removed from site', 'wp-security-audit-log'), __('Removed user %TargetUsername% with role %TargetUserRole% from %SiteName% site', 'wp-security-audit-log')),
array(4012, E_CRITICAL, __('New network user created', 'wp-security-audit-log'), __('Created a new network user %NewUserData->Username%', 'wp-security-audit-log')),
array(7000, E_CRITICAL, __('New site added on network', 'wp-security-audit-log'), __('Added site %SiteName% to the network', 'wp-security-audit-log')),
array(7001, E_CRITICAL, __('Existing site archived', 'wp-security-audit-log'), __('Archived site %SiteName%', 'wp-security-audit-log')),
array(7002, E_CRITICAL, __('Archived site has been unarchived', 'wp-security-audit-log'), __('Unarchived site %SiteName%', 'wp-security-audit-log')),
array(7003, E_CRITICAL, __('Deactivated site has been activated', 'wp-security-audit-log'), __('Activated site %SiteName%', 'wp-security-audit-log')),
array(7004, E_CRITICAL, __('Site has been deactivated', 'wp-security-audit-log'), __('Deactivated site %SiteName%', 'wp-security-audit-log')),
array(7005, E_CRITICAL, __('Existing site deleted from network', 'wp-security-audit-log'), __('Deleted site %SiteName%', 'wp-security-audit-log')),
array(5008, E_CRITICAL, __('Activated theme on network', 'wp-security-audit-log'), __('Network activated %Theme->Name% theme installed in %Theme->get_template_directory%', 'wp-security-audit-log')),
array(5009, E_CRITICAL, __('Deactivated theme from network', 'wp-security-audit-log'), __('Network deactivated %Theme->Name% theme installed in %Theme->get_template_directory%', 'wp-security-audit-log')),
),
));
}
add_action('wsal_init', 'wsaldefaults_wsal_init');
| gpl-2.0 |
SolidLeon/Foxi | src/foxi/framework/compiler/token/CompilerTokenWRITEF.java | 441 | package foxi.framework.compiler.token;
import java.util.List;
import foxi.framework.ValueType;
import foxi.framework.command.Command;
import foxi.framework.command.WriteMemoryCommand;
public class CompilerTokenWRITEF extends CompilerToken {
@Override
public void compile(String[] words, List<Command> result) {
result.add(new WriteMemoryCommand(words[1], ValueType.VALUE, words[2], ValueType.VALUE_IN_MEMORY));
}
}
| gpl-2.0 |
Logan-Cookman/Python-CI-Testing | unittestExample.py | 1967 | #!/usr/bin/python3
################################
# File Name: unittestExample.py
# Author: Chadd Williams
# Date: 10/20/2014
# Class: CS 360
# Assignment: Lecture Examples
# Purpose: Demonstrate unit tests
################################
# adapted from https://docs.python.org/3/library/unittest.html
# python3 -m unittest unittestExample -v
import random
import unittest
class TestListFunctions(unittest.TestCase):
listSize = 10
def setUp(self):
""" the text fixture, necessary setup for the tests to run
"""
self.theList = list(range(self.listSize))
# shuffle the list
random.shuffle(self.theList)
def tearDown(self):
""" nothing to tear down here
If your test created a database or built a network connection
you might delete the database or close the network connection
here. You might also close files you opened, close your
TK windows if this is GUI program, or kill threads if this is
a multithreaded application
"""
pass # nothing to do
def test_sort(self):
""" make sure sort works correctly
"""
self.theList.sort()
self.assertEqual(self.theList, list(range(self.listSize)))
def test_append(self):
""" make sure append works correctly
"""
self.theList.append(self.listSize+1)
self.assertEqual(self.theList[-1], self.listSize+1)
def test_exceptions(self):
"""test some exceptions
"""
# theList does not contain -1. Make sure remove
# raised the correct exception
self.assertRaises(ValueError, self.theList.remove, -1)
#def test_thistestwillfail(self):
# """show you what a failed test looks like
# """
# theList DOES contain 1.
# remove will not raise the expected exception
# self.assertRaises(ValueError, self.theList.remove, 0)
| gpl-2.0 |
Crach1015/plugin.video.crachtvlistpro | _ytplist.py | 4160 | import urllib
import urllib2,json
import xbmcvfs
import requests,time
import os,xbmc,xbmcaddon,xbmcgui,re
addon = xbmcaddon.Addon('plugin.video.crachtvlistpro')
profile = xbmc.translatePath(addon.getAddonInfo('profile').decode('utf-8'))
cacheDir = os.path.join(profile, 'cachedir')
clean_cache=os.path.join(cacheDir,'cleancacheafter1month')
headers=dict({'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; rv:32.0) Gecko/20100101 Firefox/32.0'})
if not cacheDir.startswith(('smb://', 'nfs://', 'upnp://', 'ftp://')) and not os.path.isdir(cacheDir):
os.mkdir(cacheDir)
if xbmcvfs.exists(clean_cache) and (time.time()-os.path.getmtime(clean_cache) > 60*60*24*30):
print 'time of creation of ff',str(time.time()-os.path.getmtime(clean_cache))
import shutil
shutil.rmtree(cacheDir)
else:
with open(clean_cache,'w') as f:
f.write('')
utubeid = 'www.youtube.*?v(?:=|%3D)([0-9A-Za-z_-]{11})'
def YoUTube(page_data,youtube=None,duration=None,max_page=20,nosave=None):
pDialog = xbmcgui.DialogProgress()
pDialog.create('Updating list', 'Downloading ...')
base_yt_url ='http://gdata.youtube.com/feeds/api'
if 'search' in page_data:
youtube = youtube.replace(' ','+')#Lana Del Rey
build_url= base_yt_url + '/videos?q=%s&max-results=50&v=2&alt=json&orderby=published&start-index=%s'
if addon.getSetting('searchlongvideos') == 'true': #duration: #medium or long
build_url = base_yt_url + '/videos?q=%s&max-results=20&v=2&alt=json&duration=long&start-index=%s'
else:
build_url = 'http://www.youtube.com/watch?v=%s' %page_data
count = 1
allurls ={}
for i in range(1,max_page):
url = build_url %(youtube,str(count))
#print url
try:
content = cache(url,int(addon.getSetting("Youtube")))
print len(content)
jcontent = json.loads(content)
entry = jcontent['feed']['entry']
except Exception:
break
for myUrl in entry:
count += 1
allitem = 'item' + str(count)
item = {}
item['title']= removeNonAscii(myUrl['title']['$t']).encode('utf-8')
item['date']= myUrl['published']['$t'].encode('utf-8')
try:
item['desc']= removeNonAscii(myUrl['media$group']['media$description']['$t']).encode('utf-8')
except Exception:
desc = 'UNAVAIABLE'
link = myUrl['link'][0]['href'].encode('utf-8','ignore')
item['url']= re_me(link,utubeid)
allurls[allitem] = item
print len(allurls)
if nosave:
return allurls
pDialog.close()
def re_me(data, re_patten):
match = ''
m = re.search(re_patten, data,re.I)
if m != None:
match = m.group(1)
else:
match = ''
return match
def notification(header="", message="", sleep=3000):
""" Will display a notification dialog with the specified header and message,
in addition you can set the length of time it displays in milliseconds and a icon image.
"""
xbmc.executebuiltin("XBMC.Notification(%s,%s,%i)" % ( header, message, sleep ))
def removeNonAscii(s): return "".join(filter(lambda x: ord(x)<128, s))
def makeRequest(url,referer=None,post=None,body={}):
if referer:
headers.update=({'Referer':referer})
else:
req = urllib2.Request(url,None,headers)
response = urllib2.urlopen(req)
data = response.read()
response.close()
return data
# from AddonScriptorde X:\plugin.video.my_music_tv\default.py
def cache(url, duration=0):
cacheFile = os.path.join(cacheDir, (''.join(c for c in unicode(url, 'utf-8') if c not in '/\\:?"*|<>')).strip())
if os.path.exists(cacheFile) and duration!=0 and (time.time()-os.path.getmtime(cacheFile) < 60*60*24*duration):
fh = xbmcvfs.File(cacheFile, 'r')
content = fh.read()
fh.close()
return content
else:
content = makeRequest(url)
fh = xbmcvfs.File(cacheFile, 'w')
fh.write(content)
fh.close()
return content
| gpl-2.0 |
TheTypoMaster/Scaper | openjdk/corba/src/share/classes/org/omg/CORBA/PolicyListHelper.java | 3245 | /*
* Copyright 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package org.omg.CORBA;
/**
* The Helper for <tt>PolicyList</tt>. For more information on
* Helper files, see <a href="doc-files/generatedfiles.html#helper">
* "Generated Files: Helper Files"</a>.<P>
* org/omg/CORBA/PolicyListHelper.java
* Generated by the IDL-to-Java compiler (portable), version "3.0"
* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
* Saturday, July 17, 1999 12:26:21 AM PDT
*/
abstract public class PolicyListHelper
{
private static String _id = "IDL:omg.org/CORBA/PolicyList:1.0";
public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Policy[] that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static org.omg.CORBA.Policy[] extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
private static org.omg.CORBA.TypeCode __typeCode = null;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.PolicyHelper.type ();
__typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
__typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.PolicyListHelper.id (), "PolicyList", __typeCode);
}
return __typeCode;
}
public static String id ()
{
return _id;
}
public static org.omg.CORBA.Policy[] read (org.omg.CORBA.portable.InputStream istream)
{
org.omg.CORBA.Policy value[] = null;
int _len0 = istream.read_long ();
value = new org.omg.CORBA.Policy[_len0];
for (int _o1 = 0;_o1 < value.length; ++_o1)
value[_o1] = org.omg.CORBA.PolicyHelper.read (istream);
return value;
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Policy[] value)
{
ostream.write_long (value.length);
for (int _i0 = 0;_i0 < value.length; ++_i0)
org.omg.CORBA.PolicyHelper.write (ostream, value[_i0]);
}
}
| gpl-2.0 |
ubermichael/isetools | src/main/java/ca/nines/ise/schema/Schema.java | 6863 | /*
* Copyright (C) 2014 Michael Joyce <ubermichael@gmail.com>
*
* 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 version 2.
*
* 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package ca.nines.ise.schema;
import ca.nines.ise.util.BuilderInterface;
import ca.nines.ise.util.LocationData;
import ca.nines.ise.util.XMLDriver;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
/**
* A schema is a collection of Tags, and a little bit of metadata to describe
* the schema.
*
* Schemas are immutable. Use SchemaBuilder to create them.
*
*/
public class Schema {
/**
* The edition for the schema
*/
private final String edition;
/**
* The group for the schema. "ise" or "qme" or "dre"
*/
private final String group;
/**
* The line number where the schema is defined.
*/
private final int lineNumber;
/**
* The source where the schema is defined.
*/
private final String source;
/**
* A mapping of tag names to tags.
*/
private final Map<String, Tag> tags;
/**
* A class to construct a Schema. Schema construction is too complicated for a
* constructor, so use a builder.
*
* All the setters return the SchemaBuilder object, to enable method chaining.
*/
public static class SchemaBuilder implements BuilderInterface<Schema> {
private String edition;
private String group;
private int lineNumber;
private String source;
private Map<String, Tag> tags;
private SchemaBuilder() {
tags = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
edition = "";
group = "";
lineNumber = 0;
source = "";
}
public SchemaBuilder addTag(Tag tag) {
tags.put(tag.getName(), tag);
return this;
}
@Override
public Schema build() {
return new Schema(source, lineNumber, edition, group, tags);
}
public SchemaBuilder from(Node n) {
NamedNodeMap map = n.getAttributes();
LocationData loc = (LocationData) n.getUserData(LocationData.LOCATION_DATA_KEY);
setSource(loc.getSystemId());
setLineNumber(loc.getStartLine());
setEdition(map.getNamedItem("edition").getTextContent());
setGroup(map.getNamedItem("group").getTextContent());
NodeList list = ((Element) n).getElementsByTagName("tag");
int length = list.getLength();
for (int i = 0; i < length; i++) {
Tag.TagBuilder tb = Tag.builder();
addTag(tb.from(list.item(i)).build());
}
return this;
}
public SchemaBuilder from(File file) throws ParserConfigurationException, SAXException, TransformerException, IOException {
XMLDriver xd = new XMLDriver();
Document doc = xd.drive(file);
Node n = doc.getElementsByTagName("schema").item(0);
return from(n);
}
public SchemaBuilder from(String str) throws TransformerException, ParserConfigurationException, TransformerConfigurationException, SAXException {
XMLDriver xd = new XMLDriver();
Document doc = xd.drive(str);
Node n = doc.getElementsByTagName("schema").item(0);
return from(n);
}
public SchemaBuilder from(String source, InputStream in) throws TransformerException, ParserConfigurationException, TransformerConfigurationException, SAXException, IOException {
XMLDriver xd = new XMLDriver();
Document doc = xd.drive(source, in);
Node n = doc.getElementsByTagName("schema").item(0);
return from(n);
}
/**
* @param edition the edition to set
*/
public SchemaBuilder setEdition(String edition) {
this.edition = edition;
return this;
}
/**
* @param group the group to set
*/
public SchemaBuilder setGroup(String group) {
this.group = group;
return this;
}
/**
* @param lineNumber the lineNumber to set
*/
public SchemaBuilder setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
return this;
}
/**
* @param source the source to set
*/
public SchemaBuilder setSource(String source) {
this.source = source;
return this;
}
public SchemaBuilder setTags(Map<String, Tag> tags) {
this.tags = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
this.tags.putAll(tags);
return this;
}
}
public static SchemaBuilder builder() {
return new SchemaBuilder();
}
public static Schema defaultSchema() throws IOException, SAXException, ParserConfigurationException, TransformerException {
String loc = "/schemas/default.xml";
InputStream in = Schema.class.getResourceAsStream(loc);
return Schema.builder().from(loc, in).build();
}
private Schema(String source, int lineNumber, String edition, String group, Map<String, Tag> tags) {
this.source = source;
this.lineNumber = lineNumber;
this.edition = edition;
this.group = group;
this.tags = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
this.tags.putAll(tags);
}
/**
* @return the edition
*/
public String getEdition() {
return edition;
}
/**
* @return the group
*/
public String getGroup() {
return group;
}
/**
* @return the lineNumber
*/
public int getLineNumber() {
return lineNumber;
}
/**
* @return the source
*/
public String getSource() {
return source;
}
public Tag getTag(String name) {
return tags.get(name);
}
public String[] getTagNames() {
String[] names = tags.keySet().toArray(new String[tags.size()]);
Arrays.sort(names);
return names;
}
public Tag[] getTags() {
Tag[] t = tags.values().toArray(new Tag[tags.size()]);
Arrays.sort(t);
return t;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
for (Tag t : getTags()) {
sb.append(t);
}
return sb.toString();
}
}
| gpl-2.0 |
cobbler/cobbler | cobbler/modules/serializers/file.py | 4565 | """
Cobbler's file-based object serializer.
As of 9/2014, this is Cobbler's default serializer and the most stable one.
It uses multiple JSON files in /var/lib/cobbler/collections/distros, profiles, etc
Copyright 2006-2009, Red Hat, Inc and Others
Michael DeHaan <michael.dehaan AT gmail>
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, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
"""
import os
import glob
import json
import cobbler.api as capi
from cobbler import settings
from cobbler.cexceptions import CX
libpath = "/var/lib/cobbler/collections"
def register() -> str:
"""
The mandatory Cobbler module registration hook.
"""
return "serializer"
def what() -> str:
"""
Module identification function
"""
return "serializer/file"
def __find_double_json_files(filename: str):
"""
Finds a file with duplicate .json ending and renames it.
:param filename: Filename to be checked
:raises FileExistsError: If both JSON files exist
"""
if not os.path.isfile(filename):
if os.path.isfile(filename + ".json"):
os.rename(filename + ".json", filename)
else:
if os.path.isfile(filename + ".json"):
raise FileExistsError("Both JSON files (%s) exist!" % filename)
def serialize_item(collection, item):
"""
Save a collection item to file system
:param collection: collection
:param item: collection item
"""
if not item.name:
raise CX("name unset for item!")
collection_types = collection.collection_types()
filename = os.path.join(libpath, collection_types, item.name + ".json")
__find_double_json_files(filename)
if capi.CobblerAPI().settings().serializer_pretty_json:
sort_keys = True
indent = 4
else:
sort_keys = False
indent = None
_dict = item.serialize()
with open(filename, "w+") as file_descriptor:
data = json.dumps(_dict, sort_keys=sort_keys, indent=indent)
file_descriptor.write(data)
def serialize_delete(collection, item):
"""
Delete a collection item from file system.
:param collection: collection
:param item: collection item
"""
collection_types = collection.collection_types()
filename = os.path.join(libpath, collection_types, item.name + ".json")
__find_double_json_files(filename)
if os.path.exists(filename):
os.remove(filename)
def serialize(collection):
"""
Save a collection to file system
:param collection: collection
"""
# do not serialize settings
if collection.collection_type() != "setting":
for x in collection:
serialize_item(collection, x)
def deserialize_raw(collection_types: str):
"""
Loads a collection from the disk.
:param collection_types: The type of collection to load.
:return: The loaded dictionary.
"""
if collection_types == "settings":
return settings.read_settings_file()
else:
results = []
path = os.path.join(libpath, collection_types)
all_files = glob.glob("%s/*.json" % path)
for f in all_files:
with open(f) as file_descriptor:
json_data = file_descriptor.read()
_dict = json.loads(json_data)
results.append(_dict)
return results
def deserialize(collection, topological: bool = True):
"""
Load a collection from file system.
:param collection: The collection to deserialize.
:param topological: If the collection list should be sorted by the
collection dict key 'depth' value or not.
"""
datastruct = deserialize_raw(collection.collection_types())
if topological and isinstance(datastruct, list):
datastruct.sort(key=lambda x: x.get("depth", 1))
if isinstance(datastruct, dict):
collection.from_dict(datastruct)
elif isinstance(datastruct, list):
collection.from_list(datastruct)
| gpl-2.0 |
freeplane/freeplane | freeplane/src/main/java/org/freeplane/features/commandsearch/ShowPreferenceItemAction.java | 2299 | /*
* Freeplane - mind map editor
*
* Copyright (C) 2020 Felix Natter
*
* 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, see <http://www.gnu.org/licenses/>.
*/
package org.freeplane.features.commandsearch;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import org.freeplane.core.resources.components.OptionPanelBuilder;
import org.freeplane.core.resources.components.OptionPanelConstants;
import org.freeplane.core.resources.components.ShowPreferencesAction;
import org.freeplane.features.mode.Controller;
import org.freeplane.features.mode.mindmapmode.MModeController;
class ShowPreferenceItemAction extends AbstractAction {
private PreferencesItem preferencesItem;
ShowPreferenceItemAction(PreferencesItem preferencesItem) {
super("Show");
this.preferencesItem = preferencesItem;
}
public void actionPerformed(ActionEvent actionEvent) {
//System.out.format("Showing preferences item: %s\n", preferencesItem);
showPrefsDialog();
}
private void showPrefsDialog()
{
final Controller controller = Controller.getCurrentController();
MModeController modeController = (MModeController) controller.getModeController(MModeController.MODENAME);
OptionPanelBuilder optionPanelBuilder = modeController.getOptionPanelBuilder();
ShowPreferencesAction showPreferencesAction = MModeController.createShowPreferencesAction(optionPanelBuilder, true, this.preferencesItem.getKey());
int uniqueId = new Long(System.currentTimeMillis()).intValue();
showPreferencesAction.actionPerformed(
new ActionEvent(this, uniqueId, OptionPanelConstants.OPTION_PANEL_RESOURCE_PREFIX + preferencesItem.getTab()));
}
}
| gpl-2.0 |
ypid/series60-remote | pc/lang/app_fr.ts | 183021 | <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS><TS version="1.1">
<context>
<name>AboutDialog</name>
<message>
<location filename="ui/src/about.ui" line="14"/>
<source>About Series60-Remote</source>
<translation>À propos de Series60-remote</translation>
</message>
<message>
<location filename="ui/src/about.ui" line="54"/>
<source>Series60-Remote</source>
<translation>Series60-Remote</translation>
</message>
<message>
<location filename="ui/src/about.ui" line="73"/>
<source>Version</source>
<translation>Version</translation>
</message>
<message>
<location filename="ui/src/about.ui" line="117"/>
<source>&About</source>
<translation>À &propos</translation>
</message>
<message>
<location filename="ui/src/about.ui" line="129"/>
<source><p><b>Series60-Remote</b> is written and maintained by Lukas Hetzenecker.</p>
<p>Visit <a href="http://series60-remote.sf.net">http://series60-remote.sf.net</a> for more information on this project.</p>
<h3>Bugs and wishes</h3>
<p>Software can always be improved, and i am ready to do so. However, you - the user - must tell me when something does not work as expected or could be done better.</p>
<p>Series60-Remote has a bug tracking system. Visit <a href="http://series60-remote.sf.net">http://series60-remote.sf.net</a> to report bugs.
<h3>License</h3>
<p><a href="http://www.gnu.org/licenses/gpl-2.0.txt">GNU General Public License Version 2</a></p></source>
<translation><p><b>Series60-Remote</b> est écrit et maintenu par Lukas Hetzenecker.</p>
<p>Visitez <a href="http://series60-remote.sf.net">http://series60-remote.sf.net</a> pour plus d'informations sur ce projet.</p>
<h3>Bogues et souhaits</h3>
<p>Un logiciel peut toujours être amélioré, et je suis prêt à le faire. Cependant, vous - l'utilisateur - devez me dire lorsque quelque chose ne fonctionne pas comme escompté ou pourrait être amélioré.</p>
<p>Series60-Remote possède un système de suivi des bogues. Visitez<a href="http://series60-remote.sf.net">http://series60-remote.sf.net</a> pour en rapporter de nouveaux.</p>
<h3>Licence</h3>
<p><a href="http://www.gnu.org/licenses/gpl-2.0.txt">GNU General Public License Version 2</a></p></translation>
</message>
<message>
<location filename="ui/src/about.ui" line="166"/>
<source>&Credits</source>
<translation>&Remerciements</translation>
</message>
<message>
<location filename="ui/src/about.ui" line="199"/>
<source>Version information</source>
<translation>Informations sur la version</translation>
</message>
<message>
<location filename="ui/src/about.ui" line="238"/>
<source>Copy</source>
<translation>Copier</translation>
</message>
</context>
<context>
<name>CalendarEntry</name>
<message>
<location filename="lib/classes.py" line="684"/>
<source>Anniversary/Birthday</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/classes.py" line="686"/>
<source>Appointment</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/classes.py" line="688"/>
<source>Memo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/classes.py" line="690"/>
<source>To-do</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CalendarEntryEdit</name>
<message>
<location filename="ui/src/calendar_edit.ui" line="56"/>
<source>Title:</source>
<translation type="unfinished">Titre :</translation>
</message>
<message>
<location filename="ui/src/calendar_edit.ui" line="69"/>
<source>Location:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit.ui" line="82"/>
<source>Start:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit.ui" line="106"/>
<source>End:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit.ui" line="135"/>
<source>No recurrence</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit.ui" line="145"/>
<source>Edit...</source>
<translation type="unfinished">Modifier...</translation>
</message>
<message>
<location filename="ui/src/calendar_edit.ui" line="169"/>
<source>Reminder:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit.ui" line="260"/>
<source>Advanced...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit.ui" line="285"/>
<source>Priority:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit.ui" line="305"/>
<source>Access:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="41"/>
<source>minute(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="42"/>
<source>hour(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="43"/>
<source>day(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="45"/>
<source>High</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="46"/>
<source>Normal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="47"/>
<source>Low</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="49"/>
<source>Open</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="50"/>
<source>Private</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="51"/>
<source>Restricted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="59"/>
<source>Add %1</source>
<comment>Add [type of event]</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="61"/>
<source>Edit %1</source>
<comment>Edit [type of event]</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="165"/>
<source>No title found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="165"/>
<source>Please specify a title.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="170"/>
<source>No active connection.</source>
<translation type="unfinished">Aucune connexion active.</translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="170"/>
<source>You aren't connected to a mobile phone.
All changes will get lost.</source>
<translation type="unfinished">Vous n'êtes connecté à aucun téléphone mobile.
Toutes les modifications seront perdues.</translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="182"/>
<source>Event Entry Validation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/calendar_edit.py" line="182"/>
<source>The event ends before it starts. Please correct dates and times.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CalendarEntryRecurrenceEdit</name>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="14"/>
<source>Edit recurrence</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="39"/>
<source>&Enable recurrence</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="61"/>
<source>Recurrence Rule</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="87"/>
<source>Recurrence Types</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="100"/>
<source>&Daily</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="113"/>
<source>&Weekly</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="129"/>
<source>&Monthly</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="142"/>
<source>&Yearly</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="495"/>
<source>Recur every</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="190"/>
<source>day(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="242"/>
<source>week(s) on:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="365"/>
<source>month(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="593"/>
<source>Recur on the</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="405"/>
<source>day</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="509"/>
<source>year(s)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="536"/>
<source>Recur on day</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="613"/>
<source>of</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="682"/>
<source>Recurrence Range</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="700"/>
<source>Start date:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="720"/>
<source>Ending date:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="740"/>
<source>No ending date</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="766"/>
<source>Exceptions</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="796"/>
<source>&Add</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/calendar_edit_recurrence.ui" line="803"/>
<source>&Delete</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CalendarGraphicsView</name>
<message>
<location filename="widget/CalendarGraphicsView.py" line="33"/>
<source>%1 %2</source>
<comment>monthname year</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarGraphicsView.py" line="142"/>
<source>%1 %2</source>
<comment>'Month day' for month view cells</comment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CalendarItem</name>
<message>
<location filename="lib/calendaritem.py" line="70"/>
<source>Location:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/calendaritem.py" line="74"/>
<source>Date:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/calendaritem.py" line="78"/>
<source>From:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/calendaritem.py" line="80"/>
<source>To:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/calendaritem.py" line="82"/>
<source>Duration:</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="lib/calendaritem.py" line="82"/>
<source>%n day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="lib/calendaritem.py" line="88"/>
<source>Recurrence:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CalendarScene</name>
<message>
<location filename="widget/CalendarScene.py" line="189"/>
<source>Delete calendar entry</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarScene.py" line="189"/>
<source>Do you really want permanently remove the calendar entry "%1"?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarScene.py" line="230"/>
<source>&Edit...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarScene.py" line="231"/>
<source>&Remove...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarScene.py" line="233"/>
<source>&Remove this recurrence...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarScene.py" line="249"/>
<source>New Appointment...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarScene.py" line="251"/>
<source>New Memo...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarScene.py" line="253"/>
<source>New Anniversary/Birthday...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarScene.py" line="255"/>
<source>New To-do...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CalendarView</name>
<message>
<location filename="widget/CalendarView.py" line="54"/>
<source>Go back one month</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarView.py" line="60"/>
<source>Go back one week</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarView.py" line="66"/>
<source>Go to today</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarView.py" line="72"/>
<source>Go forward one week</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/CalendarView.py" line="78"/>
<source>Go forward one month</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Chat</name>
<message>
<location filename="ui/src/chat.ui" line="14"/>
<source>Chat</source>
<translation>Discussion</translation>
</message>
<message>
<location filename="ui/src/chat.ui" line="73"/>
<source>Send</source>
<translation>Envoyer</translation>
</message>
<message>
<location filename="ui/src/chat.ui" line="76"/>
<source>Ctrl+S</source>
<translation>Ctrl+S</translation>
</message>
<message>
<location filename="ui/src/chat.ui" line="96"/>
<source>160 chars left; 1 message</source>
<translation>160 caractères restants, 1 message</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Please chosse the telephone number for contact <i>%1</i>:</source>
<translation type="obsolete">Veuillez choisir le numéro téléphone pour le contact <i>%1</i> :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>%1 chars left; %2 message</source>
<translation type="obsolete">%1 caractères restants, %2 message</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>%1 chars left; %2 messages</source>
<translation type="obsolete">%1 caractères restants, %2 messages</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>[%1] 1 message in queue</source>
<translation type="obsolete">[%1] 1 message dans la file</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>[%1] %2 messages in queue</source>
<translation type="obsolete">[%1] %2 messages dans la file</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>[%1] All messages were sended</source>
<translation type="obsolete">[%1] Tous les messages ont été envoyés</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>%1 chars left; %n message(s)</source>
<translation type="obsolete">%1 caractères restants ; %n messages
</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>[%1] %n message(s) in queue</source>
<translation type="obsolete">[%1] %n messages restants
</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>[%1] All messages were sent</source>
<translation type="obsolete">[%1] Tous les messages ont été envoyés</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Please choose the telephone number for contact <i>%1</i>:</source>
<translation type="obsolete">Veuillez choisir le numéro de téléphone pour le contact <i>%1</i> :</translation>
</message>
</context>
<context>
<name>ChatMessageView</name>
<message>
<location filename="widget/ChatMessageView.py" line="321"/>
<source>Chat theme could not be found, or is invalid.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChatWidget</name>
<message>
<location filename="widget/ChatWidget.py" line="67"/>
<source>Please enter a valid mobile phone number:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/ChatWidget.py" line="133"/>
<source>Please choose the telephone number for contact <i>%1</i>:</source>
<translation type="unfinished">Veuillez choisir le numéro de téléphone pour le contact <i>%1</i> :</translation>
</message>
<message numerus="yes">
<location filename="widget/ChatWidget.py" line="158"/>
<source>%1 chars left; %n message(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message numerus="yes">
<location filename="widget/ChatWidget.py" line="184"/>
<source>[%1] %n message(s) in queue</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="widget/ChatWidget.py" line="186"/>
<source>[%1] All messages were sent</source>
<translation type="unfinished">[%1] Tous les messages ont été envoyés</translation>
</message>
</context>
<context>
<name>Connection</name>
<message>
<location filename="devices/null.py" line="17"/>
<source>None (Just for testing)</source>
<translation>Aucune (juste pour tester)</translation>
</message>
</context>
<context>
<name>ConnectionFailedDialog</name>
<message>
<location filename="ui/src/connection_failed.ui" line="14"/>
<source>Connection failed</source>
<translation>Échec de la connexion</translation>
</message>
<message>
<location filename="ui/src/connection_failed.ui" line="24"/>
<source>The connection to the <i>S60 Remote Service</i> of your mobile phone failed.<br /></source>
<translation>La connexion à <i>Series60-Remote</i> sur votre téléphone mobile a échoué.<br /></translation>
</message>
<message>
<location filename="ui/src/connection_failed.ui" line="34"/>
<source>The following error was returned:</source>
<translation>L'erreur suivante a été renvoyée :</translation>
</message>
<message>
<location filename="ui/src/connection_failed.ui" line="61"/>
<source>Error number:</source>
<translation>Numéro d'erreur :</translation>
</message>
<message>
<location filename="ui/src/connection_failed.ui" line="75"/>
<source>Error message:</source>
<translation>Message d'erreur :</translation>
</message>
<message>
<location filename="ui/src/connection_failed.ui" line="109"/>
<source>Please make sure that you:
<ul><li>Enabled bluetooth on your mobile phone
<li>Installed the <i>S60 Remote Service</i>
<li>Started the <i>S60 Remote Service</i>
<li>and that your bluetooth mobile phone is within reach
<br /></source>
<translation>Assurez-vous d'avoir :
<ul><li>Activé le bluetooth sur votre téléphone mobile
<li>Installé le <li>Series60-Remote
<li>Démarré le <li>Series60-Remote
<li>Votre téléphone portable à portée de bluetooth
<br />
</translation>
</message>
<message>
<location filename="ui/src/connection_failed.ui" line="126"/>
<source>Reinstall S60 Remote service</source>
<translation>Réinstaller Series60-Remote</translation>
</message>
</context>
<context>
<name>ConnectionUpdateVersionDialog</name>
<message>
<location filename="ui/src/connection_update_version.ui" line="14"/>
<source>Install/Update S60 Remote service</source>
<translation>Installer/Mettre à jour Series60-Remote</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="122"/>
<source>Send PyS60 package to mobile phone... </source>
<translation>Envoyer le paquet PyS60 vers votre téléphone mobile...</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="197"/>
<source>Please continue the installation on your mobile phone!</source>
<translation>Veuillez continuer l'installation sur votre téléphone portable !</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="177"/>
<source>Send Series60-Remote package to mobile phone... </source>
<translation>Envoyer le paquet Series60-Remote vers votre téléphone mobile...</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="228"/>
<source>Unfortunately, the following error appeared:<br />
- The python binding for <i>obexftp</i> isn't installed.</source>
<translation>Malheureusement, l'erreur suivante s'est produite :<br />
- La dépendance python pour <i>obexftp</i> n'est pas installée.</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="261"/>
<source>Either you install the required package (for instance on Fedora: <i>yum install python-obexftp</i>)<br />
or you transfer the files <i>PythonForS60_1_4_5_3rdEd.sis</i> and <i>series60-remote.sis</i> in the directory <i>mobile</i> manually to your device (you could use the application <i>kbluetooth</i>)</source>
<translation>Soit vous installez le paquet requis (par exemple pour Fedora : <i>yum install python-obexftp</i>)<br />
soit vous transférez manuellement les fichiers <i>PythonForS60_1_4_5_3rdEd.sis</i> et </i>series60-remote.sis</i> dans le répertoire <i>mobile</i> vers votre appareil (vous pouvez utiliser l'application <i>kbluetooth</i>)</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="291"/>
<source>You have to transfer the files <i>PythonForS60_1_4_5_3rdEd.sis</i> and <i>series60-remote.sis</i> in the directory <i>mobile</i> manually to your device.
Please use <i>Nokia PC Suite</i>.</source>
<translation>Vous devez transférer les fichiers <i>PythonForS60_1_4_5_3rdEd.sis</i> et <i>series60-remote.sis</i> dans le répertoire <i>mobile</i> de votre appareil.
Merci d'utiliser <i>Nokia PC Suite</i>.</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="308"/>
<source>Open Folder</source>
<translation>Ouvrir un dossier</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="32"/>
<source>Install or update the <i>S60 Remote service</i> on your mobile phone.</source>
<translation>Installer ou mettre à jour le <i>Series60-Remote</i> sur votre téléphone mobile.</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="44"/>
<source><i>Series 60-Remote</i> requires <i>Python for S60</i> (PyS60), so please install this package first, if you haven't already.</source>
<translation>Le <i>Series60-Remote</i> requiert <i>Python pour S60</i> (PyS60), vous devez installer ce paquet dans un premier temps, si ce n'est déjà fait.</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="107"/>
<source>Step 1:</source>
<translation>Étape 1 :</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="156"/>
<source>Step 2:</source>
<translation>Étape 2 :</translation>
</message>
<message>
<location filename="ui/src/connection_update_version.ui" line="56"/>
<source>I want to use PyS60 2.0.0.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ConnectionVersionMismatchDialog</name>
<message>
<location filename="ui/src/connection_version_mismatch.ui" line="14"/>
<source>Version mismatch</source>
<translation>Les versions ne correspondent pas</translation>
</message>
<message>
<location filename="ui/src/connection_version_mismatch.ui" line="27"/>
<source>The version of the <i>S60 Remote service</i> on your mobile phone isn't compatible with the version of your PC client.</source>
<translation>La version de <i>Series60-Remote</i> sur votre téléphone mobile n'est pas compatible avec la version client sur votre PC.</translation>
</message>
<message>
<location filename="ui/src/connection_version_mismatch.ui" line="39"/>
<source>Mobile phone version:</source>
<translation>Version sur le téléphone mobile :</translation>
</message>
<message>
<location filename="ui/src/connection_version_mismatch.ui" line="53"/>
<source>PC version:</source>
<translation>Version sur le PC :</translation>
</message>
<message>
<location filename="ui/src/connection_version_mismatch.ui" line="69"/>
<source>Please update the <i>S60 Remote service</i>.</source>
<translation>Veuillez mettre à jour le <i>Series60-Remote</i>.</translation>
</message>
<message>
<location filename="ui/src/connection_version_mismatch.ui" line="78"/>
<source>Update S60 Remote service</source>
<translation>Mettre à jour Series60-Remote</translation>
</message>
</context>
<context>
<name>ContactCanvas</name>
<message>
<location filename="widget/ContactCanvas.py" line="42"/>
<source>Matplotlib not found - Please install it.</source>
<translation>Matplotlib non trouvé. Veuillez l'installer.</translation>
</message>
</context>
<context>
<name>ContactField</name>
<message>
<location filename="lib/classes.py" line="136"/>
<source>Last name:</source>
<translation>Nom :</translation>
</message>
<message>
<location filename="lib/classes.py" line="138"/>
<source>First name:</source>
<translation>Prénom :</translation>
</message>
<message>
<location filename="lib/classes.py" line="140"/>
<source>Job title:</source>
<translation>Poste :</translation>
</message>
<message>
<location filename="lib/classes.py" line="142"/>
<source>Company:</source>
<translation>Société :</translation>
</message>
<message>
<location filename="lib/classes.py" line="144"/>
<source>Telephone:</source>
<translation>Téléphone :</translation>
</message>
<message>
<location filename="lib/classes.py" line="146"/>
<source>Mobile:</source>
<translation>Mobile :</translation>
</message>
<message>
<location filename="lib/classes.py" line="148"/>
<source>Pager:</source>
<translation>Pager :</translation>
</message>
<message>
<location filename="lib/classes.py" line="150"/>
<source>Fax:</source>
<translation>Fax :</translation>
</message>
<message>
<location filename="lib/classes.py" line="152"/>
<source>E-mail:</source>
<translation>E-mail :</translation>
</message>
<message>
<location filename="lib/classes.py" line="154"/>
<source>Web address:</source>
<translation>Adresse web :</translation>
</message>
<message>
<location filename="lib/classes.py" line="158"/>
<source>Post-office box:</source>
<translation>Boîte postale :</translation>
</message>
<message>
<location filename="lib/classes.py" line="160"/>
<source>Extension:</source>
<translation></translation>
</message>
<message>
<location filename="lib/classes.py" line="162"/>
<source>Street:</source>
<translation>Rue :</translation>
</message>
<message>
<location filename="lib/classes.py" line="164"/>
<source>Postal/ZIP code:</source>
<translation>Code postal :</translation>
</message>
<message>
<location filename="lib/classes.py" line="166"/>
<source>City:</source>
<translation>Ville :</translation>
</message>
<message>
<location filename="lib/classes.py" line="168"/>
<source>State/Province:</source>
<translation>État/Province :</translation>
</message>
<message>
<location filename="lib/classes.py" line="170"/>
<source>Country/Region:</source>
<translation>Pays/Région :</translation>
</message>
<message>
<location filename="lib/classes.py" line="172"/>
<source>DTMF:</source>
<translation>DTMF :</translation>
</message>
<message>
<location filename="lib/classes.py" line="174"/>
<source>Birthday:</source>
<translation>Anniversaire :</translation>
</message>
<message>
<location filename="lib/classes.py" line="176"/>
<source>Note:</source>
<translation>Note :</translation>
</message>
<message>
<location filename="lib/classes.py" line="178"/>
<source>Thumbnail image:</source>
<translation></translation>
</message>
<message>
<location filename="lib/classes.py" line="180"/>
<source>Title:</source>
<translation>Titre :</translation>
</message>
<message>
<location filename="lib/classes.py" line="182"/>
<source>Suffix:</source>
<translation>Suffixe :</translation>
</message>
<message>
<location filename="lib/classes.py" line="184"/>
<source>Nickname:</source>
<translation>Pseudo :</translation>
</message>
<message>
<location filename="lib/classes.py" line="186"/>
<source>Video call:</source>
<translation>Appel vidéo :</translation>
</message>
<message>
<location filename="lib/classes.py" line="188"/>
<source>Internet telephone:</source>
<translation>Téléphone internet :</translation>
</message>
<message>
<location filename="lib/classes.py" line="190"/>
<source>Push to talk:</source>
<translation></translation>
</message>
<message>
<location filename="lib/classes.py" line="192"/>
<source>Share view:</source>
<translation></translation>
</message>
<message>
<location filename="lib/classes.py" line="194"/>
<source>SIP:</source>
<translation>SIP :</translation>
</message>
<message>
<location filename="lib/classes.py" line="196"/>
<source>Personal ringtone:</source>
<translation>Sonnerie personnelle :</translation>
</message>
<message>
<location filename="lib/classes.py" line="205"/>
<source> (%1) </source>
<translation> (%1) </translation>
</message>
<message>
<location filename="lib/classes.py" line="203"/>
<source>Home</source>
<translation>Personnel</translation>
</message>
<message>
<location filename="lib/classes.py" line="205"/>
<source>Business</source>
<translation>Professionnel</translation>
</message>
<message>
<location filename="lib/classes.py" line="208"/>
<source>%1 (%2):</source>
<translation>%1 (%2):</translation>
</message>
<message>
<location filename="lib/classes.py" line="156"/>
<source>Address:</source>
<translation type="unfinished">Adresse :</translation>
</message>
</context>
<context>
<name>ContactsEdit</name>
<message>
<location filename="ui/src/contacts_edit.ui" line="17"/>
<source>New contact...</source>
<translation>Nouveau contact...</translation>
</message>
<message>
<location filename="ui/src/contacts_edit.ui" line="40"/>
<source>General</source>
<translation>Général</translation>
</message>
<message>
<location filename="ui/src/contacts_edit.ui" line="122"/>
<source>Name:</source>
<translation>Nom :</translation>
</message>
<message>
<location filename="ui/src/contacts_edit.ui" line="1078"/>
<source>Edit...</source>
<translation>Modifier...</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Company:</source>
<translation type="obsolete">Société :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Job title:</source>
<translation type="obsolete">Poste :</translation>
</message>
<message>
<location filename="ui/src/contacts_edit.ui" line="1062"/>
<source>Address:</source>
<translation>Adresse :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Birthday:</source>
<translation type="obsolete">Anniversaire :</translation>
</message>
<message>
<location filename="ui/src/contacts_edit.ui" line="343"/>
<source>Groups:</source>
<translation>Groupes :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Telephone:</source>
<translation type="obsolete">Téléphone :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>...</source>
<translation type="obsolete">...</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Mobile:</source>
<translation type="obsolete">Mobile :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Fax:</source>
<translation type="obsolete">Fax :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Pager:</source>
<translation type="obsolete">Pager :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>E-mail:</source>
<translation type="obsolete">E-mail :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Web address:</source>
<translation type="obsolete">Adresse web :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>DTMF:</source>
<translation type="obsolete">DTMF :</translation>
</message>
<message>
<location filename="ui/src/contacts_edit.ui" line="727"/>
<source>Home</source>
<translation>Personnel</translation>
</message>
<message>
<location filename="ui/src/contacts_edit.ui" line="1036"/>
<source>Business</source>
<translation>Professionnel</translation>
</message>
<message>
<location filename="ui/src/contacts_edit.ui" line="1345"/>
<source>Notes</source>
<translation>Notes</translation>
</message>
<message>
<location filename="ui/src/contacts_edit.ui" line="1365"/>
<source>Notes:</source>
<translation>Notes :</translation>
</message>
<message>
<location filename="ui/src/contacts_edit.ui" line="1379"/>
<source>New note</source>
<translation>Nouvelle note</translation>
</message>
<message>
<location filename="window/contacts_edit.py" line="64"/>
<source>Edit contact "%1"...</source>
<translation>Modifier le contact « %1 »...</translation>
</message>
<message>
<location filename="window/contacts_edit.py" line="472"/>
<source>No active connection.</source>
<translation>Aucune connexion active.</translation>
</message>
<message>
<location filename="window/contacts_edit.py" line="472"/>
<source>You aren't connected to a mobile phone.
All changes will get lost.</source>
<translation>Vous n'êtes connecté à aucun téléphone mobile.
Toutes les modifications seront perdues.</translation>
</message>
</context>
<context>
<name>ContactsEditAddress</name>
<message>
<location filename="ui/src/contacts_edit_address.ui" line="17"/>
<source>Edit contact address...</source>
<translation>Modifier l'adresse du contact...</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Street:</source>
<translation type="obsolete">Rue :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Postal/ZIP code:</source>
<translation type="obsolete">Code postal :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>City:</source>
<translation type="obsolete">Ville :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>State/Province:</source>
<translation type="obsolete">État/Province :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Country/Region:</source>
<translation type="obsolete">Pays/Région :</translation>
</message>
</context>
<context>
<name>ContactsEditName</name>
<message>
<location filename="ui/src/contacts_edit_name.ui" line="17"/>
<source>Edit contact name</source>
<translation>Modifier le nom du contact</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Title:</source>
<translation type="obsolete">Titre :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>First name:</source>
<translation type="obsolete">Prénom :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Suffix:</source>
<translation type="obsolete">Suffixe :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Last name:</source>
<translation type="obsolete">Nom :</translation>
</message>
</context>
<context>
<name>ContactsImport</name>
<message>
<location filename="ui/src/contacts_import.ui" line="14"/>
<source>Import contacts...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/contacts_import.ui" line="64"/>
<source>Contacts:</source>
<translation type="unfinished">Contacts :</translation>
</message>
<message>
<location filename="ui/src/contacts_import.ui" line="94"/>
<source>Details:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/contacts_import.ui" line="123"/>
<source>Open File...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/contacts_import.ui" line="140"/>
<source>Import contacts</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/contacts_import.py" line="117"/>
<source>Open vcard file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/contacts_import.py" line="117"/>
<source>Vcards (*.vcf);;All files (*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/contacts_import.py" line="119"/>
<source>Open ldif file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/contacts_import.py" line="119"/>
<source>LDIF (*.ldif);;All files (*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/contacts_import.py" line="132"/>
<source>%1 not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/contacts_import.py" line="132"/>
<source>Exporting %1 objects is not possible:
Please install the %2 module.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/contacts_import.py" line="174"/>
<source>Error import</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/contacts_import.py" line="174"/>
<source>An error occured while parsing the file:
%1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Database</name>
<message>
<location filename="lib/database.py" line="343"/>
<source>Unknown error</source>
<translation>Erreur inconnue</translation>
</message>
</context>
<context>
<name>DeviceModel</name>
<message>
<location filename="lib/devicemodel.py" line="126"/>
<source>unknown</source>
<translation type="unfinished">inconnu</translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="131"/>
<source>Miscellaneous</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="135"/>
<source>Computer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="139"/>
<source>Desktop workstation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="141"/>
<source>Server-class computer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="143"/>
<source>Laptop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="146"/>
<source>Handheld PC/PDA</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="149"/>
<source>Palm sized PC/PDA</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="152"/>
<source>Wearable computer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="157"/>
<source>Phone</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="161"/>
<source>Cellular</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="163"/>
<source>Cordless</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="165"/>
<source>Smart phone</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="167"/>
<source>Wired modem or voice gateway</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="170"/>
<source>Common ISDN Access</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="175"/>
<source>LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="180"/>
<source>Fully available</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="183"/>
<source>1 - 17% utilized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="186"/>
<source>17 - 33% utilized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="189"/>
<source>33 - 50% utilized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="191"/>
<source>50 - 67% utilized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="193"/>
<source>67 - 83% utilized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="195"/>
<source>83 - 99% utilized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="197"/>
<source>No service available</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="201"/>
<source>Audio/Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="205"/>
<source>Wearable Headset Device</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="208"/>
<source>Hands-free Device</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="250"/>
<source>(Reserved)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="213"/>
<source>Microphone</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="216"/>
<source>Loudspeakers</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="219"/>
<source>Headphone</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="222"/>
<source>Portable audio</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="225"/>
<source>Car audio</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="228"/>
<source>Set-top box</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="231"/>
<source>HiFi Audio Device</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="234"/>
<source>VCR</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="237"/>
<source>Video Camera</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="239"/>
<source>Camcorder</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="241"/>
<source>Video Monitor</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="244"/>
<source>Video Display and Loudspeaker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="247"/>
<source>Video Conferencing</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="252"/>
<source>Gaming/Toy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="257"/>
<source>Peripheral</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="263"/>
<source>Keyboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="266"/>
<source>Pointing device</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="269"/>
<source>Combo keyboard/pointing device</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="273"/>
<source>Joystick</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="275"/>
<source>Gamepad</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="278"/>
<source>Remote control</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="280"/>
<source>Sensing device</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="282"/>
<source>Digitizer tablet</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="285"/>
<source>Card Reader</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="297"/>
<source>Imaging</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="301"/>
<source>Display</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="304"/>
<source>Camera</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="307"/>
<source>Scanner</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="310"/>
<source>Printer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="317"/>
<source>Wearable</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="319"/>
<source>Wrist Watch</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="321"/>
<source>Pager</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="323"/>
<source>Jacket</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="325"/>
<source>Helmet</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="327"/>
<source>Glasses</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="331"/>
<source>Toy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="333"/>
<source>Robot</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="335"/>
<source>Vehicle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="337"/>
<source>Doll / Action Figure</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="339"/>
<source>Controller</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="342"/>
<source>Game</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="347"/>
<source>Uncategorized</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="360"/>
<source>Scan in progress...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="362"/>
<source>Scanning failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="364"/>
<source>Please start a scan...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="366"/>
<source>No devices found</source>
<translation type="unfinished">Aucun appareil trouvé</translation>
</message>
<message>
<location filename="lib/devicemodel.py" line="368"/>
<source>No devices selected</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DeviceScanWidget</name>
<message>
<location filename="widget/DeviceWidget.py" line="65"/>
<source>Rescan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/DeviceWidget.py" line="94"/>
<source>Send Python SIS file to device (PyS60 1.4)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/DeviceWidget.py" line="95"/>
<source>Send Application SIS file to device (PyS60 1.4)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/DeviceWidget.py" line="96"/>
<source>Send Python SIS file to device (PyS60 2.0)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/DeviceWidget.py" line="97"/>
<source>Send Application SIS file to device (PyS60 2.0)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Export</name>
<message>
<location filename="ui/src/export.ui" line="14"/>
<source>Export</source>
<translation>Export</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="142"/>
<source>Contact export...</source>
<translation>Exporter des contacts...</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="151"/>
<source>Export all contacts</source>
<translation>Exporter tous les contacts</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="161"/>
<source>Only export contacts with at least one message</source>
<translation>Exporter uniquement les contacts avec au moins un message</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="168"/>
<source>Filter contacts and show only messages from these contacts:</source>
<translation>Filtrer les contacts et montrer les messages de ces derniers uniquement :</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="187"/>
<source>Select All</source>
<translation>Tout sélectionner</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="197"/>
<source>Deselect All</source>
<translation>Tout désélectionner</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="39"/>
<source>Settings</source>
<translation>Paramètres</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="314"/>
<source>Format:</source>
<translation>Format :</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="233"/>
<source>Period per file:</source>
<translation></translation>
</message>
<message>
<location filename="ui/src/export.ui" line="250"/>
<source>Message order:</source>
<translation>Ordre des messages :</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="99"/>
<source>Export directory:</source>
<translation>Répertoire d'export :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>...</source>
<translation type="obsolete">...</translation>
</message>
<message>
<location filename="window/export.py" line="204"/>
<source>No export directory selected!</source>
<translation>Aucun répertoire d'export sélectionné !</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>HTML settings</source>
<translation type="obsolete">Paramètres HTML</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="282"/>
<source>Include statistics graph</source>
<translation>Inclure le graphique des statistiques</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="339"/>
<source>Show legend</source>
<translation>Afficher la légende</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="353"/>
<source>Show thumbnail images for contacts</source>
<translation>Afficher les images miniatures pour les contacts</translation>
</message>
<message>
<location filename="window/export.py" line="50"/>
<source>Export...</source>
<translation>Exporter...</translation>
</message>
<message>
<location filename="window/export.py" line="75"/>
<source>No contacts available</source>
<translation>Aucun contact disponible</translation>
</message>
<message>
<location filename="window/export.py" line="91"/>
<source>Daily</source>
<translation>Quotidien</translation>
</message>
<message>
<location filename="window/export.py" line="92"/>
<source>Monthly</source>
<translation>Mensuel</translation>
</message>
<message>
<location filename="window/export.py" line="93"/>
<source>Yearly</source>
<translation>Annuel</translation>
</message>
<message>
<location filename="window/export.py" line="94"/>
<source>All messages in one file</source>
<translation>Tous les messages en un seul fichier</translation>
</message>
<message>
<location filename="window/export.py" line="97"/>
<source>Ascending</source>
<translation>Croissant</translation>
</message>
<message>
<location filename="window/export.py" line="98"/>
<source>Descending</source>
<translation>Décroissant</translation>
</message>
<message>
<location filename="window/export.py" line="198"/>
<source>Select export directory</source>
<translation>Sélectionner le répertoire d'export</translation>
</message>
<message>
<location filename="window/export.py" line="207"/>
<source>Invalid export directory!</source>
<translation>Répertoire d'export invalide !</translation>
</message>
<message>
<location filename="window/export.py" line="210"/>
<source>Cannot write to export directory!</source>
<translation>Impossible d'écrire dans le dossier d'export !</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="58"/>
<source>Export items:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/export.ui" line="67"/>
<source>Contacts</source>
<translation type="unfinished">Contacts</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="77"/>
<source>Messages</source>
<translation type="unfinished">Messages</translation>
</message>
<message>
<location filename="ui/src/export.ui" line="87"/>
<source>Calendar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/export.ui" line="222"/>
<source>Plugin settings</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ExportProgress</name>
<message>
<location filename="ui/src/export_progress.ui" line="14"/>
<source>Export progress</source>
<translation>Progression de l'export</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Writing to: <i>unknown</i></source>
<translation type="obsolete">Écriture dans :<i>inconnu</i></translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Writing to: <i>%1</i></source>
<translation type="obsolete">Écriture dans : <i>%1</li></translation>
</message>
<message>
<location filename="window/export_progress.py" line="106"/>
<source>Abort export process</source>
<translation>Annuler le processus d'export</translation>
</message>
<message>
<location filename="window/export_progress.py" line="106"/>
<source>Do you really want to cancel this operation?</source>
<translation>Voulez-vous réellement annuler cette opération ?</translation>
</message>
<message>
<location filename="ui/src/export_progress.ui" line="31"/>
<source>Progress of messages and contact export</source>
<translation>Progression de l'export des messages et contacts</translation>
</message>
<message>
<location filename="ui/src/export_progress.ui" line="53"/>
<source>Exporting messages...</source>
<translation>Export des messages...</translation>
</message>
<message>
<location filename="ui/src/export_progress.ui" line="129"/>
<source>Create calendar...</source>
<translation>Création de l'agenda...</translation>
</message>
<message>
<location filename="ui/src/export_progress.ui" line="205"/>
<source>Exporting contacts...</source>
<translation>Export des contacts...</translation>
</message>
<message>
<location filename="ui/src/export_progress.ui" line="281"/>
<source>Exporting calendar...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/export_progress.ui" line="357"/>
<source>Writing to:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/export_progress.ui" line="369"/>
<source>unknown</source>
<translation type="unfinished">inconnu</translation>
</message>
</context>
<context>
<name>FavoriteMenu</name>
<message>
<location filename="lib/favorites.py" line="35"/>
<source>&Favorites</source>
<translation>&Favoris</translation>
</message>
<message>
<location filename="lib/favorites.py" line="38"/>
<source>Favorites</source>
<translation>Favoris</translation>
</message>
<message>
<location filename="lib/favorites.py" line="50"/>
<source>&Manage Favorites</source>
<translation>&Gérer les favoris</translation>
</message>
</context>
<context>
<name>Favorites</name>
<message>
<location filename="ui/src/favorites.ui" line="14"/>
<source>Manage favorites</source>
<translation>Gérer les favoris</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="26"/>
<source>Static favorites</source>
<translation>Favoris statiques</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="40"/>
<source>Favorite contacts:</source>
<translation>Contacts favoris :</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="80"/>
<source>Available contacts:</source>
<translation>Contacts disponibles :</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="95"/>
<source>Dynamic Favorites</source>
<translation>Favoris dynamiques</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="107"/>
<source>Only show favorites from the list above.</source>
<translation>Afficher uniquement les favoris de la liste ci-dessus.</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="114"/>
<source>Show contacts with the most messages.</source>
<translation>Afficher les contacts avec le plus de messages.</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="123"/>
<source>Show contacts with the most messages within the last</source>
<translation>Montrer les contacts avec le plus de messages durant les derniers</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="149"/>
<source>days.</source>
<translation>jours.</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="161"/>
<source>Options</source>
<translation>Options</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="173"/>
<source>Show favorites in a sub-menu</source>
<translation>Afficher les favoris dans un sous-menu</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="182"/>
<source>Show</source>
<translation>Afficher</translation>
</message>
<message>
<location filename="ui/src/favorites.ui" line="196"/>
<source>dynamic favorites</source>
<translation>favoris dynamiques</translation>
</message>
<message>
<location filename="window/favorites.py" line="60"/>
<source>No contacts available</source>
<translation>Aucun contact disponible</translation>
</message>
</context>
<context>
<name>GeneralFormatter</name>
<message>
<location filename="lib/export_general.py" line="111"/>
<source>All messages</source>
<translation>Tous les messages</translation>
</message>
<message>
<location filename="lib/export_general.py" line="119"/>
<source>Messages for %1</source>
<translation>Messages pour %1</translation>
</message>
</context>
<context>
<name>HTMLFormatter</name>
<message>
<location filename="lib/export_html.py" line="705"/>
<source>Homepage</source>
<translation>Page d'accueil</translation>
</message>
<message>
<location filename="lib/export_html.py" line="561"/>
<source>Messages</source>
<translation>Messages</translation>
</message>
<message>
<location filename="lib/export_html.py" line="679"/>
<source>Contacts</source>
<translation>Contacts</translation>
</message>
<message>
<location filename="lib/export_html.py" line="704"/>
<source>Exported messages</source>
<translation>Messages exportés</translation>
</message>
<message>
<location filename="lib/export_html.py" line="545"/>
<source>Next</source>
<translation>Suivant</translation>
</message>
<message>
<location filename="lib/export_html.py" line="384"/>
<source>All messages</source>
<translation>Tous les messages</translation>
</message>
<message>
<location filename="lib/export_html.py" line="537"/>
<source>Back</source>
<translation>Retour</translation>
</message>
<message>
<location filename="lib/export_html.py" line="563"/>
<source>You can use the calendar in the left sidebar to browse through your message archive.</source>
<translation>Utiliser le calendrier dans la barre de gauche pour naviguer dans les archives de vos messages.</translation>
</message>
<message>
<location filename="lib/export_html.py" line="638"/>
<source>Message statistics</source>
<translation>Statistiques des contacts</translation>
</message>
<message>
<location filename="lib/export_html.py" line="614"/>
<source>Contact - %1</source>
<translation>Contact - %1</translation>
</message>
<message>
<location filename="lib/export_html.py" line="703"/>
<source>Exported Messages - Homepage</source>
<translation>Messages exportés - Accueil</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source><p>These messages and contacts were exported using
<a href="http://series60-remote.sourceforge.net" target="_blank"><i>Series60-Remote</i></a>, a Software Suite for S60 mobile phones.<br />
To show your messages, click on the <a href="messages/index.html">Messages</a> tab in the navigation bar and to get an overview
of your contacts click on the <a href="contacts/index.html">Contact</a> tab.</p>
</source>
<translation type="obsolete"><p>Ces messages et contacts ont été exportés en utilisant
<a href="http://series60-remote.sourceforge.net" target="_blank"><i>Series60-Remote</i></a>, une suite logicielle pour les téléphones mobiles S60.<br />
Pour afficher vos messages, cliquez sur l'onglet <a href="messages/index.html">Messages</a> dans la barre de navigation et pour avoir un aperçu de vos contacts
cliquez sur l'onglet <a href="contacts/index.html">Contact</a>.</p></translation>
</message>
<message>
<location filename="lib/export_html.py" line="721"/>
<source><p><h1>General statistics</h1></p>
<p><b>%1</b> incoming messages, <b>%2</b> outgoing messages, <b>%3</b> total messages.<br />
The total number of stored days is <b>%4</b>.<br />
You receive <b>%5</b> and send <b>%6</b> messages per day on average.<br />
There are alltogether <b>%7</b> contacts in my database, <b>%8</b> of them are shown on your mobile phone.<br />
The average length of an incoming message is <b>%9</b> chars, of an outgoing message <b>%10</b> chars.</p></source>
<translation><p><h1>Statistiques générales</h1></p>
<p><b>%1</b> messages entrants, <b>%2</b> messages sortants, <b>%3</b> messages au total.<br />
Le nombre total de jours stockés est de <b>%4</b>.<br />
Vous avez en moyenne reçu <b>%5</b> et envoyé <b>%6></b> messages par jour.<br />
Il y a en tout <b>%7</b> contacts dans la base, <b>%8</b> d'entre eux sont affichés sur le téléphone.<br />
La taille moyenne est de <b>%9</b> caractères par message entrant, et de <b>%10</b> caractères par message sortant.</p></translation>
</message>
<message>
<location filename="lib/export_html.py" line="728"/>
<source><p><i>This file was generated on %1</i></p></source>
<translation><p><i>Ce fichier a été généré le %1</i></p></translation>
</message>
<message>
<location filename="lib/export_html.py" line="778"/>
<source>Incoming messages</source>
<translation>Messages entrants</translation>
</message>
<message>
<location filename="lib/export_html.py" line="779"/>
<source>Outgoing messages</source>
<translation>Messages sortants</translation>
</message>
<message>
<location filename="lib/export_html.py" line="707"/>
<source><p>These messages and contacts were exported using
<a href="http://series60-remote.sourceforge.net" target="_blank"><i>Series60-Remote</i></a>, a Software Suite for S60 mobile phones.<br />
To show your messages, click on the <a href="messages/index.html">Messages</a> tab in the navigation bar and to get an overview
of your contacts click on the <a href="contacts/index.html">Contact</a> tab.</p>
</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HelpLabel</name>
<message>
<location filename="widget/HelpLabel.py" line="13"/>
<source>Help</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="widget/HelpLabel.py" line="16"/>
<source>Python For S60 2.0.0 is supported on devices with
S60 3rd Edition and S60 5th Edition.
But there are some bugs on older S60 3rd Edition
devices. If you're using such device and get any error
during the installation of Python please uncheck this
box and send the installation files again to your device.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Helper</name>
<message>
<location filename="lib/helper.py" line="221"/>
<source>Can't find file!</source>
<translation>Impossible de trouver le fichier !</translation>
</message>
<message>
<location filename="lib/helper.py" line="221"/>
<source>The file %1 couldn't be found!
If you're using the SVN version of the application you have to create the file yourself
If you downloaded a pre-built package please report the error to series60-remote-devel@lists.sourceforge.net !</source>
<translation>Le fichier %1 ne peut être trouvé !
Si vous utilisez la version SVN de l'application, vous devrez créer le fichier vous-même.
Si vous utilisez un paquet pré-compilé, merci de bien vouloir reporter l'erreur sur series60-remote-devel@lists.sourceforge.net !</translation>
</message>
<message>
<location filename="lib/helper.py" line="277"/>
<source>File transfer failed!</source>
<translation>Le tranfert de fichier a échoué !</translation>
</message>
<message>
<location filename="lib/helper.py" line="206"/>
<source>File transer failed!
No device was specified!
You have to send the file %1 in the folder mobile manuelly to your mobile phone!</source>
<translation>Le tranfert de fichier a échoué !
Aucun appareil n'a été spécifié !
Vous devez envoyer le fichier %1 manuellement dans le dossier mobile de votre téléphone portable !</translation>
</message>
<message>
<location filename="lib/helper.py" line="264"/>
<source>File transer failed!
I could not connect to the file transfer service of your mobile phone!
The error message was: %1
You have to send the file %2 in the folder mobile manuelly to your mobile phone!
The absolute filepath is: %3</source>
<translation>Le transfert de fichier a échoué !
Impossible de se connecter au service de transfert de votre téléphone portable !
Le message d'erreur était : %1
Vous devez envoyer le fichier %2 manuellement dans le dossier mobile de votre téléphone mobile !
Le chemin absolu du fichier est : %3</translation>
</message>
<message>
<location filename="lib/helper.py" line="277"/>
<source>File transer failed!
I could not connect to the file transfer service of your mobile phone!
You have to send the file %1 in the folder mobile manuelly to your mobile phone!
The absolute filepath is: %2</source>
<translation>Le transfert de fichier a échoué !
Impossible de se connecter au service de transfert de votre téléphone mobile !
Vous devez envoyez le fichier %1 manuellement dans le dossier mobile de votre téléphone portable !
Le chemin absolu du fichier est : %2</translation>
</message>
<message>
<location filename="lib/helper.py" line="295"/>
<source>File succesfully transfered to mobile phone!</source>
<translation>Le fichier a été transféré avec succès vers votre téléphone portable !</translation>
</message>
<message>
<location filename="lib/helper.py" line="295"/>
<source>The file was transfered successfully to your mobile phone!
Please open your messages and continue with the installation!</source>
<translation>Le fichier a été tranféré avec succès vers votre téléphone portable !
Veuillez ouvrir vos messages et continuer l'installation !</translation>
</message>
<message>
<location filename="lib/helper.py" line="306"/>
<source>No recurrence</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/helper.py" line="309"/>
<source>Recurs daily</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="lib/helper.py" line="311"/>
<source>Recurs every %n day(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="lib/helper.py" line="313"/>
<source>, </source>
<comment>join string for weekdays</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/helper.py" line="317"/>
<source>Recurs weekly on %1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="lib/helper.py" line="319"/>
<source>Recurs every %n week(s) on %1</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="lib/helper.py" line="321"/>
<source>, </source>
<comment>join string for dates in month</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/helper.py" line="325"/>
<source>Recurs monthly on the %1 day</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="lib/helper.py" line="327"/>
<source>Recurs every %n month(s) on the %1 day</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="lib/helper.py" line="332"/>
<source> and </source>
<comment>join string for days in month</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/helper.py" line="335"/>
<source>Recurs every month on the %1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="lib/helper.py" line="337"/>
<source>Recurs every %n month(s) on the %1</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="lib/helper.py" line="339"/>
<source>%1 %2</source>
<comment>month day{ordinal number}</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/helper.py" line="341"/>
<source>Recurs yearly on %1</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<location filename="lib/helper.py" line="351"/>
<source>Recurs every %n years(s) on %1</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="lib/helper.py" line="345"/>
<source>the %1 %2 of %3</source>
<comment>the day{ordinal number} {weekday} of month</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/helper.py" line="349"/>
<source>Recurs every year on %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/helper.py" line="354"/>
<source>%1 until %2</source>
<comment>Recurs ... until</comment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>History</name>
<message>
<location filename="ui/src/history.ui" line="13"/>
<source>View history</source>
<translation>Afficher l'historique</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="57"/>
<source>Contact:</source>
<translation>Contact :</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="87"/>
<source>Filter:</source>
<translation>Filtre :</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="101"/>
<source>All messages</source>
<translation>Tous les messages</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="106"/>
<source>Only incoming</source>
<translation>Entrants uniquement</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="111"/>
<source>Only outgoing</source>
<translation>Sortants uniquement</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="146"/>
<source>Date</source>
<translation>Date</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="183"/>
<source>Log contents:</source>
<translation>Contenu du log :</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="193"/>
<source>Only older than</source>
<translation>Seulement les plus vieux que</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Only newier than</source>
<translation type="obsolete">Seulement les plus récent que</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="233"/>
<source>Apply filter...</source>
<translation>Appliquer le filtre...</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="265"/>
<source>Search messages...</source>
<translation>Rechercher des messages...</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="272"/>
<source>Ctrl+F</source>
<translation>Crtl+F</translation>
</message>
<message>
<location filename="window/history.py" line="101"/>
<source>All</source>
<translation>Tous</translation>
</message>
<message>
<location filename="window/history.py" line="148"/>
<source>(*): Potentially the message wasn't sent correctly.</source>
<translation>(*) : Le message n'a potentiellement pas été envoyé correctement.</translation>
</message>
<message>
<location filename="ui/src/history.ui" line="213"/>
<source>Only newer than</source>
<translation>Seulement les plus récent que</translation>
</message>
</context>
<context>
<name>ImageButton</name>
<message>
<location filename="widget/ImageButton.py" line="145"/>
<source>Reset</source>
<translation>Réinitialisation</translation>
</message>
<message>
<location filename="widget/ImageButton.py" line="152"/>
<source>Open Image</source>
<translation>Ouvrir l'image</translation>
</message>
<message>
<location filename="widget/ImageButton.py" line="152"/>
<source>Images (*.png *.xpm *.jpg)</source>
<translation></translation>
</message>
</context>
<context>
<name>ImageLoader</name>
<message>
<location filename="widget/ImageButton.py" line="28"/>
<source>Image not found</source>
<translation>Image non trouvée</translation>
</message>
<message>
<location filename="widget/ImageButton.py" line="28"/>
<source>This contact's image cannot be found.</source>
<translation>L'image de ce contact n'a pas pu être trouvée.</translation>
</message>
</context>
<context>
<name>ImportMessages</name>
<message>
<location filename="window/import_messages.py" line="41"/>
<source>Import Messages</source>
<translation>Import de messages</translation>
</message>
</context>
<context>
<name>Import_0_0_0</name>
<message>
<location filename="lib/import_messages.py" line="98"/>
<source>0.0.0 (obsolete version, SVN-only)</source>
<translation>0.0.0 (version désuète, seulement SVN)</translation>
</message>
<message>
<location filename="lib/import_messages.py" line="101"/>
<source>Please note the following disadvantages:<br /></source>
<translation>Notez les inconvénients suivants :<br /></translation>
</message>
<message>
<location filename="lib/import_messages.py" line="102"/>
<source>- Umlauts will get replaced</source>
<translation>- Les trémas (Umlaut) seront remplacés</translation>
</message>
<message>
<location filename="lib/import_messages.py" line="103"/>
<source>- Commas in contact names will get removed</source>
<translation>- Les virgules dans les noms des contacts seront supprimées</translation>
</message>
</context>
<context>
<name>LdifFormatter</name>
<message>
<location filename="lib/export_ldif.py" line="51"/>
<source>%1 not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/export_ldif.py" line="51"/>
<source>Exporting %1 objects is not possible:
Please install the %2 module.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/export_ldif.py" line="62"/>
<source>File already exists!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/export_ldif.py" line="62"/>
<source>The file Contacts.ldif already exists in this directory.
Would you like to overwrite it?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Log</name>
<message>
<location filename="ui/src/log.ui" line="14"/>
<source>Log messages</source>
<translation>Messages de log</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="34"/>
<source>Logging</source>
<translation>Connexion</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="184"/>
<source>Clear</source>
<translation>Vider</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="78"/>
<source>Long format</source>
<translation>Format long</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="104"/>
<source>Log level:</source>
<translation>Niveau de log :</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="127"/>
<source>Debug (with SQL)</source>
<translation>Déboguage (avec SQL)</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="132"/>
<source>Debug</source>
<translation>Déboguage</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="137"/>
<source>Info</source>
<translation>Info</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="142"/>
<source>Warning</source>
<translation>Avertissement</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="147"/>
<source>Error</source>
<translation>Erreur</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="152"/>
<source>Critical</source>
<translation>Critique</translation>
</message>
<message>
<location filename="ui/src/log.ui" line="163"/>
<source>Output</source>
<translation>Sortie</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="ui/src/main.ui" line="14"/>
<source>Series60 - Remote</source>
<translation>Series60 - Remote</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="144"/>
<source>Summary</source>
<translation>Résumé</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="154"/>
<source>Messages</source>
<translation>Messages</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="164"/>
<source>Contacts</source>
<translation>Contacts</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="183"/>
<source>Files</source>
<translation>Fichiers</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="192"/>
<source>Devices</source>
<translation>Appareils</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="898"/>
<source>No active connection!</source>
<translation>Aucune connexion active !</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>No favorites</source>
<translation type="obsolete">Aucun favori</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="264"/>
<source>Connect</source>
<translation>Connexion</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="331"/>
<source>Connection establishment to: <b>unknown</b></source>
<translation>Établissement de la connexion vers : <b>inconnu</b></translation>
</message>
<message>
<location filename="ui/src/main.ui" line="380"/>
<source>Cancel</source>
<translation>Annuler</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1323"/>
<source>Connected since:</source>
<translation>Connecté depuis :</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="375"/>
<source>unknown</source>
<translation>inconnu</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1413"/>
<source>Last refresh:</source>
<translation>Dernier rafraichissement :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1453"/>
<source>Type:</source>
<translation>Type :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1493"/>
<source>Battery level:</source>
<translation>Niveau batterie :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1558"/>
<source>Signal strength:</source>
<translation>Force du signal :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="772"/>
<source>Refresh</source>
<translation>Rafraîchir</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="782"/>
<source>Interrupt connection</source>
<translation>Interrompre la connexion</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="816"/>
<source>Recipent:</source>
<translation>Destinataire :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="867"/>
<source>Message:</source>
<translation>Message :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="885"/>
<source>Send</source>
<translation>Envoyer</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="888"/>
<source>Ctrl+S</source>
<translation>Ctrl+S</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="895"/>
<source>160 chars left; 1 message</source>
<translation>160 caractères restants ; 1 message</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1082"/>
<source>Contacts:</source>
<translation>Contacts :</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="439"/>
<source>Name</source>
<translation>Nom</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="958"/>
<source>Telephone Number</source>
<translation>Numéro de téléphone</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="992"/>
<source>in</source>
<translation>dans</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1257"/>
<source>Device:</source>
<translation>Appareil :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Add contact...</source>
<translation type="obsolete">Ajouter un contact...</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Edit contact...</source>
<translation type="obsolete">Modifier le contact...</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1385"/>
<source>Free drivespace:</source>
<translation>Espace disponible:</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1775"/>
<source>IMEI-Code:</source>
<translation>Code IMEI :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1473"/>
<source>Free RAM:</source>
<translation>RAM libre :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1789"/>
<source>Total RAM:</source>
<translation>RAM totale :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1803"/>
<source>Total ROM:</source>
<translation>ROM totale :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1639"/>
<source>Active profile:</source>
<translation>Profil actif :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1659"/>
<source>Software version:</source>
<translation>Version du logiciel :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1673"/>
<source>Bluetooth-address:</source>
<translation>Adresse bluetooth :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1687"/>
<source>Application version:</source>
<translation>Version de l'application :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1817"/>
<source>Display pixels:</source>
<translation>Affichage en pixels :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1824"/>
<source>OS version:</source>
<translation>Version de l'OS :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1755"/>
<source>Model:</source>
<translation>Modèle :</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1915"/>
<source>&File</source>
<translation>&Fichier</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1926"/>
<source>&Messages</source>
<translation>&Messages</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1938"/>
<source>&Help</source>
<translation>&Aide</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1946"/>
<source>&Contacts</source>
<translation>&Contacts</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1960"/>
<source>&New message</source>
<translation>&Nouveau message</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1972"/>
<source>&Quit</source>
<translation>&Quitter</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1983"/>
<source>&Save Messages</source>
<translation>&Enregistrer les messages</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1998"/>
<source>&Export Messages</source>
<translation>&Exporter des messages</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="2010"/>
<source>&Import messages</source>
<translation>&Importer des messages</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="2019"/>
<source>&Settings...</source>
<translation>&Paramètres...</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="2024"/>
<source>About &Qt</source>
<translation>À propos de &Qt</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="2033"/>
<source>Message-&Queue</source>
<translation>&Queue des messages</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="769"/>
<source>View &history</source>
<translation>Voir l'&historique</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="2051"/>
<source>Log</source>
<translation>Log</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="2060"/>
<source>&About Series60-Remote</source>
<translation>À &propos de Series60-Remote</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="777"/>
<source>View &statistics</source>
<translation>Voir les &statistiques</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="2078"/>
<source>&Donate money...</source>
<translation>&Donner de l'argent...</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="2087"/>
<source>Export...</source>
<translation>Exporter...</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="2090"/>
<source>Export messages and contacts</source>
<translation>Exporter les messages et les contacts</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="416"/>
<source>%1 pixels</source>
<translation>%1 pixels</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="340"/>
<source>Establish connection!</source>
<translation>Établir la connexion !</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="341"/>
<source>Connection establishment to: <b>%1</b></source>
<translation>Connexion établie avec : <b>%1</b></translation>
</message>
<message>
<location filename="window/mainwindow.py" line="389"/>
<source>offline mode</source>
<translation>mode hors-connexion</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="391"/>
<source>%1 dbM</source>
<translation>%1 dbM</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="410"/>
<source>%1% of 100%</source>
<translation>%1% of 100%</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>%1: %2</source>
<translation type="obsolete">%1 : %2</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="440"/>
<source>All fields</source>
<translation>Tous les champs</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="570"/>
<source>Connected to <b>%1</b></source>
<translation>Connecté à <b>%1</b></translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>%1 chars left; %2 message</source>
<translation type="obsolete">%1 caractères restants, %2 message</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>%1 chars left; %2 messages</source>
<translation type="obsolete">%1 caractères restants ; %2 messages</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Please chosse the telephone number for contact <i>%1</i>:</source>
<translation type="obsolete">Veuillez choisir le numéro téléphone pour le contact <i>%1</i> :</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="760"/>
<source>Start &chat</source>
<translation>Commencer la &discussion</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="814"/>
<source>&Edit contact</source>
<translation>&Modifier le contact</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="822"/>
<source>&Remove contact</source>
<translation>&Supprimer le contact</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="833"/>
<source>You aren't connected to the mobile phone.</source>
<translation>Vous n'êtes pas connecté au téléphone portable.</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="846"/>
<source>Delete contact</source>
<translation>Supprimer le contact</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="846"/>
<source>Do you really want to remove contact "%1"?</source>
<translation>Voulez-vous réellement supprimer le contact « %1 » ?</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="866"/>
<source>[%1] Fetching new messages...</source>
<translation>[%1] Vérification des nouveaux messages...</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="874"/>
<source>[%1] There are no new messages.</source>
<translation>[%1] Il n'y a pas de nouveaux messages.</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>[%1] 1 message in queue</source>
<translation type="obsolete">[%1] 1 message dans la file</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>[%1] %2 messages in queue</source>
<translation type="obsolete">[%1] %2 messages dans la file</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>[%1] All messages were sended</source>
<translation type="obsolete">[%1] Tous les messages ont été envoyés</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="1131"/>
<source>Quit</source>
<translation>Quitter</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="1131"/>
<source>Should the application stay in the system tray?</source>
<translation>L'application doit-elle rester dans la barre système ?</translation>
</message>
<message numerus="yes">
<location filename="window/mainwindow.py" line="640"/>
<source>%1 chars left; %n message(s)</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="737"/>
<source>Please choose the telephone number for contact <i>%1</i>:</source>
<translation>Veuillez choisir le numéro de téléphone pour le contact <i>%1</i> :</translation>
</message>
<message numerus="yes">
<location filename="window/mainwindow.py" line="872"/>
<source>[%1] %n new message(s) got saved.</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message numerus="yes">
<location filename="window/mainwindow.py" line="883"/>
<source>[%1] %n message(s) in queue</source>
<translation type="unfinished">
<numerusform></numerusform>
</translation>
</message>
<message>
<location filename="window/mainwindow.py" line="885"/>
<source>[%1] All messages were sent</source>
<translation>[%1] Tous les messages ont été envoyés</translation>
</message>
<message>
<location filename="ui/src/main.ui" line="174"/>
<source>Calendar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/main.ui" line="414"/>
<source>Connecting...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/main.ui" line="421"/>
<source>Updating system informations...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/main.ui" line="428"/>
<source>Updating contacts...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/main.ui" line="435"/>
<source>Updating calendar entries...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1160"/>
<source>Add contact</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1187"/>
<source>Edit contact</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1211"/>
<source>Import...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/main.ui" line="1975"/>
<source>Ctrl+Q</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/mainwindow.py" line="71"/>
<source>Import &Vcard file...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/mainwindow.py" line="72"/>
<source>Import &LDIF file...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/mainwindow.py" line="1034"/>
<source>Connection to device failed: %1 - %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/mainwindow.py" line="1068"/>
<source>Update check failed: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/mainwindow.py" line="1071"/>
<source>The update to <b>%1</b> of Series60-Remote is available at <b>%2</b>. Would you like to get it?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/mainwindow.py" line="1073"/>
<source>Update notes: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/mainwindow.py" line="1075"/>
<source>New version detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/mainwindow.py" line="926"/>
<source>There is an active device scan for the automatic connection establishment</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MessageQueue</name>
<message>
<location filename="ui/src/messageQueue.ui" line="14"/>
<source>Message queue</source>
<translation>Queue des messages</translation>
</message>
<message>
<location filename="ui/src/messageQueue.ui" line="45"/>
<source>Date</source>
<translation>Date</translation>
</message>
<message>
<location filename="ui/src/messageQueue.ui" line="50"/>
<source>Event</source>
<translation>Évènement</translation>
</message>
<message>
<location filename="ui/src/messageQueue.ui" line="73"/>
<source>Refresh automatically</source>
<translation>Rafraichir automatiquement</translation>
</message>
<message>
<location filename="ui/src/messageQueue.ui" line="83"/>
<source>Refresh</source>
<translation>RafraichirRafraîchir</translation>
</message>
<message>
<location filename="window/message_queue.py" line="57"/>
<source>No active connection</source>
<translation>Aucune connexion active</translation>
</message>
<message>
<location filename="window/message_queue.py" line="64"/>
<source>No messages in queue</source>
<translation>Aucun message dans la queue</translation>
</message>
</context>
<context>
<name>MobileNumberNotFoundDialog</name>
<message>
<location filename="ui/src/mobileNumberNotFound.ui" line="13"/>
<source>No legal number found!</source>
<translation>Aucun numéro éligible trouvé !</translation>
</message>
<message>
<location filename="ui/src/mobileNumberNotFound.ui" line="35"/>
<source>No legal telephone number found!
Legal numbers for the reciepent input mask:
- Only a number such as: 06641234567
- Name and number such as: John Q. Public (06641234567)
- Only a name (the name MUST be in the contact list!) such as: John Q. Public
Multiple Entries are seperated by semicolons such as: 06641234567; John Q. Public (06769876543)</source>
<translation>Pas de numéro de téléphone conforme trouvé!
Voici les règles à respecter pour le numéro d'appel:
- Seulement un numéro du type: 06641234567
- Nom et numéro du type: Jean M. Publique (06641234567)
- Seulement un nom (le nom DOIT être dans la liste de contacts!) comme: Jean M. Publique
Les entrées multiples sont séparées par des points virgules de cette manière: 06641234567; Jean M. Publique (06769876543)</translation>
</message>
</context>
<context>
<name>MobileNumberSelectDialog</name>
<message>
<location filename="ui/src/mobileNumberSelect.ui" line="14"/>
<source>Select telephone number</source>
<translation>Sélectionnez le numéro de télélphone</translation>
</message>
<message>
<location filename="ui/src/mobileNumberSelect.ui" line="43"/>
<source>As standard</source>
<translation>Par défaut</translation>
</message>
</context>
<context>
<name>ObexModel</name>
<message>
<location filename="lib/obex_model.py" line="297"/>
<source>Name</source>
<translation>Nom</translation>
</message>
<message>
<location filename="lib/obex_model.py" line="299"/>
<source>Size</source>
<translation>Taille</translation>
</message>
<message>
<location filename="lib/obex_model.py" line="301"/>
<source>Date Modified</source>
<translation>Date de modification</translation>
</message>
<message>
<location filename="lib/obex_model.py" line="303"/>
<source>Permissions</source>
<translation>Permissions</translation>
</message>
<message>
<location filename="lib/obex_model.py" line="321"/>
<source>No active connection</source>
<translation>Aucune connexion active</translation>
</message>
</context>
<context>
<name>ObexView</name>
<message>
<location filename="widget/ObexView.py" line="37"/>
<source>File browsing is not yet supported on Mac OS X</source>
<translation>Le parcours des fichiers n'est pas encore supporté sous Mac OS X</translation>
</message>
<message>
<location filename="widget/ObexView.py" line="65"/>
<source>Unknown error</source>
<translation>Erreur inconnue</translation>
</message>
<message>
<location filename="widget/ObexView.py" line="67"/>
<source>Connection failed (%1): %2</source>
<translation>La connexion a échoué (%1) : %2</translation>
</message>
<message>
<location filename="widget/ObexView.py" line="90"/>
<source>Save as...</source>
<translation>Enregistrer sous...</translation>
</message>
<message>
<location filename="widget/ObexView.py" line="104"/>
<source>Choose a filename to save under...</source>
<translation>Choisissez un nom de fichier...</translation>
</message>
<message>
<location filename="widget/ObexView.py" line="110"/>
<source>Overwrite file?</source>
<translation>Écraser le fichier ?</translation>
</message>
<message>
<location filename="widget/ObexView.py" line="110"/>
<source>Do you really want to overwrite the file "%1"?</source>
<translation>Voulez-vous réellement écraser le fichier "%1" ?</translation>
</message>
</context>
<context>
<name>ObexWidget</name>
<message>
<location filename="widget/ObexWidget.py" line="75"/>
<source>Back</source>
<translation>Précédent</translation>
</message>
<message>
<location filename="widget/ObexWidget.py" line="76"/>
<source>Forward</source>
<translation>Suivant</translation>
</message>
<message>
<location filename="widget/ObexWidget.py" line="77"/>
<source>Up</source>
<translation>Haut</translation>
</message>
<message>
<location filename="widget/ObexWidget.py" line="78"/>
<source>Home</source>
<translation>AccueilPersonnel</translation>
</message>
<message>
<location filename="widget/ObexWidget.py" line="79"/>
<source>Refresh</source>
<translation>Rafraîchir</translation>
</message>
</context>
<context>
<name>PixmapRegionSelectorDialog</name>
<message>
<location filename="ui/src/pixmap_region_selector_dialog.ui" line="14"/>
<source>Select Region of Image</source>
<translation>Sélectionnez la région de l'image</translation>
</message>
<message>
<location filename="ui/src/pixmap_region_selector_dialog.ui" line="24"/>
<source>Please click and drag on the image to select the region of interest and rightclick to rotate the image:</source>
<translation>Veuillez cliquer et déplacer le curseur sur l'image pour sélectionner la région intéressante et faire un click droit pour tourner l'image :</translation>
</message>
<message>
<location filename="ui/src/pixmap_region_selector_dialog.ui" line="65"/>
<source>Selection in Landscape Format</source>
<translation>Sélection au format paysage</translation>
</message>
<message>
<location filename="ui/src/pixmap_region_selector_dialog.ui" line="88"/>
<source>Selection in Portrait Format</source>
<translation>Sélection au format portrait</translation>
</message>
<message>
<location filename="ui/src/pixmap_region_selector_dialog.ui" line="108"/>
<source>Free selection</source>
<translation>Sélection libre</translation>
</message>
<message>
<location filename="ui/src/pixmap_region_selector_dialog.ui" line="144"/>
<source>Rotate Clockwise</source>
<translation>Rotation horaire</translation>
</message>
<message>
<location filename="ui/src/pixmap_region_selector_dialog.ui" line="158"/>
<source>Rotate Counterclockwise</source>
<translation>Rotation anti-horaire</translation>
</message>
</context>
<context>
<name>PixmapRegionSelectorWidget</name>
<message>
<location filename="widget/PixmapRegionSelectorWidget.py" line="111"/>
<source>&Rotate Clockwise</source>
<translation>Rotation &horaire</translation>
</message>
<message>
<location filename="widget/PixmapRegionSelectorWidget.py" line="112"/>
<source>Rotate &Counterclockwise</source>
<translation>Rotation &anti-horaire</translation>
</message>
</context>
<context>
<name>Popups</name>
<message>
<location filename="window/popups.py" line="33"/>
<source>Connection established!</source>
<translation>Connexion établie !</translation>
</message>
<message>
<location filename="window/popups.py" line="34"/>
<source>Succesfully connected with <b>%1</b>!</source>
<translation>Connecté avec succès à <b>%1</b> !</translation>
</message>
<message>
<location filename="window/popups.py" line="47"/>
<source>Connection closed</source>
<translation>Connexion fermée</translation>
</message>
<message>
<location filename="window/popups.py" line="48"/>
<source>Connection with <b>%1</b> closed!</source>
<translation>Connexion avec <b>%1</b> fermée !</translation>
</message>
<message>
<location filename="window/popups.py" line="106"/>
<source>+ 1 more message...</source>
<translation>+ 1 message supplémentaire...</translation>
</message>
<message>
<location filename="window/popups.py" line="108"/>
<source>+ %1 more messages...</source>
<translation>% %1 messages supplémentaires...</translation>
</message>
<message>
<location filename="window/popups.py" line="119"/>
<source><b>%1</b> writes: <br />%2</source>
<translation><b>%1</b> écrit : <br />%2</translation>
</message>
<message>
<location filename="window/popups.py" line="101"/>
<source>New message</source>
<translation>Nouveau message</translation>
</message>
<message>
<location filename="window/popups.py" line="165"/>
<source>Start chat</source>
<translation>Commencer la discussion</translation>
</message>
<message>
<location filename="window/popups.py" line="126"/>
<source>Block</source>
<translation>Bloquer</translation>
</message>
<message>
<location filename="window/popups.py" line="130"/>
<source>Block %1</source>
<translation>Bloquer %1</translation>
</message>
<message>
<location filename="window/popups.py" line="135"/>
<source>Block all</source>
<translation>Bloquer tous</translation>
</message>
</context>
<context>
<name>S60_Remote</name>
<message>
<location filename="lib/import_messages.py" line="84"/>
<source>Old versions of Series60-Remote</source>
<translation>Anciennes versions de Series60-Remote</translation>
</message>
</context>
<context>
<name>SearchLineEdit</name>
<message>
<location filename="widget/SearchLineEdit.py" line="11"/>
<source>Search</source>
<translation>Chercher</translation>
</message>
</context>
<context>
<name>Settings</name>
<message>
<location filename="ui/src/settings.ui" line="14"/>
<source>Settings</source>
<translation>Paramètres</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="37"/>
<source>Mobile</source>
<translation>Mobile</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1057"/>
<source>General</source>
<translation>GénéralGénéral</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1074"/>
<source>Plugin:</source>
<translation>Plugin :</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1094"/>
<source>Port:</source>
<translation>Port :</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="49"/>
<source>Devices</source>
<translation>Appareils</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="63"/>
<source>Selected devices:</source>
<translation>Appareil sélectionné :</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="103"/>
<source>Available devices:</source>
<translation>Appareils disponibles :</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Refresh</source>
<translation type="obsolete">Rafraîchir</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="123"/>
<source>Application</source>
<translation>Application</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="141"/>
<source>Mark messages as read on the device</source>
<translation>Marquer les messages commes lus sur le téléphone</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="155"/>
<source>Store messages on the PC</source>
<translation>Enregistrer les messages sur le PC</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="165"/>
<source>Window</source>
<translation>Fenêtre</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="177"/>
<source>Show telephone number in the contact list by the messages</source>
<translation>Montrer les numéros de la liste de contacts avec les messages</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="184"/>
<source>Send message when the Return key is pressed (Ctrl+Return or Enter for Newline)</source>
<translation>Envoyer le message lorss de l'appui sur la touche Entrée (Crtl+Entrée ou Entrée pour une nouvelle ligne)</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Show in the chat window the last</source>
<translation type="obsolete">Montrer dans la fenêtre de discussion les derniers</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="538"/>
<source>messages</source>
<translation>messages</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="194"/>
<source>Popups</source>
<translation>Popups</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="206"/>
<source>Show popups</source>
<translation>Afficher les popups</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="221"/>
<source>Close the popup after</source>
<translation>Fermer la popup après</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>secounds (0 is never)</source>
<translation type="obsolete">secondes (0 pour jamais)</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="263"/>
<source>Animate popups</source>
<translation>Animer les popups</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="373"/>
<source>Contacts</source>
<translation>Contacts</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="391"/>
<source>Block all contacts</source>
<translation>Bloquer tous les contacts</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="398"/>
<source>Show contact icon in the list</source>
<translation>Afficher l'icône du contact dans la liste</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="414"/>
<source>Blocked contacts</source>
<translation>Contacts bloqués</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="428"/>
<source>Blocked contacts:</source>
<translation>Contacts bloqués :</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="468"/>
<source>Available contacts:</source>
<translation>Contacts disponibles :</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="671"/>
<source>Database</source>
<translation>Base de données</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="697"/>
<source>Database type:</source>
<translation>Type de la base de données :</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="802"/>
<source>Warning! <i>QSQLITE</i> database driver not found! Please install it first!</source>
<translation>Attention ! Le pilote de bases de données <i>QSQLITE</i> n'a pas été trouvé ! Veuillez l'installer d'abord !</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="891"/>
<source>Warning! <i>QMYSQL</i> database driver not found! Please install it first!</source>
<translation>Attention ! Le pilote de bases de données <i>QMYSQL</i> n'a pas été trouvé ! Veuillez l'installer d'abord !</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="910"/>
<source>Configure MySQL</source>
<translation>Configurer MySQL</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="925"/>
<source>Host:</source>
<translation>Hôte :</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="978"/>
<source>User:</source>
<translation>Utilisateur :</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="991"/>
<source>Password:</source>
<translation>Mot de passe :</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1008"/>
<source>Database:</source>
<translation>Base de données :</translation>
</message>
<message>
<location filename="window/settings.py" line="167"/>
<source>No contacts available</source>
<translation>Aucun contact disponible</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Scanning...</source>
<translation type="obsolete">Balayage...</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Scanning failed: %1</source>
<translation type="obsolete">Le balayage a échoué : %1</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>No devices found</source>
<translation type="obsolete">Aucun appareil trouvé</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Send Python SIS file to device</source>
<translation type="obsolete">Envoyer le fichier SIS de Python vers le téléphone</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Send Application SIS file to device</source>
<translation type="obsolete">Envoyer le fichier SIS de l'application vers le téléphone</translation>
</message>
<message>
<location filename="window/settings.py" line="498"/>
<source>MySQL data is incomplete!</source>
<translation>Les doénnes MySQL sont incomplètes !</translation>
</message>
<message>
<location filename="window/settings.py" line="498"/>
<source>You didn't enter all connection informations. If you are unsure please use SQlite.</source>
<translation>Vous n'avez pas entré toutes les informations de connexion. Si vous n'êtes pas sûr, utilisez SQLite.</translation>
</message>
<message>
<location filename="window/settings.py" line="515"/>
<source>Error by creating the database!</source>
<translation>Erreur à la création de la base de données !</translation>
</message>
<message>
<location filename="window/settings.py" line="515"/>
<source>The creation of the database failed with the following error:
%1
Please mind that the application doesn't work without an database connection.</source>
<translation>La création de la base de données a échoué avec l'erreur suivante :
%1
Gardez en mémoire que l'application ne peut pas fonctionner sans une connexion à une base de données.</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="148"/>
<source>Quit the application when closing the mainwindow</source>
<translation>Quitter l'application à la fermeture de la fenêtre pricipale</translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="241"/>
<source>seconds (0 is never)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="273"/>
<source>Autoconnect && Autostart</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="285"/>
<source>Automatically connect to devices</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="300"/>
<source>Scan interval:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="323"/>
<source>seconds</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="345"/>
<source>Autostart Series60-Remote on system startup</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="360"/>
<source>Start minimized in the system tray</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="484"/>
<source>Chat - Themes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="498"/>
<source>Display</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="506"/>
<source>Group consecuti&ve messages</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="513"/>
<source>Use compact variant</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="524"/>
<source>Show the last</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="569"/>
<source>Themes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="604"/>
<source>Theme variant:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="643"/>
<source>&Install Theme...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="656"/>
<source>&Delete Theme</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1045"/>
<source>Advanced Options</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1135"/>
<source>Update checker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1156"/>
<source>Update check interval: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1178"/>
<source>Show also updates to unstable versions</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1205"/>
<source>Look && Feel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1224"/>
<source>Widget style:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1244"/>
<source>Language:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1264"/>
<source>Country:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1284"/>
<source>Chat window grouping:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="ui/src/settings.ui" line="1358"/>
<source>Note: You need to restart the application that these changes take effect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="37"/>
<source>John Doe</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="38"/>
<source>Myself</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="40"/>
<source>Hello!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="43"/>
<source>Are you available?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="46"/>
<source>Sorry, I have only just read your message. </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="50"/>
<source>Never mind, I wanted to get in touch with you because...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="477"/>
<source>(No variant)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="245"/>
<source>Daily</source>
<translation type="unfinished">Quotidien</translation>
</message>
<message>
<location filename="window/settings.py" line="246"/>
<source>Every third day</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="247"/>
<source>Weekly</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="248"/>
<source>Never</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="261"/>
<source>Open all contacts in a seperate chat window</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="262"/>
<source>Show contacts in different tabs</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="266"/>
<source>Default style</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="272"/>
<source>Default language</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="304"/>
<source>Default country</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="358"/>
<source>Open theme archive</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="358"/>
<source>Zip archive</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="358"/>
<source>Tar archive</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="358"/>
<source>Tar archive (gzip-compressed)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="358"/>
<source>Tar archive (bzip-compressed)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="376"/>
<source>Theme installation failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="376"/>
<source>The theme could not be installed!
Please check that it is a valid archive file!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="388"/>
<source>Delete theme?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="window/settings.py" line="388"/>
<source>Do you really want to delete the theme "%1"!
This will remove the following directory:
%2!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StatisticCanvas</name>
<message>
<location filename="widget/StatisticCanvas.py" line="63"/>
<source>Matplotlib not found - Please install it.</source>
<translation>Matplotlib non trouvé. Veuillez l'installer.</translation>
</message>
</context>
<context>
<name>Statistics</name>
<message>
<location filename="ui/src/statistics.ui" line="14"/>
<source>Statistics</source>
<translation>Statistiques</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="28"/>
<source>Period</source>
<translation>Période</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="36"/>
<source>Contact:</source>
<translation>Contact :</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="69"/>
<source>View:</source>
<translation>Vue :</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="83"/>
<source>Years and Months</source>
<translation>Années et mois</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="88"/>
<source>Years</source>
<translation>Années</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="93"/>
<source>Months</source>
<translation>Mois</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="98"/>
<source>Days</source>
<translation>Jours</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="103"/>
<source>Weekdays</source>
<translation>Jours de la semaine</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="108"/>
<source>Hours</source>
<translation>Heures</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="132"/>
<source>Filter:</source>
<translation>Filtre :</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="146"/>
<source>All messages</source>
<translation>Tous les messages</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="151"/>
<source>Only incoming</source>
<translation>Entrants uniquement</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="156"/>
<source>Only outgoing</source>
<translation>Sortants uniquement</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="185"/>
<source>Rightclick to change layout</source>
<translation>Utilisez le click droit pour changer la disposition</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="211"/>
<source>Contacts</source>
<translation>Contacts</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="256"/>
<source>General</source>
<translation>Général</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="279"/>
<source>Show graphs on top of each other</source>
<translation>Montrer les graphiques l'un sur l'autre</translation>
</message>
<message>
<location filename="ui/src/statistics.ui" line="284"/>
<source>Show one graph above the x-axis and the other under the x-axis</source>
<translation>Présenter un graphique au-dessus de l'axe x et l'autre en-dessous</translation>
</message>
<message>
<location filename="window/statistics.py" line="76"/>
<source>All</source>
<translation>Tous</translation>
</message>
<message>
<location filename="window/statistics.py" line="281"/>
<source>No data for this contact available!</source>
<translation>Aucune donnée disponible pour ce contact !</translation>
</message>
<message>
<location filename="window/statistics.py" line="374"/>
<source>No data available!</source>
<translation>Aucune donnée disponible !</translation>
</message>
<message>
<location filename="window/statistics.py" line="294"/>
<source>go back to summary...</source>
<translation>retour au résumé...</translation>
</message>
<message>
<location filename="window/statistics.py" line="299"/>
<source>All Messages</source>
<translation>Tous les messages</translation>
</message>
<message>
<location filename="window/statistics.py" line="310"/>
<source>Incoming messages</source>
<translation>Messages entrants</translation>
</message>
<message>
<location filename="window/statistics.py" line="313"/>
<source>Outgoing messages</source>
<translation>Messages sortants</translation>
</message>
<message>
<location filename="window/statistics.py" line="311"/>
<source>Incoming Messages</source>
<translation>Messages entrants</translation>
</message>
<message>
<location filename="window/statistics.py" line="314"/>
<source>Outgoing Messages</source>
<translation>Messages sortants</translation>
</message>
<message>
<location filename="window/statistics.py" line="341"/>
<source>Contact</source>
<translation>Contact</translation>
</message>
<message>
<location filename="window/statistics.py" line="341"/>
<source>Percent</source>
<translation>Pourcentage</translation>
</message>
<message>
<location filename="window/statistics.py" line="440"/>
<source>Incoming</source>
<translation>Entrant</translation>
</message>
<message>
<location filename="window/statistics.py" line="442"/>
<source>Outgoing</source>
<translation>Sortant</translation>
</message>
<message>
<location filename="window/statistics.py" line="444"/>
<source>Total</source>
<translation>Total</translation>
</message>
<message>
<location filename="window/statistics.py" line="363"/>
<source>Others</source>
<translation>Autres</translation>
</message>
<message>
<location filename="window/statistics.py" line="401"/>
<source><p><b>General statistics</b></p>
<p><b>%1</b> incoming messages, <b>%2</b> outgoing messages, <b>%3</b> total messages.<br />
The total number of stored days is <b>%4</b>.<br />
You receive <b>%5</b> and send <b>%6</b> messages per day on average.<br />
There are alltogether <b>%7</b> contacts in my database, <b>%8</b> of them are shown on your mobile phone.<br />
The average length of an incoming message is <b>%9</b> chars, of an outgoing message <b>%10</b> chars.</p></source>
<translation><p><b>Statistiques générales</b></p>
<p><b>%1</b> messages entrants, <b>%2</b> messages sortants, <b>%3</b> messages au total.<br />
Le nombre total de jours stockés est de <b>%4</b>.<br />
Vous avez reçu <b>%5</b> et envoyé <b>%6</b> messages par jour en moyenne.<br />
Il y a en tout <b>%7</b> contacts dans la base de données, <b>%8</b> d'entre eux sont visibles sur votre téléphone portable.<br />
La taille moyenne d'un message entrant est de <b>%9</b> caractères, et de <b>%10</b> caractères pour les messages sortants.</p></translation>
</message>
<message>
<location filename="window/statistics.py" line="430"/>
<source>Year</source>
<translation>Année</translation>
</message>
<message>
<location filename="window/statistics.py" line="432"/>
<source>Month</source>
<translation>Mois</translation>
</message>
<message>
<location filename="window/statistics.py" line="434"/>
<source>Day</source>
<translation>Jour</translation>
</message>
<message>
<location filename="window/statistics.py" line="436"/>
<source>Weekday</source>
<translation>Jour de la semaine</translation>
</message>
<message>
<location filename="window/statistics.py" line="438"/>
<source>Hour</source>
<translation>Heure</translation>
</message>
</context>
<context>
<name>TrayIcon</name>
<message>
<location filename="window/systemtrayicon.py" line="51"/>
<source>Series 60 - Remote</source>
<translation></translation>
</message>
<message>
<location filename="window/systemtrayicon.py" line="93"/>
<source>&Unread messages</source>
<translation>Messages &non lus</translation>
</message>
<message>
<location filename="window/systemtrayicon.py" line="118"/>
<source>&Minimize</source>
<translation>&Minimiser</translation>
</message>
<message>
<location filename="window/systemtrayicon.py" line="120"/>
<source>&Restore</source>
<translation>&Restaurer</translation>
</message>
<message>
<location filename="window/systemtrayicon.py" line="124"/>
<source>&Quit</source>
<translation>&Quitter</translation>
</message>
</context>
<context>
<name>Types</name>
<message>
<location filename="lib/import_messages.py" line="45"/>
<source>unknown</source>
<translation>inconnu</translation>
</message>
</context>
<context>
<name>VCardFormatter</name>
<message>
<location filename="lib/export_vcard.py" line="51"/>
<source>%1 not found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/export_vcard.py" line="51"/>
<source>Exporting %1 objects is not possible:
Please install the %2 module.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/export_vcard.py" line="62"/>
<source>File already exists!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="lib/export_vcard.py" line="62"/>
<source>The file Contacts.vcf already exists in this directory.
Would you like to overwrite it?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Wizard</name>
<message>
<location filename="window/wizard.py" line="57"/>
<source>Series 60 Remote - Settings</source>
<translation>Series 60 Remote - Préférences</translation>
</message>
</context>
<context>
<name>applicationPage</name>
<message>
<location filename="ui/src/import_applicationPage.ui" line="64"/>
<source>This program will help you import your messages from your previous messaging program into Series60-Remote.</source>
<translation>Ce programme vous aidera à importer vos messages dans Series60-Remote depuis votre ncien logiciel de messagerie.</translation>
</message>
<message>
<location filename="ui/src/import_applicationPage.ui" line="90"/>
<source>Please select the program you would like to import from and then click <i>Next</i>:</source>
<translation>Veuillez sélectionne rle programme depuis lequel importer puis cliquez sur <i>Suivant</i> :</translation>
</message>
<message>
<location filename="ui/src/import_applicationPage.ui" line="38"/>
<source>Step 1: Select application</source>
<translation>Étape 1 : sélectionnez l'application</translation>
</message>
<message>
<location filename="ui/src/import_applicationPage.ui" line="54"/>
<source>Welcome to the Import Tool!</source>
<translation>Bienvenue dans l'outil d'import !</translation>
</message>
</context>
<context>
<name>databasePage</name>
<message>
<location filename="ui/src/wizard_databasePage.ui" line="51"/>
<source>Please select your database type (If you are unsure use SQLite):</source>
<translation>Veuillez sélectionner le type de base de données (utilisez SQLite si vous avez un doute) :</translation>
</message>
<message>
<location filename="ui/src/wizard_databasePage.ui" line="382"/>
<source>Database:</source>
<translation>Base de données :</translation>
</message>
<message>
<location filename="ui/src/wizard_databasePage.ui" line="191"/>
<source>Warning! <i>QSQLITE</i> database driver not found! Please install it first!</source>
<translation>Attention ! Le pilote de bases de données <i>QSQLITE</i> n'a pas été trouvé ! Veuillez l'installer d'abord !</translation>
</message>
<message>
<location filename="ui/src/wizard_databasePage.ui" line="277"/>
<source>Warning! <i>QMYSQL</i> database driver not found! Please install it first!</source>
<translation>Attention ! Le pilote de bases de données <i>QMYSQL</i> n'a pas été trouvé ! Veuillez l'installer d'abord !</translation>
</message>
<message>
<location filename="ui/src/wizard_databasePage.ui" line="296"/>
<source>Configure MySQL</source>
<translation>Configurer MySQL</translation>
</message>
<message>
<location filename="ui/src/wizard_databasePage.ui" line="311"/>
<source>Host:</source>
<translation>Hôte :</translation>
</message>
<message>
<location filename="ui/src/wizard_databasePage.ui" line="341"/>
<source>Port:</source>
<translation>Port :</translation>
</message>
<message>
<location filename="ui/src/wizard_databasePage.ui" line="358"/>
<source>User:</source>
<translation>Utilisateur :</translation>
</message>
<message>
<location filename="ui/src/wizard_databasePage.ui" line="368"/>
<source>Password:</source>
<translation>Mot de passe :</translation>
</message>
<message>
<location filename="window/wizard.py" line="233"/>
<source>Mysql connection fields incomplete!</source>
<translation>Les champs de connexion MySQL sont incomplets !</translation>
</message>
<message>
<location filename="window/wizard.py" line="233"/>
<source>You didn't fill in all required fields. If you are ubsure please use SQLite.</source>
<translation>Vous n'avez pas renseigné tous les champs requis. Si vous avez un doute, utilisez SQLite.</translation>
</message>
<message>
<location filename="window/wizard.py" line="250"/>
<source>Connection failed!</source>
<translation>Échec de la connexion !</translation>
</message>
<message>
<location filename="window/wizard.py" line="250"/>
<source>Connection failed with error:
%1
</source>
<translation>La connexion a échoué avec l'erreur :
%1</translation>
</message>
</context>
<context>
<name>helloPage</name>
<message>
<location filename="ui/src/wizard_helloPage.ui" line="37"/>
<source>Hello,<br />
<br />
Welcome to your first run of Series60-Remote<br />
<br />
You can manage the following things with your mobile phone:<br />
- Send text messages<br />
- Store and read text messages<br />
- Add, edit and delete contacts<br />
- Browse the folders of your mobile phone<br />
- and much more<br />
<br />
<br />
On the following pages you go along your settings.<br />
Keep in mind that everything can be changed afterwards in <i>File - Settings</i>.</source>
<translation>Bonjour,<br />
<br />
Bienvenue au premier lancement de Series60-Remote<br />
<br />
Vous pouvez avec votre téléphone portable :<br />
- Envoyer des messages textes<br />
- Enregistrer et lire des messages textes<br />
- Ajouter, modifier er supprimer des contacts<br />
- Parcourir vos dossiers<br />
- Et bien plus encore<br />
<br />
<br />
Dans les pages suivantes, vous pourrez spécifier vos préférences.<br />
Gardez à l'esprit que tout pourra par la suite être modifié depuis le menu <i>Fichier - Préférences</i>.
</translation>
</message>
<message>
<location filename="ui/src/wizard_helloPage.ui" line="129"/>
<source>This is a preview release! Do not use it in production enviroments! Please report all bugs you can find!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>installPage</name>
<message>
<location filename="ui/src/wizard_installPage.ui" line="144"/>
<source>Send PyS60 package to mobile phone... </source>
<translation>Envoyer le paquet PyS60 vers votre téléphone mobile...</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="199"/>
<source>Please continue the installation on your mobile phone!</source>
<translation>Veuillez continuer l'installation sur votre téléphone portable !</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="179"/>
<source>Send Series60-Remote package to mobile phone... </source>
<translation>Envoyer le paquet Series60-Remote vers votre téléphone mobile...</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="246"/>
<source>Unfortunately, the following error appeared:<br />
- The python binding for <i>obexftp</i> isn't installed.</source>
<translation>Malheureusement, l'erreur suivante s'est produite :<br />
- La dépendance python pour <i>obexftp</i> n'est pas installé.</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="279"/>
<source>Either you install the required package (for instance on Fedora: <i>yum install python-obexftp</i>)<br />
or you transfer the files <i>PythonForS60_1_4_5_3rdEd.sis</i> and <i>series60-remote.sis</i> in the directory <i>mobile</i> manually to your device (you could use the application <i>kbluetooth</i>)</source>
<translation>Soit vous installez le paquet requis (par exemple pour Fedora : <i>yum install python-obexftp</i>)<br />
soit vous transférez manuellement les fichiers <i>PythonForS60_1_4_5_3rdEd.sis</i> et </i>series60-remote.sis</i> dans le répertoire <i>mobile</i> vers votre appareil (vous pouvez utiliser l'application <i>kbluetooth</i>)</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="309"/>
<source>You have to transfer the files <i>PythonForS60_1_4_5_3rdEd.sis</i> and <i>series60-remote.sis</i> in the directory <i>mobile</i> manually to your device.
Please use <i>Nokia PC Suite</i>.</source>
<translation>Vous devez transférer les fichiers <i>PythonForS60_1_4_5_3rdEd.sis</i> et <i>series60-remote.sis</i> dans le répertoire <i>mobile</i> de votre appareil.
Merci d'utiliser <i>Nokia PC Suite</i>.</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="326"/>
<source>Open Folder</source>
<translation>Ouvrir un dossier</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="34"/>
<source>You have to install <i>Series 60-Remote</i> on your mobile phone.</source>
<translation>Vous devez installer <i>Series60-Remote</i> sur votre téléphone portable.</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="46"/>
<source><i>Series 60-Remote</i> requires <i>Python for S60</i> (PyS60), so please install this package first, if you haven't already.</source>
<translation>Le <i>Series60-Remote</i> requiert <i>Python pour S60</i> (PyS60), vous devez installer ce paquet dans un premier temps, si ce n'est déjà fait.</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="109"/>
<source>Step 1:</source>
<translation>Étape 1 :</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="158"/>
<source>Step 2:</source>
<translation>Étape 2 :</translation>
</message>
<message>
<location filename="ui/src/wizard_installPage.ui" line="58"/>
<source>I want to use PyS60 2.0.0.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>messagesPage</name>
<message>
<location filename="ui/src/import_messagesPage.ui" line="72"/>
<source>Current message:</source>
<translation>Message courant :</translation>
</message>
<message>
<location filename="window/import_messages.py" line="235"/>
<source>%1 of %2</source>
<translation>%1 de %2</translation>
</message>
<message>
<location filename="ui/src/import_messagesPage.ui" line="41"/>
<source>Step 4: Importing messages...</source>
<translation>Étape 4 : import des messages...</translation>
</message>
<message>
<location filename="ui/src/import_messagesPage.ui" line="54"/>
<source>All Messages are imported</source>
<translation>Tous les messages ont été importés</translation>
</message>
</context>
<context>
<name>minimizePage</name>
<message>
<location filename="ui/src/wizard_minimizePage.ui" line="96"/>
<source><p align="justify">There is currently no easy way to minimize the application.<br />
<br />
The best way is to press the press the menu key for some seconds. When the application switcher appears select "Standby".<br />
<br />
I'm working on a better solution. In a future version the "Exit" button will get replaced by a "Hide" button.</source>
<translation><p align="justify">Il n'y a actuellement aucune méthode facile pour réduire l'application.<br />
<br />
Le plus simple est de rester appuyé sur "Menu" quelques secondes. Quand le sélecteur d'application apparaît, choisir "Standby".<br />
<br />
Je travaille sur une meilleure solution. Dans une future version, le bouton "Quitter" sera remplacé par le bouton "Cacher".</translation>
</message>
</context>
<context>
<name>phonePage</name>
<message>
<location filename="ui/src/wizard_phonePage.ui" line="35"/>
<source>Turn on bluetooth on your mobile phone and select the appropriate device:
You don't need to choose one, you can configure it afterwards in the settings.</source>
<translation>Activez le bluetooth sur votre téléphone portable et sélectionnez le service approprié :
Vous n'avez pas besoin d'en choisir un maintenant, vous pourrez le configurer par la suite dans les préférences.</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Name</source>
<translation type="obsolete">Nom</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Hardware adressee</source>
<translation type="obsolete">Adresse matérielle</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Refresh scan</source>
<translation type="obsolete">Rafraîchir le scan</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Scanning...</source>
<translation type="obsolete">Scan...</translation>
</message>
<message>
<location filename="" line="1862671648"/>
<source>Scanning failed: %1</source>
<translation type="obsolete">Le scan a échoué : %1</translation>
</message>
<message>
<location filename="window/wizard.py" line="110"/>
<source>No devices found</source>
<translation>Aucun appareil trouvé</translation>
</message>
<message>
<location filename="window/wizard.py" line="110"/>
<source>You didn't select a mobile phone.
If you continue, you have to select it afterwards in the settings.</source>
<translation>Vous n'avez pas sélectionné de téléphone mobile.
Si vous continuer, vous devrez en sélectionner un par la suite dans les préférences.</translation>
</message>
</context>
<context>
<name>runPage</name>
<message>
<location filename="ui/src/wizard_runPage.ui" line="96"/>
<source><p align="justify">At first complete the installation of the application on your mobile phone.<br />
<br />
Afterwards start the application. It should be located in the "Applications" menu and named "S60-Remote".</p></source>
<translation><p align="justify">Tout d'abord, terminez l'installation de l'application sur votre téléphone portabel.<br />
<br />
Ensuite, lancez l'application. Elle devrait se rouver dans le menu « Application » et être nommée "S60-Remote".</p></translation>
</message>
</context>
<context>
<name>settingsPage</name>
<message>
<location filename="ui/src/import_settingsPage.ui" line="48"/>
<source>Please select the settings for your requested application:</source>
<translation>Choisissez les paramètres de l'application choisie:</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="65"/>
<source>Database</source>
<translation>Base de données</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="74"/>
<source>Select the database you want to import from:</source>
<translation>Selectionnez la base de données depuis laquelle vous souhaitez importer :</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="94"/>
<source>Configure SQLite</source>
<translation>Configurer SQLite</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="105"/>
<source>Filename:</source>
<translation>Nom de fichier :</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="151"/>
<source>Configure MySQL</source>
<translation>Configurer MySQL</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="163"/>
<source>User:</source>
<translation>Utilisateur :</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="189"/>
<source>Port:</source>
<translation>Port :</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="199"/>
<source>Database:</source>
<translation>Base de données :</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="209"/>
<source>Password:</source>
<translation>Mot de passe :</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="239"/>
<source>localhost</source>
<translation></translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="246"/>
<source>Host:</source>
<translation>Hôte :</translation>
</message>
<message>
<location filename="window/import_messages.py" line="162"/>
<source>Open Database file</source>
<translation>Ouvrir le fichier de base de données</translation>
</message>
<message>
<location filename="window/import_messages.py" line="162"/>
<source>SQLite database (*.db)</source>
<translation>Base de donnée SQLite (*.db)</translation>
</message>
<message>
<location filename="window/import_messages.py" line="196"/>
<source>Can't connect to database!</source>
<translation>COnnexion à la base de données impossible !</translation>
</message>
<message>
<location filename="window/import_messages.py" line="196"/>
<source>Error when trying to connect to database: %1</source>
<translation>Erreur lors de la conenxion à la base de données : %1</translation>
</message>
<message>
<location filename="ui/src/import_settingsPage.ui" line="38"/>
<source>Step 3: Select application settings</source>
<translation>Étape 3 : définissez les préférences de l'application</translation>
</message>
</context>
<context>
<name>versionPage</name>
<message>
<location filename="ui/src/import_versionPage.ui" line="35"/>
<source>Please select the version of your requested application:</source>
<translation>Choisissez la version de l'application choisie:</translation>
</message>
<message>
<location filename="ui/src/import_versionPage.ui" line="23"/>
<source>Step 2: Select application version</source>
<translation>Étape 2 : sélectionnez la version de l'application</translation>
</message>
</context>
</TS>
| gpl-2.0 |
kannon92/psi4 | psi4/src/psi4/optking/lindh_guess.cc | 12636 | /*
* @BEGIN LICENSE
*
* Psi4: an open-source quantum chemistry software package
*
* Copyright (c) 2007-2016 The Psi4 Developers.
*
* The copyrights for code used from other parties are included in
* the corresponding files.
*
* 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, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* @END LICENSE
*/
/*! \file Lindh_guess.cc
\ingroup optking
\brief Function to generate a model cartesian Hessian according to
R. Lindh, A. Bernhardsson, G. Karlstrom, P.-A. Malmqvist, CPL, 241, 423, 1995.
Lindh et. al define a super-redundant set of simple internal coordinates with
which the potential surface can be expressed in a continuous way with respect
to nuclear coordinates, and some formulas for the guessed force constants. They
use these formulas at every step on an optimization.
The calling function transforms the cartesian coordinates back into the (smaller set) of
redundant internal coordinates being used by optking for the optimization. Although
this does include the gradient terms in the transformations, the second derivative
values are so uncertain, that the result is not reliably improved from a
diagonal Hessian guess. The user can choose whether to do this process only once
at the beginning or at each optimization step.
Known problems:
1. For the Baker test set, does not perform great.
2. The Hessian seems to favor bending linear bonds. It will result in negative
diagonal Hessian matrix elements, even when doing so will break the point group
symmetry. In high-symmetry cases, optking may not be able to ignore these
artificial modes (coming out of RFO diagonalization, e.g.).
*/
#include "molecule.h"
#include "psi4/optking/physconst.h"
#include "v3d.h"
#include "print.h"
#define EXTERN
#include "globals.h"
#if defined(OPTKING_PACKAGE_PSI)
#include <cmath>
#elif defined (OPTKING_PACKAGE_QCHEM)
#include "qcmath.h"
#endif
namespace opt {
inline int period(int Z);
inline double r_ref_table(int perA, int perB);
inline double alpha_table(int perA, int perB);
using namespace v3d;
// Returns cartesian Lindh guess Hessian for whole system
double **MOLECULE::Lindh_guess(void) const {
// Build one oprint_matrix_out( fragment that contains ALL the atoms.
int natom = g_natom();
double **coord_xyz = g_geom_2D();
double *atomic_numbers = g_Z();
FRAG * frag = new FRAG(natom, atomic_numbers, coord_xyz);
double **g = g_grad_2D();
frag->set_grad(g);
free_matrix(g);
double **H_xyz = frag->Lindh_guess();
delete frag;
return H_xyz;
}
// Build cartesian hessian according to model in Lindh paper.
double ** FRAG::Lindh_guess(void) {
// Build distance matrix
double **R = init_matrix(natom, natom);
for (int A=0; A<natom; ++A)
for (int B=0; B<=A; ++B)
R[B][A] = R[A][B] = v3d_dist(geom[A], geom[B]);
// Define "close" atoms;
double const dist_limit = 4.0;
bool **close = init_bool_matrix(natom, natom);
for (int A=0; A<natom; ++A)
for (int B=0; B<natom; ++B)
if (R[A][B] < dist_limit)
close[A][B] = true;
const double k_r = 0.45;
const double k_phi = 0.15;
const double k_tau = 0.005;
double Lindh_k;
/* If one neglects the gradient contribution to the transformation, then
one can loop over individual coordinates, and tabulate their contribution
to the cartesian hessian immediately. This code is below.
*/
/*
// Model is defined including ALL possible bends, angles, and torsions..
double **Hx = init_matrix(3*natom,3*natom);
// loop over all possible stretches, between i j in fragment
for (int i=0; i<natom; ++i)
for (int j=i+1; j<natom; ++j) {
if (close[i][j]) {
Lindh_k = k_r * Lindh_rho(i, j, R[i][j]);
STRE *s1 = new STRE(i,j);
double **sB = s1->DqDx(geom);
// H_x1_x2 = dq_i/dq_x1 d2E/dq_i^2 dq_i/dq_x2
for (int a=0; a < s1->g_natom(); ++a)
for (int xyz_a=0; xyz_a<3; ++xyz_a)
for (int b=0; b < s1->g_natom(); ++b)
for (int xyz_b=0; xyz_b<3; ++xyz_b)
Hx[3*s1->g_atom(a)+xyz_a][3*s1->g_atom(b)+xyz_b] +=
Lindh_k * sB[a][xyz_a] * sB[b][xyz_b];
delete s1;
}
}
// loop over all possible i j k
for (int i=0; i<natom; ++i)
for (int j=0; j<natom; ++j)
if (j != i)
for (int k=i+1; k<natom; ++k)
if (k != j) {
if (close[i][j] && close[j][k]) {
Lindh_k = k_phi * Lindh_rho(i, j, R[i][j]) *
Lindh_rho(j, k, R[j][k]);
BEND *b1 = new BEND(i,j,k);
double **bB = b1->DqDx(geom);
// H_x1_x2 = dq_i/dq_x1 d2E/dq_i^2 dq_i/dq_x2
for (int a=0; a<b1->g_natom(); ++a)
for (int xyz_a=0; xyz_a<3; ++xyz_a)
for (int b=0; b<b1->g_natom(); ++b)
for (int xyz_b=0; xyz_b<3; ++xyz_b)
Hx[3*b1->g_atom(a)+xyz_a][3*b1->g_atom(b)+xyz_b] +=
Lindh_k * bB[a][xyz_a] * bB[b][xyz_b];
delete b1;
}
}
for (int i=0; i<natom; ++i)
for (int j=0; j<natom; ++j)
if (j != i)
for (int k=0; k<natom; ++k)
if ( k!=i && k!=j)
for (int l=i+1; l<natom; ++l)
if ( l!=j && l!=k) {
if (close[i][j] && close[j][k] && close[k][l]) {
Lindh_k = k_tau * Lindh_rho(i, j, R[i][j]) *
Lindh_rho(j, k, R[j][k]) *
Lindh_rho(k, l, R[k][l]);
TORS *t1 = new TORS(i,j,k,l);
double **tB = t1->DqDx(geom);
// H_x1_x2 = dq_i/dq_x1 d2E/dq_i^2 dq_i/dq_x2
for (int a=0; a<t1->g_natom(); ++a)
for (int xyz_a=0; xyz_a<3; ++xyz_a)
for (int b=0; b<t1->g_natom(); ++b)
for (int xyz_b=0; xyz_b<3; ++xyz_b)
Hx[3*t1->g_atom(a)+xyz_a][3*t1->g_atom(b)+xyz_b] +=
Lindh_k * tB[a][xyz_a] * tB[b][xyz_b];
delete t1;
}
}
*/
/* To include the gradient term (g_q) in the transformation, we build the list of all
of the Lindh super-redundant coordinates first. Then we must compute the gradient
in this set of internals. */
// Generate coordinates between ALL atoms, but not
// complete reversals or using duplicate i,j,k,l.
for (int i=0; i<natom; ++i)
for (int j=i+1; j<natom; ++j)
if (close[i][j]) {
STRE *one_stre = new STRE(i, j);
coords.simples.push_back(one_stre);
}
for (int i=0; i<natom; ++i)
for (int j=0; j<natom; ++j)
if (close[j][i] && (j != i))
for (int k=i+1; k<natom; ++k)
if (close[k][j] && (k != j)) {
double val=0;
if (v3d_angle(geom[i], geom[j], geom[k], val)) {
BEND *one_bend = new BEND(i, j, k);
coords.simples.push_back(one_bend);
if (val > Opt_params.linear_bend_threshold) {
one_bend->make_lb_normal();
one_bend = new BEND(i,j,k);
one_bend->make_lb_complement();
coords.simples.push_back(one_bend);
}
}
}
for (int i=0; i<natom; ++i)
for (int j=0; j<natom; ++j)
if (close[j][i] && (j != i))
for (int k=0; k<natom; ++k)
if (close[k][j] && (k!=i) && (k!=j))
for (int l=i+1; l<natom; ++l)
if (close[l][k] && l!=j && l!=k) {
double val1=0, val2=0;
v3d_angle(geom[i], geom[j], geom[k], val1);
v3d_angle(geom[j], geom[k], geom[l], val2);
val1 = fabs(val1);
val2 = fabs(val2);
if (val1 > .02*_pi && val2 > .02*_pi && val1 <(_pi-.02) && val2 <(_pi-.02)) {
TORS *one_tors = new TORS(i, j, k, l);
coords.simples.push_back(one_tors);
}
}
free_bool_matrix(close);
form_trivial_coord_combinations();
// Compute g_q = (BB^t)^-1 B g_x
long int Nintco = coords.simples.size();
double **B = compute_B();
double *g_x = g_grad_array();
//oprintf_out("g_x\n");
//oprint_array_out(g_x,3*natom);
double *temp_arr = init_array(Nintco);
opt_matrix_mult(B, 0, &g_x, 1, &temp_arr, 1, Nintco, 3*natom, 1, 0);
free_array(g_x);
double **G = init_matrix(Nintco, Nintco);
for (int i=0; i<Nintco; ++i)
for (int k=0; k<3*natom; ++k)
for (int j=0; j<Nintco; ++j)
G[i][j] += B[i][k] * B[j][k];
free_matrix(B);
double **G_inv = symm_matrix_inv(G, Nintco, 1);
free_matrix(G);
double *g_q = init_array(Nintco);
opt_matrix_mult(G_inv, 0, &temp_arr, 1, &g_q, 1, Nintco, Nintco, 1, 0);
free_matrix(G_inv);
free_array(temp_arr);
// Done computing g_q
//oprintf_out("g_q\n");
//oprint_array_out(g_q,Nintco);
double **Hx = init_matrix(3*natom, 3*natom);
print_simples(psi_outfile, qc_outfile, 0);
for (std::size_t i=0; i<coords.simples.size(); ++i) { // loop over coords.simples
SIMPLE_COORDINATE * q = coords.simples.at(i);
double **Bintco = q->DqDx(geom); // dq_i / da_xyz
int natom_intco = q->g_natom();
if (q->g_type() == stre_type) {
int a = q->g_atom(0);
int b = q->g_atom(1);
Lindh_k = k_r * Lindh_rho(a, b, R[a][b]);
}
else if (q->g_type() == bend_type) {
int a = q->g_atom(0);
int b = q->g_atom(1);
int c = q->g_atom(2);
Lindh_k = k_phi * Lindh_rho(a, b, R[a][b])
* Lindh_rho(b, c, R[b][c]);
}
else if (q->g_type() == tors_type) {
int a = q->g_atom(0);
int b = q->g_atom(1);
int c = q->g_atom(2);
int d = q->g_atom(3);
Lindh_k = k_tau * Lindh_rho(a, b, R[a][b])
* Lindh_rho(b, c, R[b][c])
* Lindh_rho(c, d, R[c][d]);
}
else if (q->g_type() == cart_type) {
Lindh_k = 0.1;
}
// Hxy += k dq/dx dq/dy
for (int a=0; a < natom_intco; ++a) {
int x1 = q->g_atom(a);
for (int b=0; b < natom_intco; ++b) {
int x2 = q->g_atom(b);
for (int xyz1=0; xyz1<3; ++xyz1)
for (int xyz2=0; xyz2<3; ++xyz2)
Hx[3*x1 + xyz1][3*x2 + xyz2] += Lindh_k * Bintco[a][xyz1] * Bintco[b][xyz2];
}
}
free_matrix(Bintco);
// Hxy += dE/dq_i d2q_i/dxdy
double **Dq2 = q->Dq2Dx2(geom);
for (int a=0; a < natom_intco; ++a) {
int x1 = q->g_atom(a);
for (int b=0; b < natom_intco; ++b) {
int x2 = q->g_atom(b);
for (int xyz1=0; xyz1<3; ++xyz1)
for (int xyz2=0; xyz2<3; ++xyz2) {
Hx[3*x1 + xyz1][3*x2 + xyz2] += Lindh_k * g_q[i] * Dq2[3*a+xyz1][3*b+xyz2];
}
}
}
free_matrix(Dq2);
} // end loop over coords.simples
free_array(g_q);
free_matrix(R);
if (Opt_params.print_lvl >= 2) {
oprintf_out("Lindh cartesian Hessian guess\n");
oprint_matrix_out(Hx, 3*natom, 3*natom);
}
return Hx;
}
/*
// return period from atomic number
static inline int period(int Z) {
if (Z <= 2) return 1;
else if (Z <= 10) return 2;
else if (Z <= 18) return 3;
else if (Z <= 36) return 4;
else return 5;
}
// return Lindh alpha value from two periods
static inline double alpha_table(int perA, int perB) {
if (perA == 1) {
if (perB == 1)
return 1.000;
else
return 0.3949;
}
else {
if (perB == 1)
return 0.3949;
else
return 0.2800;
}
}
static inline double r_ref_table(int perA, int perB) {
if (perA == 1) {
if (perB == 1) return 1.35;
else if (perB == 2) return 2.10;
else return 2.53;
}
else if (perA == 2) {
if (perB == 1) return 2.10;
else if (perB == 2) return 2.87;
else return 3.40;
}
else {
if (perB == 1) return 2.53;
else return 3.40;
}
}
*/
}
| gpl-2.0 |
benelot/GVG-AI-2015 | src/benchmarking/RunAllHardHBFSLevelsRunConfig.java | 1468 | package benchmarking;
import misc.runners.RunConfig;
public class RunAllHardHBFSLevelsRunConfig extends RunConfig {
public RunAllHardHBFSLevelsRunConfig() {
String[] games = {
/**
* Deterministic games
*
*/
DeterministicGames.BAIT,
DeterministicGames.BOLOADVENTURES,
DeterministicGames.BOMBUZAL,
DeterministicGames.BOULDERDASH,
DeterministicGames.BRAINMAN,
DeterministicGames.CAMELRACE,
DeterministicGames.CATAPULTS,
DeterministicGames.CHIPSCHALLENGE,
DeterministicGames.DIGDUG,
DeterministicGames.ESCAPE,
DeterministicGames.FIRECASTER,
DeterministicGames.FIRESTORMS,
DeterministicGames.LABYRINTH,
DeterministicGames.LEMMINGS,
DeterministicGames.MODALITY,
DeterministicGames.OVERLOAD,
DeterministicGames.PAINTER,
DeterministicGames.PORTALS,
DeterministicGames.REALPORTALS,
DeterministicGames.REALSOKOBAN,
DeterministicGames.ROGUELIKE,
DeterministicGames.SOKOBAN,
DeterministicGames.SOLARFOX,
DeterministicGames.SURROUND,
DeterministicGames.THECITADEL,
DeterministicGames.ZELDA
};
for (int i = 0; i < games.length; i++) {
try {
addGameLevel(games[i], new int[]{4});
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//play every game only once. Can be changed from outside.
setRepetitions(1);
//get statistics for the benchmark
setCalculateStatistics(true);
}
}
| gpl-2.0 |
dphaener/thrive | sites/all/modules/ubercart/uc_order/uc_order-invoice-page.tpl.php | 915 | <?php
/**
* @file
* Default theme implementation to display a printable Ubercart invoice.
*
* @see template_preprocess_uc_order_invoice_page()
*/
?>
<!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="<?php print $language->language ?>" lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
<head>
<title><?php print $head_title; ?></title>
<style type="text/css">
.buttons {
text-align: right;
margin: 0 1em 1em 0;
}
</style>
<style type="text/css" media="print">
.buttons {
display: none;
}
</style>
</head>
<body>
<div class="buttons">
<input type="button" value="<?php print t('Print invoice'); ?>" onclick="window.print();" />
</div>
<?php print $content; ?>
</body>
</html>
| gpl-2.0 |
yast/yast-storage-ng | src/lib/y2storage/lvm_pv.rb | 2786 | # Copyright (c) [2017-2021] SUSE LLC
#
# All Rights Reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License 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 General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, contact SUSE LLC.
#
# To contact SUSE LLC about this file by physical or electronic mail, you may
# find current contact information at www.suse.com.
require "yast/i18n"
require "y2storage/storage_class_wrapper"
require "y2storage/device"
module Y2Storage
# A physical volume of the Logical Volume Manager (LVM)
#
# This is a wrapper for Storage::LvmPv
class LvmPv < Device
include Yast::I18n
wrap_class Storage::LvmPv
# @!method self.all(devicegraph)
# @param devicegraph [Devicegraph]
# @return [Array<Disk>] all the physical volumes in the given devicegraph
storage_class_forward :all, as: "LvmPv"
# @!method lvm_vg
# @return [LvmVg] volume group the PV is part of
storage_forward :lvm_vg, as: "LvmVg", check_with: :has_lvm_vg
# @!method blk_device
# Block device directly hosting the PV. That is, for encrypted PVs it
# returns the encryption device.
#
# @return [BlkDevice]
storage_forward :blk_device, as: "BlkDevice", check_with: :has_blk_device
# @!method usable_size
# Returns the size of the PV usable for extents.
#
# @return [DiskSize]
storage_forward :usable_size, as: "DiskSize"
# Raw (non encrypted) version of the device hosting the PV.
#
# If the PV is not encrypted, this is equivalent to #blk_device, otherwise
# it returns the original device instead of the encryption one.
#
# @return [BlkDevice]
def plain_blk_device
blk_device.plain_device
end
# Whether the PV is unused (not associated to any VG)
#
# @return [Boolean]
def unused?
lvm_vg.nil?
end
# Display name to represent the PV
#
# Only unused PV has its own representation.
#
# @return [String, nil]
def display_name
return nil unless unused?
textdomain "storage"
# TRANSLATORS: display name when the PV has no associated VG, where %{device} is replaced by a
# device name (e.g., "/dev/sda1").
format(_("Unused LVM PV on %{device}"), device: plain_blk_device.name)
end
protected
# @see Device#is?
def types_for_is
super << :lvm_pv
end
end
end
| gpl-2.0 |
metno/eps2probandltf | src/generator/ProbabilityGeneratorControl.cpp | 2548 | /*
probabilityForecast
Copyright (C) 2008 met.no
Contact information:
Norwegian Meteorological Institute
Box 43 Blindern
0313 OSLO
NORWAY
E-mail: probabilityForecast@met.no
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, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA
*/
#include "ProbabilityGeneratorControl.h"
#include "ProbabilityGenerator.h"
#include <data_access/Source.h>
#include <localtime.h>
#include <log4cxx/logger.h>
#include <sstream>
#include <functional>
using namespace std;
ProbabilityGeneratorControl::ProbabilityGeneratorControl(
data_access::Source & dataSource,
data_access::Sink & dataSink,
const ProbabilityGenerationConfiguration::GeneratorControl & conf)
: source_(dataSource), sink_(dataSink), conf_(conf)
{}
ProbabilityGeneratorControl::~ProbabilityGeneratorControl()
{}
void ProbabilityGeneratorControl::work()
{
log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("pgen_probability.control"));
const type::TimeListPtr validTimes = source_.getValidTimes();
LOG4CXX_DEBUG(logger, "Found valid time list");
if ( validTimes->empty() )
throw std::runtime_error("No data found");
type::Duration hoursToGenerate(conf_.numberOfHoursToGenerate,0,0,0);
type::Time lastGenerateTime = (*validTimes)[0] + hoursToGenerate;
for ( type::TimeList::const_iterator it = validTimes->begin(); it != validTimes->end() and * it < lastGenerateTime; ++ it )
{
const type::Time & time = * it;//(*validTimes)[timeStep];
const std::string timeString = string_from_local_date_time(time);
LOG4CXX_INFO(logger, "Starting work on valid time " + timeString);
ProbabilityGenerator generator(source_, sink_, conf_, time );
try
{
generator.work();
}
catch( std::out_of_range & )
{
LOG4CXX_WARN(logger, "Insufficient data to generate probabilities for time " + string_from_local_date_time(time));
}
catch( std::exception & e )
{
}
LOG4CXX_INFO(logger, timeString + " done");
}
}
| gpl-2.0 |
sung9155/pebble-korean-language-pack | PebbleSDK-3.2.1/Pebble/common/tools/stm32_crc.py | 1405 | CRC_POLY = 0x04C11DB7
def precompute_table(bits):
lookup_table = []
for i in xrange(2**bits):
rr = i << (32 - bits)
for x in xrange(bits):
if rr & 0x80000000:
rr = (rr << 1) ^ CRC_POLY
else:
rr <<= 1
lookup_table.append(rr & 0xffffffff)
return lookup_table
lookup_table = precompute_table(8)
def process_word(data, crc=0xffffffff):
if (len(data) < 4):
# The CRC data is "padded" in a very unique and confusing fashion.
data = data[::-1] + '\0' * (4 - len(data))
for char in reversed(data):
b = ord(char)
crc = ((crc << 8) ^ lookup_table[(crc >> 24) ^ b]) & 0xffffffff
return crc
def process_buffer(buf, c=0xffffffff):
word_count = (len(buf) + 3) / 4
crc = c
for i in xrange(word_count):
crc = process_word(buf[i * 4 : (i + 1) * 4], crc)
return crc
def crc32(data):
return process_buffer(data)
if __name__ == '__main__':
import sys
assert(0x89f3bab2 == process_buffer("123 567 901 34"))
assert(0xaff19057 == process_buffer("123456789"))
assert(0x519b130 == process_buffer("\xfe\xff\xfe\xff"))
assert(0x495e02ca == process_buffer("\xfe\xff\xfe\xff\x88"))
print "All tests passed!"
if len(sys.argv) >= 2:
b = open(sys.argv[1]).read()
crc = crc32(b)
print "%u or 0x%x" % (crc, crc)
| gpl-2.0 |
intervalo/santiago-reyes.com | wp-content/themes/expositio/functions.php | 4581 | <?php
/***** Theme setup *****/
load_theme_textdomain('free01', get_template_directory() . '/languages');
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic-feed-links' );
/**
* Add Home page to the menu handling
*/
function free01_home_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'free01_home_page_menu_args' );
function free01_remove_submenus() {
global $submenu;
remove_submenu_page( 'themes.php', 'widgets.php' );
}
add_action('admin_menu', 'free01_remove_submenus');
function free01_setup() {
/***** Navigation & Menu *****/
$menus = array(
__('Main menu', 'free01') => __('Main menu', 'free01'),
);
foreach ( $menus as $key=>$value ) {
if ( !is_nav_menu( $key ) ) wp_update_nav_menu_item( wp_create_nav_menu( $key ), 1 );
}
if ( function_exists( 'register_nav_menus' ) ) {
register_nav_menus($menus);
}
remove_action('wp_head', '_admin_bar_bump_cb');
}
add_action( 'init', 'free01_setup' );
/**
* Add items to the admin bar
*/
function free01_admin_bar() {
global $wp_admin_bar;
if ( !is_super_admin() || !is_admin_bar_showing() )
return;
$wp_admin_bar->add_menu( array( 'id' => 'wpshower_admin', 'title' => __( 'Expositio Theme', 'free01' ), 'href' => FALSE ) );
$wp_admin_bar->add_menu( array( 'parent' => 'wpshower_admin', 'title' => __( 'Support Forum', 'free01' ), 'href' => 'http://wpshower.com/forums' ) );
$wp_admin_bar->add_menu( array( 'parent' => 'wpshower_admin', 'title' => __( 'Theme Options', 'free01' ), 'href' => site_url().'/wp-admin/themes.php?page=theme_options.php' ) );
}
add_action( 'admin_bar_menu', 'free01_admin_bar', 1000 );
/**
*
*/
function free01_get_comments_link($post_id ) {
if (!$post_id) return null;
$strResult = '';
$zero = __( 'No Comments', 'free01' );
$one = __( '1 Comment', 'free01' );
$more = __( '%d Comments', 'free01' );
$obj_count_comments = wp_count_comments( $post_id );
$numTmp = $obj_count_comments->approved;
$strResult .= '<a href="'.get_permalink($post_id) . '#respond'.'" title="'.__('Post comment for this entry', 'free01').'">';
if ($numTmp > 1) $strResult .= sprintf($more, $numTmp);
else if ($numTmp == 1) $strResult .= $one;
else $strResult .= $zero;
$strResult .= '</a>';
return $strResult;
}
/**
*
*/
function free01_get_intro($strText, $numTmp = 200, $strMore='') {
$strTmp = $strText;
$arrTmp = preg_split('/<!--more-->/', $strTmp);
$strIntro = strip_tags($arrTmp[0]);
if ($numTmp == 0)
{
return $strIntro;
}
else if (strlen($strIntro) > $numTmp)
{
$strIntro = @strpos($strIntro, ' ', $numTmp) ? substr($strIntro, 0, strpos($strIntro, ' ', $numTmp)) : $strIntro;
return $strIntro.$strMore;
}
else
{
return $strIntro;
}
}
class extended_walker extends Walker_Nav_Menu{
function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
if ( !$element )
return;
$id_field = $this->db_fields['id'];
if ( is_array( $args[0] ) )
$args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
if( ! empty( $children_elements[$element->$id_field] ) )
array_push($element->classes,'parent');
$cb_args = array_merge( array(&$output, $element, $depth), $args);
call_user_func_array(array(&$this, 'start_el'), $cb_args);
$id = $element->$id_field;
if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {
foreach( $children_elements[ $id ] as $child ){
if ( !isset($newlevel) ) {
$newlevel = true;
$cb_args = array_merge( array(&$output, $depth), $args);
call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
}
$this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
}
unset( $children_elements[ $id ] );
}
if ( isset($newlevel) && $newlevel ){
$cb_args = array_merge( array(&$output, $depth), $args);
call_user_func_array(array(&$this, 'end_lvl'), $cb_args);
}
$cb_args = array_merge( array(&$output, $element, $depth), $args);
call_user_func_array(array(&$this, 'end_el'), $cb_args);
}
}
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'Widgetized Area',
'id' => 'widgetized-area',
'description' => 'This is a widgetized area.',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}
require_once (TEMPLATEPATH . '/includes/theme_options.php'); | gpl-2.0 |
williamlucia/clustering-community-detection | HierarchicalClustering/src/hierarchical/LinkageCriterion.java | 85 | package hierarchical;
public enum LinkageCriterion {
SINGLE,
COMPLETE,
AVERAGE
}
| gpl-2.0 |
bitcraze/crazyflie-lib-python | test/localization/test_lighthouse_geometry_solver.py | 4618 | # -*- coding: utf-8 -*-
#
# ,---------, ____ _ __
# | ,-^-, | / __ )(_) /_______________ _____ ___
# | ( O ) | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# | / ,--' | / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# +------` /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2022 Bitcraze AB
#
# 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, in version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from test.localization.lighthouse_fixtures import LighthouseFixtures
from test.localization.lighthouse_test_base import LighthouseTestBase
from cflib.localization.lighthouse_geometry_solver import LighthouseGeometrySolver
from cflib.localization.lighthouse_initial_estimator import LighthouseInitialEstimator
from cflib.localization.lighthouse_types import LhCfPoseSample
from cflib.localization.lighthouse_types import LhDeck4SensorPositions
class TestLighthouseGeometrySolver(LighthouseTestBase):
def setUp(self):
self.fixtures = LighthouseFixtures()
def test_that_one_bs_poses_in_one_sample_is_estimated(self):
# Fixture
# CF_ORIGIN is used in the first sample and will define the global reference frame
bs_id0 = 3
matched_samples = [
LhCfPoseSample(angles_calibrated={
bs_id0: self.fixtures.angles_cf_origin_bs0,
}),
]
initial_guess = LighthouseInitialEstimator.estimate(matched_samples, LhDeck4SensorPositions.positions)
# Test
actual = LighthouseGeometrySolver.solve(
initial_guess, matched_samples, LhDeck4SensorPositions.positions)
# Assert
bs_poses = actual.bs_poses
self.assertPosesAlmostEqual(self.fixtures.BS0_POSE, bs_poses[bs_id0], places=3)
def test_that_two_bs_poses_in_one_sample_are_estimated(self):
# Fixture
# CF_ORIGIN is used in the first sample and will define the global reference frame
bs_id0 = 3
bs_id1 = 1
matched_samples = [
LhCfPoseSample(angles_calibrated={
bs_id0: self.fixtures.angles_cf_origin_bs0,
bs_id1: self.fixtures.angles_cf_origin_bs1,
}),
]
initial_guess = LighthouseInitialEstimator.estimate(matched_samples, LhDeck4SensorPositions.positions)
# Test
actual = LighthouseGeometrySolver.solve(
initial_guess, matched_samples, LhDeck4SensorPositions.positions)
# Assert
bs_poses = actual.bs_poses
self.assertPosesAlmostEqual(self.fixtures.BS0_POSE, bs_poses[bs_id0], places=3)
self.assertPosesAlmostEqual(self.fixtures.BS1_POSE, bs_poses[bs_id1], places=3)
def test_that_linked_bs_poses_in_multiple_samples_are_estimated(self):
# Fixture
# CF_ORIGIN is used in the first sample and will define the global reference frame
bs_id0 = 7
bs_id1 = 2
bs_id2 = 9
bs_id3 = 3
matched_samples = [
LhCfPoseSample(angles_calibrated={
bs_id0: self.fixtures.angles_cf_origin_bs0,
bs_id1: self.fixtures.angles_cf_origin_bs1,
}),
LhCfPoseSample(angles_calibrated={
bs_id1: self.fixtures.angles_cf1_bs1,
bs_id2: self.fixtures.angles_cf1_bs2,
}),
LhCfPoseSample(angles_calibrated={
bs_id2: self.fixtures.angles_cf2_bs2,
bs_id3: self.fixtures.angles_cf2_bs3,
}),
]
initial_guess = LighthouseInitialEstimator.estimate(matched_samples, LhDeck4SensorPositions.positions)
# Test
actual = LighthouseGeometrySolver.solve(
initial_guess, matched_samples, LhDeck4SensorPositions.positions)
# Assert
bs_poses = actual.bs_poses
self.assertPosesAlmostEqual(self.fixtures.BS0_POSE, bs_poses[bs_id0], places=3)
self.assertPosesAlmostEqual(self.fixtures.BS1_POSE, bs_poses[bs_id1], places=3)
self.assertPosesAlmostEqual(self.fixtures.BS2_POSE, bs_poses[bs_id2], places=3)
self.assertPosesAlmostEqual(self.fixtures.BS3_POSE, bs_poses[bs_id3], places=3)
| gpl-2.0 |
cnpisit/myangkorpeopel | modules/mod_rokstories/helper.php | 19148 | <?php
/**
* @version $Id: helper.php 6796 2013-01-27 19:56:01Z btowles $
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2013 RocketTheme, LLC
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
require_once (JPath::clean(JPATH_SITE . '/components/com_content/models/articles.php'));
require_once (JPath::clean(JPATH_SITE . '/components/com_content/helpers/route.php'));
if (file_exists(JPath::clean(JPATH_SITE . '/libraries/joomla/html/html/content.php'))) require_once (JPath::clean(JPATH_SITE . '/libraries/joomla/html/html/content.php'));
if (class_exists('JModelLegacy')) JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel');
/**
* @package RocketTheme
* @subpackage rokstories
*/
class modRokStoriesHelper
{
public static function loadScripts(&$module, &$params)
{
JHtml::_('behavior.framework', true);
$swidth = $params->get("start_width", 410);
$layout = $params->get("layout_type", "layout1");
$thumbsOpacity = $params->get("thumbs_opacity", 0.3);
if ($swidth == 'auto' || $layout == 'layout2') $swidth = "'auto'";
if ($layout == 'layout2') $thumbsOpacity = 1;
$tlx = $params->get('left_offset_x', -40);
$tly = $params->get('left_offset_y', -100);
$trx = $params->get('right_offset_x', -30);
$try = $params->get('right_offset_y', -100);
if ($params->get("fixed_thumb", 1) == 0) {
$tlx = $params->get('left_f_offset_x', -55);
$tly = $params->get('left_f_offset_y', -105);
$trx = $params->get('right_f_offset_x', -55);
$try = $params->get('right_f_offset_y', -105);
}
$leftOffset = "{x: $tlx, y: $tly}";
$rightOffset = "{x: $trx, y: $try}";
$document = JFactory::getDocument();
if (!defined('ROKSTORIES')) {
$document->addScript(JURI::Root(true) . "/modules/mod_rokstories/tmpl/js/rokstories" . self::_getJSVersion() . ".js");
$document->addScriptDeclaration("var RokStoriesImage = {}, RokStoriesLinks = {};");
define('ROKSTORIES', 1);
}
$document->addScriptDeclaration("
RokStoriesImage['rokstories-{$module->id}'] = [];
RokStoriesLinks['rokstories-{$module->id}'] = [];
window.addEvent('domready', function() {
new RokStories('rokstories-{$module->id}', {
'id': " . $module->id . ",
'startElement': " . $params->get("start_element", 0) . ",
'thumbsOpacity': " . $thumbsOpacity . ",
'mousetype': '" . $params->get("mouse_type", "click") . "',
'autorun': " . $params->get("autoplay", 0) . ",
'delay': " . $params->get("autoplay_delay", 5000) . ",
'scrollerDuration': " . $params->get("scrollerDuration", 5000) . ",
'scrollerTransition': Fx.Transitions." . $params->get("scrollerTransition", 'Expo.easeInOut') . ",
'startWidth': " . $swidth . ",
'layout': '$layout',
'linkedImgs': " . $params->get("link_images", 0) . ",
'showThumbs': " . $params->get("show_thumbs", 0) . ",
'fixedThumb': " . $params->get("fixed_thumb", 1) . ",
'mask': " . $params->get('show_mask', 1) . ",
'descsAnim': '" . $params->get('mask_desc_dir', 'topdown') . "',
'imgsAnim': '" . $params->get('mask_imgs_dir', 'bottomup') . "',
'thumbLeftOffsets': $leftOffset,
'thumbRightOffsets': $rightOffset
});
});");
}
function getList($params)
{
$app = JFactory::getApplication();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$userId = (int)$user->get('id');
$jnow = JFactory::getDate();
$now = $db->Quote($jnow->toSql());
$null = $db->Quote($db->getNullDate());
$count = $params->get('count', 4);
$catid = $params->get('catid');
$show_front = $params->get('show_front', 1);
$aid = $user->get('aid', 0);
$content_type = $params->get('content_type', 'joomla');
$ordering = $params->get('itemsOrdering');
$cid = $params->get('category_id', NULL);
$user_id = $params->get('user_id');
$thumb_size = $params->get('thumb_width', 90);
// content specific stuff
if ($content_type == 'joomla') {
$joomla_image = $params->get('joomla_image', 'text');
// start Joomla specific
jimport('joomla.application.component.model');
// Get an instance of the generic articles model
if (class_exists('JModelLegacy')) {
$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
} else {
$model = JModel::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
}
// Set application parameters in model
$appParams = JFactory::getApplication()->getParams();
$model->setState('params', $appParams);
// Set the filters based on the module params
$model->setState('list.start', 0);
$model->setState('list.limit', $count);
$model->setState('filter.published', 1);
// Access filter
$access = !JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$model->setState('filter.access', $access);
// Category filter
$model->setState('filter.category_id', $catid);
// User filter
$userId = JFactory::getUser()->get('id');
switch ($user_id) {
case 'by_me':
$model->setState('filter.author_id', (int)$userId);
break;
case 'not_me':
$model->setState('filter.author_id', $userId);
$model->setState('filter.author_id.include', false);
break;
case 0:
break;
default:
$model->setState('filter.author_id', $user_id);
break;
}
// Featured switch
switch ($show_front) {
case 1:
$model->setState('filter.featured', 'show');
break;
case 0:
$model->setState('filter.featured', 'hide');
break;
default:
$model->setState('filter.featured', 'only');
break;
}
// ordering
switch ($ordering) {
case 'date' :
$orderby = 'a.created ASC';
break;
case 'rdate' :
$orderby = 'a.created DESC';
break;
case 'alpha' :
$orderby = 'a.title';
break;
case 'ralpha' :
$orderby = 'a.title DESC';
break;
case 'order':
if ($show_front == '2') $orderby = 'a.featured_ordering'; else
$orderby = 'a.ordering';
break;
case 'random' :
$orderby = 'RAND()';
break;
default :
$orderby = 'a.id DESC';
break;
}
$ordering = explode(' ', $orderby);
$model->setState('list.ordering', $ordering[0]);
$model->setState('list.direction', isset($ordering[1]) ? $ordering[1] : null);
$rows = $model->getItems();
// end Joomla specific
} else {
// start K2 specific
require_once(JPATH_SITE . '/components/com_k2/models/itemlist.php');
require_once(JPATH_SITE . '/components/com_k2/helpers/route.php');
require_once(JPATH_SITE . '/components/com_k2/helpers/utilities.php');
//Initialize Variables
$k2_category = $params->get('k2_category', array());
$k2_children = $params->get('k2_children', 0);
$k2_ordering = $params->get('k2_ordering', 'a.title');
$k2_featured = $params->get('k2_featured', 1);
$k2_image_size = $params->get('k2_image_size', 'M');
$query = "SELECT a.*, c.name AS categoryname,c.id AS categoryid, c.alias AS categoryalias, c.params AS categoryparams";
$query .= " FROM #__k2_items as a LEFT JOIN #__k2_categories c ON c.id = a.catid";
$query .= " WHERE a.published = 1 AND a.access IN(" . implode(',', $user->authorisedLevels()) . ") AND a.trash = 0 AND c.published = 1 AND c.access IN(" . implode(',', $user->authorisedLevels()) . ") AND c.trash = 0";
//User Filter
switch ($user_id) {
case 'by_me':
$query .= ' AND (a.created_by = ' . (int)$userId . ' OR a.modified_by = ' . (int)$userId . ')';
break;
case 'not_me':
$query .= ' AND (a.created_by <> ' . (int)$userId . ' AND a.modified_by <> ' . (int)$userId . ')';
break;
}
$query .= " AND ( a.publish_up = " . $null . " OR a.publish_up <= " . $now . " )";
$query .= " AND ( a.publish_down = " . $null . " OR a.publish_down >= " . $now . " )";
if (!is_null($k2_category)) {
if (is_array($k2_category)) {
if ($k2_children) {
require_once (JPATH_SITE . '/components/com_k2/models/itemlist.php');
$categories = K2ModelItemlist::getCategoryTree($k2_category);
$sql = @implode(',', $categories);
$query .= " AND a.catid IN ({$sql})";
} else {
JArrayHelper::toInteger($k2_category);
$query .= " AND a.catid IN(" . implode(',', $k2_category) . ")";
}
} else {
if ($k2_children) {
require_once (JPATH_SITE . '/components/com_k2/models/itemlist.php');
$categories = K2ModelItemlist::getCategoryTree($k2_category);
$sql = @implode(',', $categories);
$query .= " AND a.catid IN ({$sql})";
} else {
$query .= " AND a.catid=" . (int)$k2_category;
}
}
}
if ($k2_featured == '0') $query .= " AND a.featured != 1";
if ($k2_featured == '2') $query .= " AND a.featured = 1";
if ($app->getLanguageFilter()) {
$languageTag = JFactory::getLanguage()->getTag();
$query .= " AND c.language IN (" . $db->Quote($languageTag) . ", " . $db->Quote('*') . ") AND a.language IN (" . $db->Quote($languageTag) . ", " . $db->Quote('*') . ")";
}
// ordering
switch ($ordering) {
case 'date' :
$orderby = 'a.created ASC';
break;
case 'rdate' :
$orderby = 'a.created DESC';
break;
case 'alpha' :
$orderby = 'a.title';
break;
case 'ralpha' :
$orderby = 'a.title DESC';
break;
case 'order':
if ($k2_featured == '2') $orderby = 'a.featured_ordering'; else
$orderby = 'a.ordering';
break;
case 'random' :
$orderby = 'RAND()';
break;
default :
$orderby = 'a.id DESC';
break;
}
$query .= " ORDER BY " . $orderby;
$db->setQuery($query, 0, $count);
$rows = $db->loadObjectList();
}
$i = 0;
$lists = array();
foreach ($rows as $row) {
//process content plugins
$text = JHtml::_('content.prepare', $row->introtext);
$lists[$i] = new stdClass();
$lists[$i]->id = $row->id;
$lists[$i]->created = $row->created;
$lists[$i]->modified = $row->modified;
$lists[$i]->title = htmlspecialchars($row->title);
$lists[$i]->introtext = self::prepareContent($text, $params);
if ($content_type == 'joomla') {
$lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->id . ":" . $row->alias, $row->catid . ":" . $row->category_alias));
$images = self::getImages($row->images, $row->introtext, $joomla_image, $thumb_size);
} else {
$lists[$i]->link = JRoute::_(K2HelperRoute::getItemRoute($row->id, $row->catid));
$images = self::getK2Images($row->id, $k2_image_size, $thumb_size);
}
if ($images) {
$lists[$i]->image = ($images->image) ? $images->image : '';
$lists[$i]->thumb = ($images->thumb) ? $images->thumb : '';
$lists[$i]->thumbSizes = ($images->thumbSizes) ? $images->thumbSizes : '';
} else {
$lists[$i]->image = '';
$lists[$i]->thumb = '';
$lists[$i]->thumbSizes = '';
}
$i++;
}
return $lists;
}
private static function getK2Images($id, $image_size, $thumb_size = 70)
{
$images = new stdClass();
$images->image = false;
$images->thumb = false;
$images->thumbSizes = array('width' => $thumb_size, 'height' => 'auto');
$current_size = intval($thumb_size);
if (file_exists(JPATH_SITE . '/media/k2/items/cache/' . md5("Image" . $id) . '_' . $image_size . '.jpg')) {
$image_path = 'media/k2/items/cache/' . md5("Image" . $id) . '_' . $image_size . '.jpg';
$images->image = JURI::Root(true) . '/' . $image_path;
// create a thumb filename
$file_div = strrpos($image_path, '.');
$thumb_ext = substr($image_path, $file_div);
$thumb_prev = substr($image_path, 0, $file_div);
$thumb_path = $thumb_prev . "_thumb" . $thumb_ext;
// check to see if this file exists, if so we don't need to create it
if (function_exists("gd_info")) {
// file doens't exist, so create it and save it
if (!class_exists("Thumbnail")) include_once('thumbnail.inc.php');
if (file_exists($thumb_path)) {
$existing_thumb = new Thumbnail($thumb_path);
$current_size = $existing_thumb->getCurrentWidth();
$images->thumbSizes = $existing_thumb->currentDimensions;
}
if (!file_exists($thumb_path) || $current_size != $thumb_size) {
$thumb = new Thumbnail($image_path);
if ($thumb->error) {
echo "ROKSTORIES ERROR: " . $thumb->errmsg . ": " . $image_path;
return false;
}
$thumb->resize($thumb_size);
if (!is_writable(dirname($thumb_path))) {
$thumb->destruct();
return false;
}
$thumb->save($thumb_path);
$images->thumbSizes = $thumb->currentDimensions;
$thumb->destruct();
}
}
$images->thumb = $thumb_path;
}
return $images;
}
private static function getImages($db_images, $text = array(), $joomla_image = 'text', $thumb_size = 70)
{
if ($joomla_image == 'text') {
$images = self::getImagesFromText($text, $thumb_size);
} else {
$images = self::getSelectedImages($db_images, $joomla_image, $thumb_size);
}
return $images;
}
private static function getSelectedImages($db_images, $joomla_image = 'full', $thumb_size = 70)
{
$images = new stdClass();
$images->image = false;
$images->thumb = false;
$images->thumbSizes = array('width' => $thumb_size, 'height' => 'auto');
$current_size = intval($thumb_size);
$db_images = json_decode($db_images);
$image_fulltext = $db_images->image_fulltext;
$image_intro = $db_images->image_intro;
if ($joomla_image == 'full') {
$image = ($image_fulltext) ? $image_fulltext : $image_intro;
} else {
$image = ($image_intro) ? $image_intro : $image_fulltext;
}
if (file_exists(JPATH_SITE . '/' . $image)) {
$image_path = $image;
$images->image = JURI::Root(true) . '/' . $image_path;
// create a thumb filename
$file_div = strrpos($image_path, '.');
$thumb_ext = substr($image_path, $file_div);
$thumb_prev = substr($image_path, 0, $file_div);
$thumb_path = $thumb_prev . "_thumb" . $thumb_ext;
// check to see if this file exists, if so we don't need to create it
if (function_exists("gd_info")) {
// file doens't exist, so create it and save it
if (!class_exists("Thumbnail")) include_once('thumbnail.inc.php');
if (file_exists($thumb_path)) {
$existing_thumb = new Thumbnail($thumb_path);
$current_size = $existing_thumb->getCurrentWidth();
$images->thumbSizes = $existing_thumb->currentDimensions;
}
if (!file_exists($thumb_path) || $current_size != $thumb_size) {
$thumb = new Thumbnail($image_path);
if ($thumb->error) {
echo "ROKSTORIES ERROR: " . $thumb->errmsg . ": " . $image_path;
return false;
}
$thumb->resize($thumb_size);
if (!is_writable(dirname($thumb_path))) {
$thumb->destruct();
return false;
}
$thumb->save($thumb_path);
$images->thumbSizes = $thumb->currentDimensions;
$thumb->destruct();
}
}
$images->thumb = $thumb_path;
return $images;
} else {
return false;
}
}
private static function getImagesFromText($text, $thumb_size = 70)
{
preg_match("/\<img.+?src=\"(.+?)\".+?\/>/", $text, $matches);
$images = new stdClass();
$images->image = false;
$images->thumb = false;
$images->thumbSizes = array('width' => $thumb_size, 'height' => 'auto');
$paths = array();
if (isset($matches[1])) {
$image_path = $matches[1];
//joomla 1.5 only
$full_url = JURI::base();
//remove any protocol/site info from the image path
$parsed_url = parse_url($full_url);
$paths[] = $full_url;
if (isset($parsed_url['path']) && $parsed_url['path'] != "/") $paths[] = $parsed_url['path'];
foreach ($paths as $path) {
if (strpos($image_path, $path) === 0) {
$image_path = substr($image_path, strpos($image_path, $path) + strlen($path));
}
}
// remove any / that begins the path
if (substr($image_path, 0, 1) == '/') $image_path = substr($image_path, 1);
//if after removing the uri, still has protocol then the image
//is remote and we don't support thumbs for external images
if (strpos($image_path, 'http://') !== false || strpos($image_path, 'https://') !== false
) {
return false;
}
$images->image = JURI::Root(True) . "/" . $image_path;
// create a thumb filename
$file_div = strrpos($image_path, '.');
$thumb_ext = substr($image_path, $file_div);
$thumb_prev = substr($image_path, 0, $file_div);
$thumb_path = $thumb_prev . "_thumb" . $thumb_ext;
// check to see if this file exists, if so we don't need to create it
if (function_exists("gd_info")) {
// file doens't exist, so create it and save it
if (!class_exists("Thumbnail")) include_once('thumbnail.inc.php');
if (file_exists($thumb_path)) {
$existing_thumb = new Thumbnail($thumb_path);
$current_size = $existing_thumb->getCurrentWidth();
$images->thumbSizes = $existing_thumb->currentDimensions;
} else {
$thumb = new Thumbnail($image_path);
if ($thumb->error) {
echo "ROKSTORIES ERROR: " . $thumb->errmsg . ": " . $image_path;
return false;
}
$thumb->resize($thumb_size);
if (!is_writable(dirname($thumb_path))) {
$thumb->destruct();
return false;
}
$thumb->save($thumb_path);
$images->thumbSizes = $thumb->currentDimensions;
$thumb->destruct();
}
}
$images->thumb = $thumb_path;
}
return $images;
}
private static function prepareContent($text, &$params)
{
$tags_option = $params->get('strip_tags', 'a,i,br');
$tags = explode(",", $tags_option);
$strip_tags = array();
for ($i = 0; $i < count($tags); $i++) {
$strip_tags[$i] = '<' . trim($tags[$i]) . '>';
}
$tags = implode(',', $strip_tags);
// strips tags won't remove the actual jscript
$text = preg_replace("'<script[^>]*>.*?</script>'si", "", $text);
$text = preg_replace('/{.+?}/', '', $text);
$text = strip_tags($text, $tags);
return $text;
}
public static function checkRequest()
{
return (JFactory::getApplication()->input->getBool('import') == 'true');
}
public static function getBrowser()
{
$agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? strtolower($_SERVER['HTTP_USER_AGENT']) : false;
$ie_version = false;
if (preg_match("/msie/", $agent) && !preg_match("/opera/", $agent)) {
$val = explode(" ", stristr($agent, "msie"));
$ver = explode(".", $val[1]);
$ie_version = $ver[0];
$ie_version = preg_replace("#[^0-9,.,a-z,A-Z]#", "", $ie_version);
}
return $ie_version;
}
private static function _getJSVersion()
{
return "";
}
}
| gpl-2.0 |
ligenzatomas/firebird-vizualization-tool | src/main/java/org/tinyuml/util/MethodCall.java | 2024 | /**
* Copyright 2007 Wei-ju Wu
*
* This file is part of TinyUML.
*
* TinyUML 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.
*
* TinyUML 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 TinyUML; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package org.tinyuml.util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* This class implements a method call by reflection. It is used to implement
* pluggable selectors.
*
* @author Wei-ju Wu
* @version 1.0
*/
public class MethodCall {
private Method method;
private final Object[] methodParameters;
/**
* Constructor.
* @param theMethod the method to call
* @param parameters the parameter list
*/
public MethodCall(final Method theMethod, final Object... parameters) {
method = theMethod;
methodParameters = new Object[parameters.length];
for (int i = 0; i < parameters.length; i++) {
methodParameters[i] = parameters[i];
}
}
/**
* Returns the method.
* @return the method.
*/
public Method getMethod() { return method; }
/**
* Call the method on the specified target.
* @param target the target object
*/
public void call(Object target) {
try {
method.invoke(target, methodParameters);
} catch (InvocationTargetException ex) {
ex.printStackTrace();
} catch (IllegalAccessException ex) {
ex.printStackTrace();
}
}
}
| gpl-2.0 |
NavarraBiomed/clips | studies_app/migrations_back/0003_auto_20161102_1210.py | 30860 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('studies_app', '0002_auto_20161102_1206'),
]
operations = [
migrations.RemoveField(
model_name='obsinternationalcase',
name='observationalcase_ptr',
),
migrations.AddField(
model_name='obsinternationalcase',
name='accesibility',
field=models.IntegerField(choices=[(1, 'Easy'), (2, 'Medium'), (3, 'Difficult')], verbose_name='Accesibility', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='adrenaline',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Adrenaline', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='age',
field=models.IntegerField(verbose_name='Age', validators=[django.core.validators.MinValueValidator(0)], blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='age_interval',
field=models.IntegerField(choices=[(1, '< 60'), (2, '60-74'), (3, '>= 75')], max_length=2, blank=True, null=True, verbose_name='Age interval'),
),
migrations.AddField(
model_name='obsinternationalcase',
name='anticoagulants',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Aspirin'), (2, 'Clopidogrel'), (3, 'Other antiagregant'), (4, 'Warfarin'), (5, 'NSAID'), (6, '2 NSAID including aspiring or not'), (7, 'Aspirin+clopidogrel'), (8, 'NACOs')], verbose_name='Anticoagulants', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='area_square_cm',
field=models.IntegerField(verbose_name='Area (cm2)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='argon_PC',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes: incomplete resection'), (2, 'Yes: coagulation'), (3, 'Yes: per protocol')], verbose_name='Argon PC', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='asa',
field=models.IntegerField(choices=[(1, 'I'), (2, 'II'), (3, 'III'), (4, 'IV')], verbose_name='ASA', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='aspirin',
field=models.IntegerField(choices=[(0, 'No'), (1, '100mg cease'), (2, '300mg cease'), (3, '100mg during EMR'), (4, '300mg during EMR')], verbose_name='Aspirin', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='bleeding',
field=models.IntegerField(choices=[(0, 'No'), (1, 'During no clinical impact-autol'), (2, 'During exploration with clinical impact'), (3, '24h'), (4, '24-48h'), (5, '3-7 days'), (6, '>7 days')], verbose_name='Bleeding', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='bleeding_treatment',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Inyection'), (2, 'Clipping'), (3, 'ArgonPC'), (4, 'Coagulation forceps'), (5, '2 methods')], verbose_name='Bleeding treatment', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='budding',
field=models.IntegerField(choices=[(0, 'No'), (1, 'High grade')], verbose_name='Budding', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='chicken_skin_mucosa_around',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Chicken skin mucosa around', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='clips_control_group',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Punctual coagulation')], verbose_name='Clips control group', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='clips_exp_date',
field=models.DateField(verbose_name='Expiration date', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='clips_n_lote',
field=models.IntegerField(verbose_name='Lot number', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='clips_tratment_group',
field=models.IntegerField(choices=[(1, 'Complete closure with complete mucosal apposition'), (2, 'Complete closure without complete mucosal apposition'), (3, 'Total failed closure'), (4, 'Partial failed closure'), (5, 'Closure not tried')], verbose_name='Clips treatment group', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='closure_technique',
field=models.IntegerField(choices=[(1, 'Simple clipping'), (2, 'Clip-Poly loop'), (3, 'Clip Silk loop')], verbose_name='Closure technique', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='coagulation_forceps',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Coagulation forceps', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='colonoscopy_indication',
field=models.IntegerField(choices=[(1, 'Anemia/iron deficiency'), (2, 'CRC suspected'), (3, 'CRC screening program'), (4, 'Postpolypectomy surveillance'), (5, 'Relatives with CRC or polyposis'), (6, 'Polyposis'), (7, 'Other')], verbose_name='Colonoscopy indication', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='correct_dx_adenoma_serrated',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Correct Dx Adenoma Serrated', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='correct_dx_invasion',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Correct Dx Invasion', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='country',
field=models.IntegerField(choices=[(1, 'Spain'), (2, 'Japan'), (3, 'UK'), (4, 'USA'), (5, 'China')], verbose_name='Country', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='cromoendoscopy',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Cromoendoscopy', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='cs_coagulation_mode',
field=models.IntegerField(choices=[(0, 'Soft'), (1, 'Force')], verbose_name='Coagulation mode', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='cs_coagulation_watts',
field=models.IntegerField(verbose_name='Coagulation (watts)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='cs_cut_mode',
field=models.IntegerField(choices=[(1, '1'), (2, '2'), (3, '3'), (4, '4')], verbose_name='Endocut mode', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='cs_cut_watts',
field=models.IntegerField(verbose_name='Cut (watts)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='date',
field=models.DateField(verbose_name='Date', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='day_of_reintroduction_antiagregant',
field=models.IntegerField(verbose_name='Day of reintroduction anticoagulant/antiagregant', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='degree_differentiation',
field=models.IntegerField(choices=[(1, 'Well'), (2, 'Moderate'), (3, 'Poorly')], verbose_name='Degree differentiation', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='delayed_bleeding',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Delayed bleeding', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='demacrated_depressed_area',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Demacrated depressed area', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='depth',
field=models.IntegerField(choices=[(1, 'Mucosa'), (2, 'SM1'), (3, 'SM2'), (4, 'SM3'), (5, 'MP or deeper')], verbose_name='Depth', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='depth_sm_invasion',
field=models.FloatField(verbose_name='Depth (Sm invasion: µ)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='difficulty_of_emr',
field=models.IntegerField(choices=[(1, 'Easy'), (2, 'Medium'), (3, 'Difficult')], verbose_name='Dificutly of EMR', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='doctor',
field=models.ForeignKey(null=True, verbose_name='Doctor', to='studies_app.UserProfile', blank=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='electrosurgical_generator_model',
field=models.CharField(max_length=100, verbose_name='Electrosurgical generator model', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='endocut',
field=models.IntegerField(choices=[(1, 'Only cut current'), (2, 'Only coagulation current'), (3, 'Endocut/Blended')], verbose_name='Endocut/Blended', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='endoscopemodel',
field=models.CharField(max_length=50, verbose_name='Endoscope model', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='fever',
field=models.IntegerField(choices=[(0, 'No'), (1, '37-37.9'), (2, '38 or more')], verbose_name='Fever', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='fold_convergency',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Fold convergency', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='follow_up_months',
field=models.IntegerField(verbose_name='Follow up months', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='free_horizontal_margins',
field=models.IntegerField(choices=[(1, 'Nonassessable'), (2, 'Free'), (3, 'Affected')], verbose_name='Free horizontal margin (>1mm)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='free_vertical_margins',
field=models.IntegerField(choices=[(1, 'Nonassessable'), (2, 'Free'), (3, 'Affected')], verbose_name='Free vertical margins (>1mm)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='global_recurrence',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Global recurrence', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='group',
field=models.IntegerField(choices=[(0, 'Control group'), (1, 'Treatment group')], verbose_name='Group', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='hb',
field=models.FloatField(verbose_name='HB (g/dL)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='heparinbridgetherapy',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Heparin Bridge Therapy', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='high_definition',
field=models.IntegerField(choices=[(1, 'Conventional endoscope'), (2, 'High definition'), (3, 'Optic magnification')], verbose_name='High definition', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='histol_simplified',
field=models.IntegerField(choices=[(1, 'Adenoma'), (2, 'HGD-Imucosal'), (3, 'Invasive adenoma'), (4, 'Serrated'), (5, 'HGD-Imucosal serrated'), (6, 'Invasive serrated'), (7, 'Carcinoid')], verbose_name='Histology simplified', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='histological_variants',
field=models.IntegerField(choices=[(1, 'Adenocarcinoma'), (2, 'Mucinous'), (3, 'Medullary'), (4, 'Signet ring')], verbose_name='Histological variants', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='histology',
field=models.IntegerField(choices=[(1, 'Adenoma'), (2, 'HGD-intraepitelial carcinoma in adenoma'), (3, 'Intramucosal carcinoma in adenoma'), (4, 'Superficial submucosal carcinoma in adenoma'), (5, 'Deep submucosal carcinoma in adenoma'), (6, 'Hyperplastic'), (7, 'Sesil Serrated polyp'), (8, 'Traditional Serrated Adenoma'), (9, 'Polyp Serrated Mixed or serrated polyp with dysplasia'), (10, 'Intraepitelial carcinoma Any serrated'), (11, 'Intramucosal carcinoma Any serrated'), (12, 'Superficial submucosa carc. Any serrated'), (13, 'Deep submucosa carc. Any serrated'), (14, 'Carinoid')], verbose_name='Histology', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='hospital_stay_by_complication',
field=models.IntegerField(verbose_name='Hospital stay by complication', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='hospital_stay_by_technique',
field=models.IntegerField(verbose_name='Hospital stay by technique', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='hypertension',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Hypertension', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='id',
field=models.AutoField(verbose_name='ID', default=0, serialize=False, primary_key=True, auto_created=True),
preserve_default=False,
),
migrations.AddField(
model_name='obsinternationalcase',
name='id_for_doctor',
field=models.IntegerField(verbose_name='Id for doctor', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='id_for_hospital',
field=models.IntegerField(verbose_name='Id for hospital', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='ileocecal_valve_involvement',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Ileocecal valve involvement', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='immediate_bleeding',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes: during exploration with clinical impact'), (2, 'Yes: during exploration without clinical impact')], verbose_name='Immediate bleeding', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='injection',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Saline'), (2, 'Glicerin'), (3, 'Hyaluronic'), (4, 'Hidrox-propil-cellulose: VOLUVEN(r)'), (5, 'Gelafundin'), (6, 'Others')], verbose_name='Injection', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='inr',
field=models.FloatField(verbose_name='INR', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='kudo',
field=models.IntegerField(choices=[(1, 'I'), (2, 'II'), (3, 'IIIS'), (4, 'IIIL'), (5, 'IV'), (6, 'V-I'), (7, 'V-N')], verbose_name='Kudo', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='large_nodule_one_cm',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Large nodule 1cm', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='last_date_endoscopic_follow_up',
field=models.DateField(verbose_name='Last date endoscopic follow up', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='limit_marks',
field=models.IntegerField(choices=[(0, 'No marks'), (1, 'APC marks')], verbose_name='Limit marks', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='location',
field=models.IntegerField(choices=[(1, 'Rectum'), (2, 'Left colon'), (3, 'Splenic flexure'), (4, 'Transverse'), (5, 'Hepatic'), (6, 'Ascendent'), (7, 'Cecum')], verbose_name='Location', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='lst_morphology',
field=models.IntegerField(choices=[(1, 'Granular homogeneous'), (2, 'Focal nodular mixed type'), (3, 'Whole nodular mixed type'), (4, 'Flat elevated'), (5, 'Psudodepressed')], verbose_name='LST Morphology', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='lst_yn',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='LST yn', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='lymphatic_invasion',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Lymphatic invasion', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='maximum_size_mm',
field=models.IntegerField(verbose_name='Maximum size (mm)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='nbi',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='NBI', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='nbi_nice',
field=models.IntegerField(choices=[(1, 'Type 1'), (2, 'Type 2'), (3, 'Type 3')], verbose_name='NBI NICE', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='nbi_sano',
field=models.IntegerField(choices=[(1, 'I'), (2, 'II'), (3, 'IIIA'), (4, 'IIIB')], verbose_name='NBI sano', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='nombre_p_activo_antiagreg_anticoag',
field=models.IntegerField(verbose_name='Active ingredients anticoagulant/antiagregant', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='non_lifting_sign',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Non lifting sign', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='not_tired_closure_by',
field=models.IntegerField(choices=[(1, 'Big size'), (2, 'Difficult location'), (3, 'Both')], verbose_name='Closure not tried because of', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='number_clips_needed',
field=models.IntegerField(verbose_name='Number of clips needed', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='other_comments',
field=models.TextField(max_length=500, verbose_name='Other comments', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='other_complications_comments',
field=models.TextField(max_length=500, verbose_name='Other complications comments', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='pain_requiring_medical_intervention',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Pain requiring medical intervantion', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='paris_calif',
field=models.IntegerField(choices=[(1, '0Is'), (2, '0IIa'), (3, '0IIa+0Is'), (4, '0Is+0IIa'), (5, '0IIb'), (6, '0IIc'), (7, '0IIa+0IIc'), (8, '0IIb+0IIc'), (9, '0IIb+0IIa')], verbose_name='Paris Clasif.', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='perforation',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes: endoscopic resolution'), (2, 'Yes: surgical resolution')], verbose_name='Perforation', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='perineural_invasion',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Perineural invasion', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='platelets',
field=models.IntegerField(verbose_name='Platelets (x10⁹/L)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='polyp_retrieval',
field=models.IntegerField(choices=[(1, 'Roth net'), (2, 'By aspiration'), (3, 'Both methods'), (4, 'By snare')], verbose_name='Polyp retrieval', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='pps',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Post polypectomy syndrome', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='prepathologic_endoscopic_diagnostic_a',
field=models.IntegerField(choices=[(1, 'Adenoma'), (2, 'Serrated')], verbose_name='Prepathologic endoscopic diagnost 1', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='prepathologic_endoscopic_diagnostic_b',
field=models.IntegerField(choices=[(1, 'NodisplasiaToSuperficial submucosal carcinoma'), (2, 'Deep submucosal carcinoma')], verbose_name='Prepathologic endoscopic diagnost 2', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='previous_attempt',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Previous attempt', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='previous_biopsy',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Previous biopsy', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='pt',
field=models.IntegerField(verbose_name='PT (s)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='recurrence_three_six_months_control',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes: positive biopsy: endoscopic treatment'), (2, 'Yes: visible recurrence: endoscopic treatment'), (3, 'Yes: surgical treatment needed')], verbose_name='Recurrence 3-6 months control', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='recurrenec_one_year_control',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes: positive biopsy: endoscopic treatment'), (2, 'Yes: visible recurrence: endoscopic treatment'), (3, 'Yes: surgical treatment needed')], verbose_name='Recurrence 1 year control', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='resection',
field=models.IntegerField(choices=[(1, 'Piecemeal complete'), (2, 'Piecemeal incomplete'), (3, 'En bloc R0'), (4, 'En bloq incomplete')], verbose_name='Resection', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='sclerous_wall_change',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Sclerous wall change', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='sedation',
field=models.IntegerField(choices=[(0, 'Without sedation'), (1, 'By gastroenterologist other than Propofol'), (2, 'By gastroenterologist based on Propofol'), (3, 'By anesthesiologist')], verbose_name='Sedation', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='sex',
field=models.IntegerField(choices=[(1, 'Male'), (2, 'Female')], max_length=1, blank=True, null=True, verbose_name='Sex'),
),
migrations.AddField(
model_name='obsinternationalcase',
name='snare_tip_soft_coagulation',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Snare tip soft coagulation', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='study',
field=models.ForeignKey(default=0, verbose_name='Study', to='studies_app.Study', related_name='cases_obsinternationalcase'),
preserve_default=False,
),
migrations.AddField(
model_name='obsinternationalcase',
name='successful_treatment',
field=models.IntegerField(choices=[(0, 'No: surgical treatment'), (1, 'Yes: in 1 session (includes one or two steps'), (2, 'Yes, in 2 or more sessions (one session and treatment in controls')], verbose_name=' Successful treatment', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='surgery_by_complication',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes: bleeding'), (2, 'Yes: perforation')], verbose_name='Surgery by complication', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='surgery_from_endoscopy',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Surgery from endoscopy', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='technique',
field=models.IntegerField(choices=[(1, 'EMR'), (2, 'Hybrid-EMR')], verbose_name='Technique', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='technique_two',
field=models.IntegerField(choices=[(1, 'One-step'), (2, 'Two-steps')], verbose_name=' Technique 2', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='time_of_procedure_in_mins',
field=models.IntegerField(verbose_name='Time of procedure (m)', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='transfusion',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Transfusion', blank=True, null=True),
),
migrations.AddField(
model_name='obsinternationalcase',
name='vascular_invasion',
field=models.IntegerField(choices=[(0, 'No'), (1, 'Yes')], verbose_name='Vascular invasion', blank=True, null=True),
),
]
| gpl-2.0 |
haleeben/Sticky-Post-Expiration | sticky-post-expiration.php | 659 | <?php
/* Plugin Name: Sticky Post Expiration
* Plugin URI: http://ebenhale.com/sticky-post-expiration
* Version: 1.0.0
* Description: This WordPress plugin allows the user to set a sticky post expiration date
* Author: Eben Hale
* Author URI: http://ebenhale.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
/*
* Exit if called directly.
*/
if ( ! defined( 'WPINC' ) ) die;
require_once 'includes/class-sticky-post-expiration.php';
Sticky_Post_Expiration::instance(
'1.0.0' ,
plugin_dir_path(__FILE__) ,
plugin_dir_url(__FILE__),
plugin_basename(__DIR__).'.php'
);
| gpl-2.0 |
mytake/mytake | server/src/main/java/forms/meta/MetaFormValidation.java | 3761 | /*
* MyTake.org
*
* Copyright 2017 by its authors.
* Some rights reserved. See LICENSE, https://github.com/mytakedotorg/mytakedotorg/graphs/contributors
*/
package forms.meta;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import forms.api.FormValidation;
import java.util.Map;
import org.jooby.Mutant;
import org.jooby.Request;
public class MetaFormValidation extends FormValidation<MetaMap> {
@SafeVarargs
public static MetaFormValidation validateOneOf(Mutant params, Class<? extends MetaFormDef>... formClazzes) {
return validateOneOf(mutantToMap(params), formClazzes);
}
@SafeVarargs
public static MetaFormValidation validateOneOf(Map<String, String> params, Class<? extends MetaFormDef>... formClazzes) {
for (Class<? extends MetaFormDef> formClazz : formClazzes) {
MetaFormDef formDef = MetaFormDef.create(formClazz);
if (params.keySet().containsAll(formDef.fieldNames())) {
return formDef.parseAndValidate(params);
}
}
throw new IllegalArgumentException("None of the correct fields are present.");
}
/** Creates an empty form validation. */
public static MetaFormValidation empty(Class<? extends MetaFormDef> formClazz) {
return new MetaFormValidation(MetaFormDef.create(formClazz));
}
/** Performs validation on a MetaFormDef. */
public static MetaFormValidation validate(Class<? extends MetaFormDef> formClazz, Mutant params) {
return validate(formClazz, mutantToMap(params));
}
public static MetaFormValidation validate(Class<? extends MetaFormDef> formClazz, Map<String, String> params) {
return MetaFormDef.create(formClazz).parseAndValidate(params);
}
static Map<String, String> mutantToMap(Mutant mutant) {
return Maps.transformValues(mutant.toMap(), Mutant::value);
}
protected MetaFormValidation(MetaFormDef def) {
super(def);
}
Map<String, String> errorForField() {
return errorForField;
}
@Override
public MetaFormDef def() {
return (MetaFormDef) def;
}
public <R> MetaFormValidation init(MetaField<R> field, R value) {
String str = field.parser().reverse().convert(value);
init(field.name(), str);
return this;
}
public <R> R init(MetaField<R> field) {
String value = init(field.name());
return field.parser().convert(value);
}
@SuppressWarnings("unchecked")
public final MetaFormValidation initFromGettersOf(Object value) {
MetaMap metaMap = MetaMap.buildFrom(value, def());
for (MetaField<?> field : metaMap.keySet()) {
init((MetaField<Object>) field, metaMap.get(field));
}
return this;
}
@SuppressWarnings("unchecked")
@SafeVarargs
public final MetaFormValidation keep(MetaField<?>... fields) {
for (MetaField<?> field : fields) {
Preconditions.checkState(parsedValue().keySet().contains(field), "Expected %s to contain %s", parsedValue().keySet(), field);
init((MetaField<Object>) field, (Object) parsedValue().get(field));
}
return this;
}
public final MetaFormValidation keepAll() {
for (MetaField<?> field : def().fields()) {
keep(field);
}
return this;
}
public MetaFormValidation errorForField(MetaField<?> field, String error) {
errorForField(field.name(), error);
return this;
}
public <T> T parsed(MetaField<T> field) {
return parsedValue().get(field);
}
public MetaFormValidation initAllIfPresent(Request req) {
for (MetaField<?> field : def().fields()) {
initIfPresent(req, field);
}
return this;
}
@SuppressWarnings("unchecked")
public MetaFormValidation initIfPresent(Request req, MetaField<?>... fields) {
for (MetaField<?> field : fields) {
Mutant value = req.param(field.name());
if (value.isSet()) {
init((MetaField<Object>) field, (Object) field.parser().convert(value.value()));
}
}
return this;
}
}
| gpl-2.0 |
agiza/vs-port | piwik/tmp/templates_c/17/b5/271a70d61ca0f8a9b0dc12f01eff70db1623b7fb939091c66d1792550cb3.php | 3727 | <?php
/* @LanguagesManager/getLanguagesSelector.twig */
class __TwigTemplate_17b5271a70d61ca0f8a9b0dc12f01eff70db1623b7fb939091c66d1792550cb3 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
echo "<span class=\"topBarElem\">
\t<span id=\"languageSelection\">
\t\t<form action=\"index.php?module=LanguagesManager&action=saveLanguage\" method=\"post\">
<select name=\"language\" id=\"language\">
<option title=\"\" value=\"\"
href=\"?module=Proxy&action=redirect&url=http://piwik.org/translations/\">";
// line 6
echo twig_escape_filter($this->env, call_user_func_array($this->env->getFilter('translate')->getCallable(), array("LanguagesManager_AboutPiwikTranslations")), "html", null, true);
echo "</option>
";
// line 7
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable($this->getContext($context, "languages"));
foreach ($context['_seq'] as $context["_key"] => $context["language"]) {
// line 8
echo " <option value=\"";
echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "language"), "code"), "html", null, true);
echo "\" ";
if (($this->getAttribute($this->getContext($context, "language"), "code") == $this->getContext($context, "currentLanguageCode"))) {
echo "selected=\"selected\"";
}
// line 9
echo " title=\"";
echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "language"), "name"), "html", null, true);
echo " (";
echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "language"), "english_name"), "html", null, true);
echo ")\">";
echo twig_escape_filter($this->env, $this->getAttribute($this->getContext($context, "language"), "name"), "html", null, true);
echo "</option>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['language'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 11
echo " </select>
";
// line 13
echo " ";
if (array_key_exists("token_auth", $context)) {
echo "<input type=\"hidden\" name=\"token_auth\" value=\"";
echo twig_escape_filter($this->env, $this->getContext($context, "token_auth"), "html", null, true);
echo "\"/>";
}
// line 14
echo " <input type=\"submit\" value=\"go\"/>
</form>
\t</span>
\t
\t<script type=\"text/javascript\">
piwik.languageName = \"";
// line 19
echo twig_escape_filter($this->env, $this->getContext($context, "currentLanguageName"), "html", null, true);
echo "\";
</script>
</span>
";
}
public function getTemplateName()
{
return "@LanguagesManager/getLanguagesSelector.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 71 => 19, 64 => 14, 57 => 13, 54 => 11, 41 => 9, 34 => 8, 30 => 7, 26 => 6, 19 => 1,);
}
}
| gpl-2.0 |
williamgrosset/OSCAR-ConCert | src/main/java/oscar/ocan/service/OcanDataProcessor.java | 117908 | /**
*
* Copyright (c) 2005-2012. Centre for Research on Inner City Health, St. Michael's Hospital, Toronto. All Rights Reserved.
* This software is published under the GPL GNU General Public License.
* 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* This software was written for
* Centre for Research on Inner City Health, St. Michael's Hospital,
* Toronto, Ontario, Canada
*/
package oscar.ocan.service;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.Serializable;
import java.math.BigInteger;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
import org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl;
import oscar.ocan.domain.client.AnswerGroup;
import oscar.ocan.domain.client.OCANClientSelfAssessment;
import oscar.ocan.domain.staff.CCommunityTreatmentOrder;
import oscar.ocan.domain.staff.CIfYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply;
import oscar.ocan.domain.staff.CMedicalConditionsCheckAllThatApply;
import oscar.ocan.domain.staff.COtherContact;
import oscar.ocan.domain.staff.CPsychiatricHistory;
import oscar.ocan.domain.staff.CWhichOfTheFollowingDrugsHaveYouUsedCheckAllThatApply;
import oscar.ocan.domain.staff.OCANStaffAssessment;
import oscar.ocan.domain.submission.Action;
import oscar.ocan.domain.submission.ActionList;
import oscar.ocan.domain.submission.AddictionTypeList;
import oscar.ocan.domain.submission.AdditionalElements;
import oscar.ocan.domain.submission.ClientAddress;
import oscar.ocan.domain.submission.ClientCapacity;
import oscar.ocan.domain.submission.ClientContact;
import oscar.ocan.domain.submission.ClientID;
import oscar.ocan.domain.submission.ClientName;
import oscar.ocan.domain.submission.ClientOHIP;
import oscar.ocan.domain.submission.ClientRecord;
import oscar.ocan.domain.submission.ConcernAreaList;
import oscar.ocan.domain.submission.DiagnosticList;
import oscar.ocan.domain.submission.DiscrimExpList;
import oscar.ocan.domain.submission.DoctorContact;
import oscar.ocan.domain.submission.Domain;
import oscar.ocan.domain.submission.DrinkAlcohol;
import oscar.ocan.domain.submission.DrugUse;
import oscar.ocan.domain.submission.DrugUseList;
import oscar.ocan.domain.submission.FormalHelpNeed;
import oscar.ocan.domain.submission.FormalHelpRecvd;
import oscar.ocan.domain.submission.ImmigExpList;
import oscar.ocan.domain.submission.InformalHelpRecvd;
import oscar.ocan.domain.submission.LegalStatusList;
import oscar.ocan.domain.submission.MISFunction;
import oscar.ocan.domain.submission.MedicalConditionList;
import oscar.ocan.domain.submission.MedicationDetail;
import oscar.ocan.domain.submission.MedicationList;
import oscar.ocan.domain.submission.NeedRating;
import oscar.ocan.domain.submission.OCANDomains;
import oscar.ocan.domain.submission.OCANSubmissionFile;
import oscar.ocan.domain.submission.OCANSubmissionRecord;
import oscar.ocan.domain.submission.ObjectFactory;
import oscar.ocan.domain.submission.OrganizationRecord;
import oscar.ocan.domain.submission.OtherAgencyContact;
import oscar.ocan.domain.submission.OtherIllnessList;
import oscar.ocan.domain.submission.OtherPractitionerContact;
import oscar.ocan.domain.submission.PresentingIssue;
import oscar.ocan.domain.submission.PresentingIssueList;
import oscar.ocan.domain.submission.Program;
import oscar.ocan.domain.submission.PsychiatristContact;
import oscar.ocan.domain.submission.ReasonForAssessment;
import oscar.ocan.domain.submission.Referral;
import oscar.ocan.domain.submission.ReferralList;
import oscar.ocan.domain.submission.RiskUnemploymentList;
import oscar.ocan.domain.submission.SafetyToSelfRiskList;
import oscar.ocan.domain.submission.ServiceOrg;
import oscar.ocan.domain.submission.SideEffectsDetailList;
import oscar.ocan.domain.submission.SymptomList;
import oscar.ocan.domain.submission.TimeLivedInCanada;
public class OcanDataProcessor {
private DateFormat FORMATTER = new SimpleDateFormat("yyyy-MM-dd");
private String serviceOrganizationNumber;
private String submissionFileLocation;
private ObjectFactory of = new ObjectFactory();;
public class OcanProcess {
public Date now;
public GregorianCalendar yearAgo;
public GregorianCalendar sixMonthsAgo;
public GregorianCalendar oneMonthAgo;
public String assessmentId;
public OCANSubmissionFile file;
public OcanProcess() {
now = new Date();
yearAgo = new GregorianCalendar(); yearAgo.roll(Calendar.YEAR, -1);
sixMonthsAgo = new GregorianCalendar(); sixMonthsAgo.roll(Calendar.MONTH, -6);
oneMonthAgo = new GregorianCalendar(); oneMonthAgo.roll(Calendar.MONTH, -1);
assessmentId = new SimpleDateFormat("yyyyMM").format(now);
}
}
public OcanProcess createOcanProcess() {
OcanProcess process = new OcanProcess();
process.file = of.createOCANSubmissionFile();
process.file.setVersion("1.0.0");
process.file.setID("OCAN" + process.assessmentId + serviceOrganizationNumber + "01.xml");
//process.file.setTimestamp(XMLGregorianCalendarImpl.parse(FORMATTER.format(process.now) + "T00:00:00Z"));
process.file.setTimestamp(new DatatypeFactoryImpl().newXMLGregorianCalendar(FORMATTER.format(process.now) + "T00:00:00Z"));
return process;
}
public void finishOcanProcess(OcanProcess process) throws FileNotFoundException, JAXBException {
JAXBElement<OCANSubmissionFile> jbx = wrap(null, "OCANSubmissionFile", process.file);
marshal(jbx, submissionFileLocation + "/" + process.file.getID());
}
public OCANSubmissionRecord createOcanRecord(OcanProcess process, InputStream clientIs,
InputStream staffIs, String orgClientId) throws ParseException, NumberFormatException, JAXBException {
OCANClientSelfAssessment client = unmarshal(OCANClientSelfAssessment.class, clientIs);
OCANStaffAssessment staff = unmarshal(OCANStaffAssessment.class, staffIs);
return createSubmissionRecord(process, client, staff, orgClientId);
}
private OCANSubmissionRecord createSubmissionRecord(OcanProcess process, OCANClientSelfAssessment client,
OCANStaffAssessment staff, String orgClientId) throws ParseException, NumberFormatException {
// Submission Record
OCANSubmissionRecord r1 = of.createOCANSubmissionRecord();
r1.setAssessmentID(process.assessmentId);
r1.setAssessmentStatus("Complete");
//r1.setStartDate(XMLGregorianCalendarImpl.parse(client.getCInstructions().getCStartDate()+"Z"));
//r1.setCompletionDate(XMLGregorianCalendarImpl.parse(client.getCInstructions().getCStartDate()+"Z"));
r1.setStartDate(new DatatypeFactoryImpl().newXMLGregorianCalendar(FORMATTER.format(client.getCInstructions().getCStartDate()) + "Z"));
r1.setCompletionDate(new DatatypeFactoryImpl().newXMLGregorianCalendar(FORMATTER.format(client.getCInstructions().getCStartDate()) + "Z"));
// Organization Record
OrganizationRecord or1 = of.createOrganizationRecord();
r1.setOrganizationRecord(or1);
ServiceOrg so1 = of.createServiceOrg();
so1.setName(staff.getCHeader().getCServiceOrganizationName());
so1.setNumber(staff.getCHeader().getCServiceOrganizationNumber());
or1.setServiceOrg(so1);
Program p1 = of.createProgram();
p1.setName(staff.getCHeader().getCProgramName());
p1.setNumber(staff.getCHeader().getCProgramNumber());
or1.setProgram(p1);
MISFunction mf1 = of.createMISFunction();
mf1.setValue(staff.getCHeader().getCFunctionMISFunctionalCentre());
or1.setMISFunction(mf1);
// Client Record
ClientRecord cr = of.createClientRecord();
r1.setClientRecord(cr);
ClientID cid = of.createClientID();
cid.setOrgClientID(orgClientId);
cr.setClientID(cid);
ClientName cn = of.createClientName();
cn.setFirst("");
cn.setLast("");
cr.setClientName(cn);
ClientAddress ca = of.createClientAddress();
ca.setCity("");
ca.setLine1("");
ca.setLine2("");
ca.setPostalCode("");
ca.setProvince("");
cr.setClientAddress(ca);
ClientOHIP co = of.createClientOHIP();
co.setNumber("");
co.setVersion("");
cr.setClientPhone("");
cr.setClientOHIP(co);
cr.setClientCulture("");
ReasonForAssessment ra = of.createReasonForAssessment();
if ("T".equals(staff.getCReasonForAssessmentSelectOne().getCInitialAssessment())) {
ra.setValue("IA");
} else if ("T".equals(staff.getCReasonForAssessmentSelectOne().getCReassessmentAt6Months())) {
ra.setValue("RA");
} else if ("T".equals(staff.getCReasonForAssessmentSelectOne().getCPriorToDischarge())) {
ra.setValue("DIS");
} else {
ra.setValue("OTHR");
ra.setOther(staff.getCReasonForAssessmentSelectOne().getCSpecifyOther());
}
cr.setReasonForAssessment(ra);
ClientContact cc = of.createClientContact();
cr.setClientContact(cc);
DoctorContact dc = of.createDoctorContact();
if ("T".equals(staff.getCDoctor().getCYes())) {
dc.setDoctor("TRUE");
} else if ("T".equals(staff.getCDoctor().getCNo())) {
dc.setDoctor("FALSE");
} else {
dc.setDoctor("NA");
}
Date _dcls = FORMATTER.parse(staff.getCDoctor().getCLastSeen());
if (_dcls.before(process.yearAgo.getTime())) {
dc.setLastSeen("LS-13");
} else if (_dcls.before(process.sixMonthsAgo.getTime())) {
dc.setLastSeen("LS-12");
} else if (_dcls.before(process.oneMonthAgo.getTime())) {
dc.setLastSeen("LS-6");
} else {
dc.setLastSeen("LS-1");
}
cc.setDoctorContact(dc);
PsychiatristContact pc = of.createPsychiatristContact();
if ("T".equals(staff.getCPsychiatrist().getCYes())) {
pc.setPsychiatrist("TRUE");
} else if ("T".equals(staff.getCPsychiatrist().getCNo())) {
pc.setPsychiatrist("FALSE");
} else {
pc.setPsychiatrist("NA");
}
Date _pcls = FORMATTER.parse(staff.getCPsychiatrist().getCLastSeen());
if (_pcls.before(process.yearAgo.getTime())) {
pc.setLastSeen("LS-13");
} else if (_dcls.before(process.sixMonthsAgo.getTime())) {
pc.setLastSeen("LS-12");
} else if (_dcls.before(process.oneMonthAgo.getTime())) {
pc.setLastSeen("LS-6");
} else {
pc.setLastSeen("LS-1");
}
cc.setPsychiatristContact(pc);
Collection<COtherContact> otherContacts = staff.getCOtherContact();
for (COtherContact oc : otherContacts) {
OtherPractitionerContact oc1 = of.createOtherPractitionerContact();
// dic item!
oc1.setPractitionerType(oc.getCContactInformation());
Date ocls = FORMATTER.parse(oc.getCLastSeen());
if (ocls.before(process.yearAgo.getTime())) {
oc1.setLastSeen("LS-13");
} else if (ocls.before(process.sixMonthsAgo.getTime())) {
oc1.setLastSeen("LS-12");
} else if (ocls.before(process.oneMonthAgo.getTime())) {
oc1.setLastSeen("LS-6");
} else {
oc1.setLastSeen("LS-1");
}
cc.getOtherPractitionerContact().add(oc1);
}
OtherAgencyContact oac = of.createOtherAgencyContact();
Date oals = FORMATTER.parse(staff.getCOtherAgency().getCLastSeen());
if (oals.before(process.yearAgo.getTime())) {
oac.setLastSeen("LS-13");
} else if (oals.before(process.sixMonthsAgo.getTime())) {
oac.setLastSeen("LS-12");
} else if (oals.before(process.oneMonthAgo.getTime())) {
oac.setLastSeen("LS-6");
} else {
oac.setLastSeen("LS-1");
}
cc.setOtherAgencyContact(oac);
// dic item!
cr.setServiceRecipientLocation(staff.getCServiceInformation().getCServiceRecipientLocationCountyDistrictMunicipality());
// dic item!
cr.setServiceRecipientLHIN(Integer.parseInt(staff.getCServiceInformation().getCServiceRecipientLHIN()));
// dic item!
cr.setServiceDeliveryLHIN(Integer.parseInt(staff.getCServiceInformation().getCServiceDeliveryLHIN()));
//cr.setClientDOB(XMLGregorianCalendarImpl.parse(staff.getCServiceInformation().getCDateOfBirthAge() + "Z"));
cr.setClientDOB(new DatatypeFactoryImpl().newXMLGregorianCalendar(FORMATTER.format(staff.getCServiceInformation().getCDateOfBirthAge()) + "Z"));
if ("T".equals(staff.getCGenderSelectOne().getCMale())) {
cr.setGender("M");
} else if ("T".equals(staff.getCGenderSelectOne().getCFemale())) {
cr.setGender("F");
} else if ("T".equals(staff.getCGenderSelectOne().getCOther())) {
cr.setGender("OTH");
} else if ("T".equals(staff.getCGenderSelectOne().getCUnknown())) {
cr.setGender("UNK");
} else {
cr.setGender("CDA");
}
if ("T".equals(staff.getCMaritalStatusSelectOne().getCSingle())) {
cr.setMaritalStatus("125681006");
} else if ("T".equals(staff.getCMaritalStatusSelectOne().getCMarriedOrInCommonLawRelationship())) {
cr.setMaritalStatus("87915002");
} else if ("T".equals(staff.getCMaritalStatusSelectOne().getCPartnerOfSignificantOther())) {
cr.setMaritalStatus("42120006");
} else if ("T".equals(staff.getCMaritalStatusSelectOne().getCWiddowed())) {
cr.setMaritalStatus("33553000");
} else if ("T".equals(staff.getCMaritalStatusSelectOne().getCSeparated())) {
cr.setMaritalStatus("13184001");
} else if ("T".equals(staff.getCMaritalStatusSelectOne().getCDivorced())) {
cr.setMaritalStatus("20295000");
} else if ("T".equals(staff.getCMaritalStatusSelectOne().getCUnknown())) {
cr.setMaritalStatus("261665006");
} else {
cr.setMaritalStatus("CDA");
}
ClientCapacity ccap = of.createClientCapacity();
if ("T".equals(staff.getCClientCapacityStatusCheckAllThatApply().getCDoesTheClientHaveAPowerOfAttorneyForProperty().getCYes())) {
ccap.setProperty("TRUE");
} else if ("T".equals(staff.getCClientCapacityStatusCheckAllThatApply().getCDoesTheClientHaveAPowerOfAttorneyForProperty().getCNo())) {
ccap.setProperty("FALSE");
} else if ("T".equals(staff.getCClientCapacityStatusCheckAllThatApply().getCDoesTheClientHaveAPowerOfAttorneyForProperty().getCUnknown())) {
ccap.setProperty("UNK");
} else {
ccap.setProperty("CDA");
}
if ("T".equals(staff.getCClientCapacityStatusCheckAllThatApply().getCDoesTheClientHaveAPowerOfAttorneyOrASubstituteDecisionMakerForPersonCare().getCYes())) {
ccap.setPersonalCare("TRUE");
} else if ("T".equals(staff.getCClientCapacityStatusCheckAllThatApply().getCDoesTheClientHaveAPowerOfAttorneyOrASubstituteDecisionMakerForPersonCare().getCNo())) {
ccap.setPersonalCare("FALSE");
} else if ("T".equals(staff.getCClientCapacityStatusCheckAllThatApply().getCDoesTheClientHaveAPowerOfAttorneyOrASubstituteDecisionMakerForPersonCare().getCUnknown())) {
ccap.setPersonalCare("UNK");
} else {
ccap.setPersonalCare("CDA");
}
if ("T".equals(staff.getCClientCapacityStatusCheckAllThatApply().getCDoesTheClientHaveACourtAppointedGuardian().getCYes())) {
ccap.setLegalGuardian("TRUE");
} else if ("T".equals(staff.getCClientCapacityStatusCheckAllThatApply().getCDoesTheClientHaveACourtAppointedGuardian().getCNo())) {
ccap.setLegalGuardian("FALSE");
} else if ("T".equals(staff.getCClientCapacityStatusCheckAllThatApply().getCDoesTheClientHaveACourtAppointedGuardian().getCUnknown())) {
ccap.setLegalGuardian("UNK");
} else {
ccap.setLegalGuardian("CDA");
}
cr.setClientCapacity(ccap);
if ("T".equals(staff.getCWhoReferredYouToThisServiceSelectOne().getCGeneralHospital())) {
cr.setReferralSource("018-01");
} else if ("T".equals(staff.getCWhoReferredYouToThisServiceSelectOne().getCPsychiatricHospital())) {
cr.setReferralSource("018-02");
} else if ("T".equals(staff.getCWhoReferredYouToThisServiceSelectOne().getCOtherInstitution())) {
cr.setReferralSource("018-03");
} else if ("T".equals(staff.getCWhoReferredYouToThisServiceSelectOne().getCCommunityMentalHealthAndAddictionOrganization())) {
cr.setReferralSource("018-04");
} else if ("T".equals(staff.getCWhoReferredYouToThisServiceSelectOne().getCOtherCommunityAgencies())) {
cr.setReferralSource("018-05");
} else if ("T".equals(staff.getCWhoReferredYouToThisServiceSelectOne().getCFamilyPhysicians())) {
cr.setReferralSource("018-06");
} else if ("T".equals(staff.getCWhoReferredYouToThisServiceSelectOne().getCPsychiatrists())) {
cr.setReferralSource("018-07");
} else if ("T".equals(staff.getCWhoReferredYouToThisServiceSelectOne().getCMentalHealthWorker())) {
cr.setReferralSource("018-08");
} else if ("T".equals(staff.getCWhoReferredYouToThisServiceSelectOne().getCCriminalJusticeWorker())) {
cr.setReferralSource("018-09");
} else if ("T".equals(staff.getCWhoReferredYouToThisServiceSelectOne().getCSelfFamilyOrFriend())) {
cr.setReferralSource("018-10");
} else {
cr.setReferralSource("018-11");
}
if ("T".equals(staff.getCAboriginalOriginSelectOne().getCAboriginal())) {
cr.setAboriginalOrigin("011-01");
} else if ("T".equals(staff.getCAboriginalOriginSelectOne().getCNonAboriginal())) {
cr.setAboriginalOrigin("011-02");
} else if ("T".equals(staff.getCAboriginalOriginSelectOne().getCUnknown())) {
cr.setAboriginalOrigin("011-03");
} else {
cr.setAboriginalOrigin("011-04");
}
if ("T".equals(staff.getCCitizenshipStatusSelectOne().getCCanadianCitizen())) {
cr.setCitizenshipStatus("CDN");
} else if ("T".equals(staff.getCCitizenshipStatusSelectOne().getCPermanentResident())) {
cr.setCitizenshipStatus("PR");
} else if ("T".equals(staff.getCCitizenshipStatusSelectOne().getCTemporaryResident())) {
cr.setCitizenshipStatus("TR");
} else if ("T".equals(staff.getCCitizenshipStatusSelectOne().getCRefugee())) {
cr.setCitizenshipStatus("REF");
} else if ("T".equals(staff.getCCitizenshipStatusSelectOne().getCUnknown())) {
cr.setCitizenshipStatus("UNK");
} else {
cr.setCitizenshipStatus("CDA");
}
TimeLivedInCanada tlc = of.createTimeLivedInCanada();
String lic = staff.getCLengthOfTimeLivedInCanada().getCNumberOfYearsMonths();
tlc.setYears(BigInteger.valueOf(Long.parseLong(lic.substring(0, lic.indexOf('/')))));
tlc.setMonths(BigInteger.valueOf(Long.parseLong(lic.substring(lic.indexOf('/')+1))));
cr.setTimeLivedInCanada(tlc);
ImmigExpList iel = of.createImmigExpList();
cr.setImmigExpList(iel);
if ("T".equals(staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCLackOfUnderstandingOfTheCanadianSystemResources())) {
iel.getValue().add("1");
} else if ("T".equals(staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCApplyingPreviousWorkExperienceProfessionalQualifications())) {
iel.getValue().add("2");
} else if ("T".equals(staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCSeparationFromFamilyMembersSignificantOthers())) {
iel.getValue().add("3");
} else if ("T".equals(staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCFamilyLeftBehindInRefugeeCamp())) {
iel.getValue().add("4");
} else if ("T".equals(staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCExperienceWithWarIncarcerationTorture())) {
iel.getValue().add("5");
} else if ("T".equals(staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCRefugeeCamp())) {
iel.getValue().add("6");
} else if ("T".equals(staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCExperienceWithOtherTrauma())) {
iel.getValue().add("7");
} else if (null != staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCOther() &&
staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCOther().length() > 0) {
iel.getValue().add("8");
iel.setOtherImmigExp(staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCOther());
} else if ("T".equals(staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCUnknown())) {
iel.getValue().add("9");
} else if ("T".equals(staff.getCDoYouHaveAnyIssuesWithYourImmigrationExperienceCheckAllThatApply().getCClientDeclinedToAnswer())) {
iel.getValue().add("10");
}
DiscrimExpList del = of.createDiscrimExpList();
cr.setDiscrimExpList(del);
if ("T".equals(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCDisability())) {
del.getValue().add("21134002");
} else if ("T".equals(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCEthnicity())) {
del.getValue().add("397731000");
} else if ("T".equals(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCGender())) {
del.getValue().add("365873007");
} else if ("T".equals(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCImmigration())) {
del.getValue().add("IMGR");
} else if ("T".equals(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCMentalIllness())) {
del.getValue().add("74732009");
} else if ("T".equals(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCRace())) {
del.getValue().add("415229000");
} else if ("T".equals(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCReligion())) {
del.getValue().add("365577002");
} else if ("T".equals(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCSexualOrientation())) {
del.getValue().add("365956009");
} else if (null != staff.getCExperienceOfDiscriminationCheckAllThatApply().getCOther() &&
staff.getCExperienceOfDiscriminationCheckAllThatApply().getCOther().length() > 0) {
del.getValue().add("410515003");
del.setOtherDiscrimExp(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCOther());
} else if ("T".equals(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCUnknown())) {
del.getValue().add("261665006");
} else if ("T".equals(staff.getCExperienceOfDiscriminationCheckAllThatApply().getCClientDeclinedToAnswer())) {
del.getValue().add("CDA");
}
// dic item!
cr.setPrefLang(staff.getCServiceRecipientPreferredLanguage().getC());
// dic item!
cr.setServiceLang(staff.getCLanguageOfServiceProvision().getC());
if ("T".equals(staff.getCDoYouHaveAnyLegalIssuesSelectOne().getCCivil())) {
cr.setLegalIssues("Civil");
} else if ("T".equals(staff.getCDoYouHaveAnyLegalIssuesSelectOne().getCCriminal())) {
cr.setLegalIssues("Criminal");
} else if ("T".equals(staff.getCDoYouHaveAnyLegalIssuesSelectOne().getCNone())) {
cr.setLegalIssues("None");
} else if ("T".equals(staff.getCDoYouHaveAnyLegalIssuesSelectOne().getCUnknown())) {
cr.setLegalIssues("UNK");
} else if ("T".equals(staff.getCDoYouHaveAnyLegalIssuesSelectOne().getCClientDeclinedToAnswer())) {
cr.setLegalIssues("CDA");
}
LegalStatusList lsl = of.createLegalStatusList();
cr.setLegalStatusList(lsl);
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCPreCharge().getCPreChargeDiversion())) {
lsl.getLegalStatus().add("013-01");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCPreCharge().getCCourtDiversionProgram())) {
lsl.getLegalStatus().add("013-02");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCPreTrial().getCAwaitingFitnessAssessment())) {
lsl.getLegalStatus().add("013-03");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCPreTrial().getCAwaitingTrialWithOrWithoutBail())) {
lsl.getLegalStatus().add("013-04");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCPreTrial().getCAwaitingCriminalResponsibilityAssessmentNCR())) {
lsl.getLegalStatus().add("013-05");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCPreTrial().getCInCommunityOnOwnRecognizance())) {
lsl.getLegalStatus().add("013-06");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCPreTrial().getCUnfitToStandTrial())) {
lsl.getLegalStatus().add("013-07");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCOutcomes().getCChargesWithdrawn())) {
lsl.getLegalStatus().add("013-08");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCOutcomes().getCStayOfProceedings())) {
lsl.getLegalStatus().add("013-09");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCOutcomes().getCAwaitingSentence())) {
lsl.getLegalStatus().add("013-10");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCOutcomes().getCNCR())) {
lsl.getLegalStatus().add("013-11");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCOutcomes().getCConditionalDischarge())) {
lsl.getLegalStatus().add("013-12");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCOutcomes().getCConditionalSentence())) {
lsl.getLegalStatus().add("013-13");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCOutcomes().getCRestrainingOrder())) {
lsl.getLegalStatus().add("013-14");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCOutcomes().getCPeaceBond())) {
lsl.getLegalStatus().add("013-15");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCOutcomes().getCSuspendedSentence())) {
lsl.getLegalStatus().add("013-16");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCCustodyStatus().getCORBDetainedCommunityAccess())) {
lsl.getLegalStatus().add("013-17");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCCustodyStatus().getCORBConditionalDischarge())) {
lsl.getLegalStatus().add("013-18");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCCustodyStatus().getCOnParole())) {
lsl.getLegalStatus().add("013-19");
}
if ("T".equals(staff.getCLegalStatusCheckAllThatApply().getCCustodyStatus().getCOnProbation())) {
lsl.getLegalStatus().add("013-20");
}
List<Serializable> _ols = staff.getCLegalStatusCheckAllThatApply().getCOther().getContent();
for (Object obj : _ols) {
try {
JAXBElement<?> e = (JAXBElement<?>) obj;
if ("T".equals(e.getValue().toString())) {
if ("CNo_legal_problems__includes_absolute_discharge_and_time_served__end_of_custody_".equals(e.getName().toString())) {
lsl.getLegalStatus().add("013-21");
}
if ("CUnknown".equals(e.getName().toString())) {
lsl.getLegalStatus().add("013-24");
}
if ("CClient_declined_to_answer".equals(e.getName().toString())) {
lsl.getLegalStatus().add("013-25");
}
}
} catch (ClassCastException e) {
continue;
}
}
if ("T".equals(staff.getCExitDispositionSelectOneIfApplicable().getCCompletionWithoutReferral())) {
cr.setExitDisposition("019-01");
} else if ("T".equals(staff.getCExitDispositionSelectOneIfApplicable().getCCompletionWithReferral())) {
cr.setExitDisposition("019-02");
} else if ("T".equals(staff.getCExitDispositionSelectOneIfApplicable().getCSuicides())) {
cr.setExitDisposition("019-03");
} else if ("T".equals(staff.getCExitDispositionSelectOneIfApplicable().getCDeath())) {
cr.setExitDisposition("019-04");
} else if ("T".equals(staff.getCExitDispositionSelectOneIfApplicable().getCRelocation())) {
cr.setExitDisposition("019-05");
} else if ("T".equals(staff.getCExitDispositionSelectOneIfApplicable().getCWithdrawal())) {
cr.setExitDisposition("019-06");
}
// end of Client Record
OCANDomains ods = of.createOCANDomains();
r1.setOCANDomains(ods);
// 24 Domains
Domain d1 = createCommonDomain(of, "01-accommodation",
staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getC1DoesThePersonLackACurrentPlaceToStayIfRated0Or9SkipQuestions23AndPro(),
client.getCQuestions().getC1AccommodationWhatKindOfPlaceDoYouLiveIn().getAnswerGroup(),
staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getC2HowMuchHelpWithAccommodationDoesThePersonReceiveFromFriendsOrRelatives(),
staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getC3AHowMuchHelpWithGettingEnoughToEatDoesThePersonReceiveFromLocalServices(),
staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getC3BHowMuchHelpWithGettingEnoughToEatDoesThePersonNeedFromLocalServices());
ods.getDomain().add(d1);
if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCApprovedHomesAndHomesForSpecialCare())) {
d1.setResidenceType("024-01");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCCorrectionalProbationFacility())) {
d1.setResidenceType("024-02");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCDomiciliaryHostel())) {
d1.setResidenceType("024-03");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCGeneralHospital())) {
d1.setResidenceType("024-04");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCPsychiatricHospital())) {
d1.setResidenceType("024-05");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCOtherSpecialtyHospital())) {
d1.setResidenceType("024-06");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCNoFixedAddress())) {
d1.setResidenceType("024-07");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCHostelShelter())) {
d1.setResidenceType("024-08");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCLongTermCareFacilityNursingHome())) {
d1.setResidenceType("024-09");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCMunicipalNonProfitHousing())) {
d1.setResidenceType("024-10");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCPrivateNonProfitHousing())) {
d1.setResidenceType("024-11");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCPrivateHouseAptSROwnedMarketRent())) {
d1.setResidenceType("024-12");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCPrivateHouseAptOtherSubsidized())) {
d1.setResidenceType("024-13");
// } else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCRetirementHome())) {
// d1.setResidenceType("024-14");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCRoomingBoardingHouse())) {
d1.setResidenceType("024-15");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCSupportiveHousingCongregateLiving())) {
d1.setResidenceType("024-16");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCSupportiveHousingAssistedLiving())) {
d1.setResidenceType("024-17");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCOther())) {
d1.setResidenceType("024-18");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCWhereDoYouLiveSelectOne().getCUnknown())) {
d1.setResidenceType("024-19");
} else {
d1.setResidenceType("024-20");
}
if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouReceiveAnySupportSelectOne().getCIndependent())) {
d1.setResidenceSupport("24A-01");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouReceiveAnySupportSelectOne().getCAssistedSupported())) {
d1.setResidenceSupport("24A-02");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouReceiveAnySupportSelectOne().getCSupervisedNonFacility())) {
d1.setResidenceSupport("24A-03");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouReceiveAnySupportSelectOne().getCSupervisedFacility())) {
d1.setResidenceSupport("24A-04");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouReceiveAnySupportSelectOne().getCUnknown())) {
d1.setResidenceSupport("24A-05");
} else {
d1.setResidenceSupport("24A-06");
}
if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouLiveWithAnyoneSelectOne().getCSelf())) {
d1.setLivingArrangementType("023-01");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouLiveWithAnyoneSelectOne().getCSpousePartner())) {
d1.setLivingArrangementType("023-02");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouLiveWithAnyoneSelectOne().getCSpousePartnerAndOthers())) {
d1.setLivingArrangementType("023-03");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouLiveWithAnyoneSelectOne().getCChildren())) {
d1.setLivingArrangementType("023-04");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouLiveWithAnyoneSelectOne().getCParents())) {
d1.setLivingArrangementType("023-05");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouLiveWithAnyoneSelectOne().getCRelatives())) {
d1.setLivingArrangementType("023-06");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouLiveWithAnyoneSelectOne().getCNonRelatives())) {
d1.setLivingArrangementType("023-07");
} else if ("T".equals(staff.getC1AccommodationWhatKindOfPlaceDoYouLiveInWhatSortOfPlaceIsIt().getCDoYouLiveWithAnyoneSelectOne().getCUnknown())) {
d1.setLivingArrangementType("023-08");
} else {
d1.setLivingArrangementType("023-09");
}
Domain d2 = createCommonDomain(of, "02-food",
staff.getC2FoodWhatKindOfFoodFoYouEatAreYouAbleToPrepareYourOwnMealsAndDoYourOwnS().getC1DoesThePersonHaveDifficultyGettingEnoughToEatIfRated0Or9GoToTheNextDoma(),
client.getCQuestions().getC2FoodDoYouGetEnoughToEat().getAnswerGroup(),
staff.getC2FoodWhatKindOfFoodFoYouEatAreYouAbleToPrepareYourOwnMealsAndDoYourOwnS().getC2HowMuchHelpWithGettingEnoughToEatDoesThePersonReceiveFromFriendsOrRelatives(),
staff.getC2FoodWhatKindOfFoodFoYouEatAreYouAbleToPrepareYourOwnMealsAndDoYourOwnS().getC3AHowMuchHelpWithGettingEnoughToEatDoesThePersonReceiveFromLocalServices(),
staff.getC2FoodWhatKindOfFoodFoYouEatAreYouAbleToPrepareYourOwnMealsAndDoYourOwnS().getC3BHowMuchHelpWithGettingEnoughToEatDoesThePersonNeedFromLocalServices());
ods.getDomain().add(d2);
Domain d3 = createCommonDomain(of, "03-looking after the home",
staff.getC3LookingAfterTheHomeAreYouAbleToLookAfterYourHomeDoesAnyoneHelpYou().getC1DoesThePersonHaveDifficultyLookingAfterTheHomeIfRated0Or9GoToTheNextDom(),
client.getCQuestions().getC3LookingAfterTheHomeAreYouAbleToLookAfterYourHome().getAnswerGroup(),
staff.getC3LookingAfterTheHomeAreYouAbleToLookAfterYourHomeDoesAnyoneHelpYou().getC2HowMuchHelpWithLookingAfterTheHomeDoesThePersonReceiveFromFriendsOrRelatives(),
staff.getC3LookingAfterTheHomeAreYouAbleToLookAfterYourHomeDoesAnyoneHelpYou().getC3AHowMuchHelpWithLookingAfterTheHomeDoesThePersonReceiveFromLocalServices(),
staff.getC3LookingAfterTheHomeAreYouAbleToLookAfterYourHomeDoesAnyoneHelpYou().getC3BHowMuchHelpWithLookingAfterTheHomeDoesThePersonNeedFromLocalServices());
ods.getDomain().add(d3);
Domain d4 = createCommonDomain(of, "04-self-care",
staff.getC4SelfCareDoYouHaveProblemsKeepingCleanAndTidyDoYouEverNeedRemindingWhoBy().getC1DoesThePersonHaveDifficultyWitSelfCareIfRated0Or9GoToTheNextDomain(),
client.getCQuestions().getC4SelfCareDoYouHaveProblemsKeepingCleanAndTidy().getAnswerGroup(),
staff.getC4SelfCareDoYouHaveProblemsKeepingCleanAndTidyDoYouEverNeedRemindingWhoBy().getC2HowMuchHelpWithSelfCareDoesThePersonReceiveFromFriendsOrRelatives(),
staff.getC4SelfCareDoYouHaveProblemsKeepingCleanAndTidyDoYouEverNeedRemindingWhoBy().getC3AHowMuchHelpWithSelfCareDoesThePersonReceiveFromLocalServices(),
staff.getC4SelfCareDoYouHaveProblemsKeepingCleanAndTidyDoYouEverNeedRemindingWhoBy().getC3BHowMuchHelpWithSelfCareFoesThePersonNeedFromLocalServices());
ods.getDomain().add(d4);
Domain d5 = createCommonDomain(of, "05-daytime activities",
staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getC1DoesThePersonHaveDifficultyWithRegularAppropriateDaytimeActivitiesIfRated0Or(),
client.getCQuestions().getC5DaytimeActivitiesHowDoYouSpendYourDay().getAnswerGroup(),
staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesInFindingAndKeepingRegul(),
staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesInFindingAndKeepingRegularAn(),
staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesInFindingAndKeepingRegularAndA());
ods.getDomain().add(d5);
if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCWhatIsYourCurrentEmploymentStatusSelectOne().getCIndependentCompetitive())) {
d5.setEmployStatus("224363007");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCWhatIsYourCurrentEmploymentStatusSelectOne().getCAssistedSupportive())) {
d5.setEmployStatus("ES-1");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCWhatIsYourCurrentEmploymentStatusSelectOne().getCAlternativeBusinesses())) {
d5.setEmployStatus("ES-2");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCWhatIsYourCurrentEmploymentStatusSelectOne().getCShelteredWorkshop())) {
d5.setEmployStatus("224366004");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCWhatIsYourCurrentEmploymentStatusSelectOne().getCNonPaidWorkExperience())) {
d5.setEmployStatus("276061003");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCWhatIsYourCurrentEmploymentStatusSelectOne().getCNoEmploymentOtherActivity())) {
d5.setEmployStatus("ES-3");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCWhatIsYourCurrentEmploymentStatusSelectOne().getCCasualSporadic())) {
d5.setEmployStatus("224364001");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCWhatIsYourCurrentEmploymentStatusSelectOne().getCNoEmploymentOfAnyKind())) {
d5.setEmployStatus("73438004");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCWhatIsYourCurrentEmploymentStatusSelectOne().getCUnknown())) {
d5.setEmployStatus("261665006");
} else {
d5.setEmployStatus("CDA");
}
if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouCurrentlyInSchoolSelectOne().getCNotInSchool())) {
d5.setEducationProgramStatus("224304004");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouCurrentlyInSchoolSelectOne().getCElementaryJuniorHighSchool())) {
d5.setEducationProgramStatus("224306002");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouCurrentlyInSchoolSelectOne().getCSecondaryHighSchool())) {
d5.setEducationProgramStatus("224308001");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouCurrentlyInSchoolSelectOne().getCTradeSchool())) {
d5.setEducationProgramStatus("224860003");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouCurrentlyInSchoolSelectOne().getCVocationalTrainingSchool())) {
d5.setEducationProgramStatus("54106008");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouCurrentlyInSchoolSelectOne().getCAdultEducation())) {
d5.setEducationProgramStatus("161125007");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouCurrentlyInSchoolSelectOne().getCCommunityCollege())) {
d5.setEducationProgramStatus("224870001");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouCurrentlyInSchoolSelectOne().getCUniversity())) {
d5.setEducationProgramStatus("224871002");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouCurrentlyInSchoolSelectOne().getCOther())) {
d5.setEducationProgramStatus("410515003");
} else if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCWhatIsYourCurrentEmploymentStatusSelectOne().getCUnknown())) {
d5.setEducationProgramStatus("261665006");
} else {
d5.setEducationProgramStatus("CDA");
}
RiskUnemploymentList rul = of.createRiskUnemploymentList();
d5.setRiskUnemploymentList(rul);
if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouAtRiskOfUnemploymentOrDisrupedEducationCheckAllThatApply().getCDifficultyInGettingToWorkSchoolOnTime())) {
rul.getRiskUnemployment().add("UDER-01");
}
if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouAtRiskOfUnemploymentOrDisrupedEducationCheckAllThatApply().getCProblemsDifficultyInWorkSchool())) {
rul.getRiskUnemployment().add("UDER-02");
}
if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouAtRiskOfUnemploymentOrDisrupedEducationCheckAllThatApply().getCLookingToQuitWorkSchool())) {
rul.getRiskUnemployment().add("UDER-03");
}
if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouAtRiskOfUnemploymentOrDisrupedEducationCheckAllThatApply().getCFrequentChangesInWorkSchool())) {
rul.getRiskUnemployment().add("UDER-04");
}
if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouAtRiskOfUnemploymentOrDisrupedEducationCheckAllThatApply().getCNoneOrNotApplicable())) {
rul.getRiskUnemployment().add("UDER-05");
}
if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouAtRiskOfUnemploymentOrDisrupedEducationCheckAllThatApply().getCUnknown())) {
rul.getRiskUnemployment().add("UDER-06");
}
if ("T".equals(staff.getC5DaytimeActivitiesHowDoYouSpendYourDayDoYouHaveEnoughToDo().getCAreYouAtRiskOfUnemploymentOrDisrupedEducationCheckAllThatApply().getCClientDeclinedToAnswer())) {
rul.getRiskUnemployment().add("UDER-07");
}
Domain d6 = createCommonDomain(of, "06-physical health",
staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getC1DoesThePersonHaveAnyPhysicalDisabilityOrAnyPhysicalIllnessIfRated0Or9Ski(),
client.getCQuestions().getC6PhysicalHealthHowWellDoYouFeelPhysically().getAnswerGroup(),
staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesForPhysicalHealthProblems(),
staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesForPhysicalHealthProblems(),
staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesForPhysicalHealthProblems());
ods.getDomain().add(d6);
MedicalConditionList mcl = of.createMedicalConditionList();
d6.setMedicalConditionList(mcl);
CMedicalConditionsCheckAllThatApply medicalConditionsCheckAllThatApply = staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCMedicalConditionsCheckAllThatApply();
if ("T".equals(medicalConditionsCheckAllThatApply.getCAcquiredBrainInjuryABI())) {
mcl.getMedicalCondition().add("127294003");
}
if ("T".equals(medicalConditionsCheckAllThatApply.getCArthritis())) {
mcl.getMedicalCondition().add("3723001");
}
if ("T".equals(medicalConditionsCheckAllThatApply.getCAutism())) {
mcl.getMedicalCondition().add("408856003");
}
mcl.setAutismDetail(null);
List<Object> _mcl = medicalConditionsCheckAllThatApply.getCOtherOrCSpecifyOrCBreathingProblems();
for (Object obj : _mcl) {
try {
JAXBElement<?> e = (JAXBElement<?>) obj;
if ("CSpecify".equals(e.getName().toString())) {
if (mcl.getAutismDetail() == null) {
mcl.setAutismDetail(e.getValue().toString());
} else {
mcl.setOtherDetail(e.getValue().toString());
}
}
if ("T".equals(e.getValue().toString())) {
if ("CBreathing_problems".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("386813002");
}
if ("CCancer".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("363346000");
}
if ("CCirrhosis".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("19943007");
}
if ("CCommunicable_health_disease".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("191415002");//Communicable health disease
}
if ("CDiabetes_Type_1".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("46635009");//Diabetes Type 1
}
if ("CDiabetes_Type_2".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("44054006");//Diabetes Type 2
}
if ("CDiabetes_Type_3".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("359939009");//Diabetes Type 3
}
// if ("C".equals(e.getName().toString())) {
// mcl.getMedicalCondition().add("73211009");//Diabetes Other
// }
if ("CEating_disorder".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("72366004");//Eating disorder
}
if ("CEpilepsy".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("84757009");//Epilepsy
}
if ("CHearing_Impairment".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("15188001");//Hearing impairment
}
if ("CHeart_Condition".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("301095005");//Heart condition
}
if ("CHepatitis_A".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("40468003");//Hepatitis A
}
if ("CHepatitis_B".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("66071002");//Hepatitis B
}
if ("CHepatitis_C".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("50711007");//Hepatitis C
}
if ("CHIV".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("86406008");//HIV
}
if ("CHigh_blood_pressure".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("38341003");//High blood pressure
}
if ("CHigh_cholesterol".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("13644009");//High cholesterol
}
if ("CIntellectual_disability".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("228156007");//Intellectual disability
}
if ("CLow_blood_pressure".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("45007003");//Low blood pressure
}
if ("CMRSA__C_Difficile".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("282028001");//MRSA, C Difficile
}
if ("CObesity".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("414916001");//Obesity
}
if ("COsteoporosis".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("64859006");//Osteoporosis
}
if ("CPregnancy".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("118185001");//Pregnancy
}
if ("CSeizure".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("128613002");//Seizure
}
if ("CSexually_Transmitted_Disease__STD_".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("8098009");//Sexually Transmitted Disease (STD)
}
if ("CSkin_conditions".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("95320005");//Skin conditions
}
if ("CStroke".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("230690007");//Stroke
}
if ("CThyroid".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("14304000");//Thyroid
}
if ("CVision_impairment".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("397540003");//Vision impairment
}
if ("COther".equals(e.getName().toString())) {
mcl.getMedicalCondition().add("410515003");//Other
}
}
} catch (ClassCastException e) {
continue;
}
}
if ("T".equals(medicalConditionsCheckAllThatApply.getCUnknown())) {
mcl.getMedicalCondition().add("261665006");
}
if ("T".equals(medicalConditionsCheckAllThatApply.getCClientDeclinedToAnswer())) {
mcl.getMedicalCondition().add("CDA");
}
if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCDoYouHaveAnyConcernsAboutYourPhysicalHealth().getCYes())) {
d6.setPhysicalHealthConcern("TRUE");
} else if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCDoYouHaveAnyConcernsAboutYourPhysicalHealth().getCNo())) {
d6.setPhysicalHealthConcern("FALSE");
} else if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCDoYouHaveAnyConcernsAboutYourPhysicalHealth().getCUnknown())) {
d6.setPhysicalHealthConcern("UNK");
} else if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCDoYouHaveAnyConcernsAboutYourPhysicalHealth().getCClientDeclinedToAnswer())) {
d6.setPhysicalHealthConcern("CDA");
}
ConcernAreaList cal = of.createConcernAreaList();
d6.setConcernAreaList(cal);
CIfYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply = staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCIfYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply();
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCHeadAndNeck())) {
cal.getConcernArea().add("118254002");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCChest())) {
cal.getConcernArea().add("279084009");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCAbdomen())) {
cal.getConcernArea().add("119415007");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCExtremitiesArmsLegsHandsFeet())) {
cal.getConcernArea().add("302293008");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCGenitalUrinary())) {
cal.getConcernArea().add("300479008");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCSkin())) {
cal.getConcernArea().add("106076001");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCJoints())) {
cal.getConcernArea().add("118952005");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCMobility())) {
cal.getConcernArea().add("365092005");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCNeurological())) {
cal.getConcernArea().add("102957003");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCHearing())) {
cal.getConcernArea().add("118230007");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCVision())) {
cal.getConcernArea().add("118235002");
}
if ("T".equals(ifYesPleaseIndicateTheAreasWhereYouHaveConcernsCheckAllThatApply.getCOther())) {
cal.getConcernArea().add("410515003");
}
cal.setOtherConcernArea(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCMedicationsAdditionalInformation().getC());
MedicationList ml = of.createMedicationList();
d6.setMedicationList(ml);
List<JAXBElement<String>> medicationOrC3MedicationOrC4Medication = staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCListOfAllCurrentMedicationsIncludingPrescribedAndAlternativeOverTheCounterMedicati().getC2MedicationOrC3MedicationOrC4Medication();
String [] triad = new String[3];
int placed = 0;
for (JAXBElement<String> e : medicationOrC3MedicationOrC4Medication) {
if ("CTaken_as_prescribed_".equals(e.getName().toString())) {
triad[0] = e.getValue().toString();
placed++;
}
if ("CHelp_is_provided_".equals(e.getName().toString())) {
triad[1] = e.getValue().toString();
placed++;
}
if ("CHelp_is_needed_".equals(e.getName().toString())) {
triad[2] = e.getValue().toString();
placed++;
}
if (placed == 3) {
ml.getMedicationDetail().add(createMedicationDetail(of, triad[0], triad[1], triad[2]));
placed = 0;
}
}
if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCReportsSideEffectsSelectOne().getCYes())) {
d6.setSideEffects("TRUE");
} else if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCReportsSideEffectsSelectOne().getCNo())) {
d6.setSideEffects("FALSE");
} else if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCReportsSideEffectsSelectOne().getCUnknown())) {
d6.setSideEffects("UNK");
} else if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCReportsSideEffectsSelectOne().getCClientDeclinedToAnswer())) {
d6.setSideEffects("CDA");
}
if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCDoTheseSideEffectsAffectYourDailyLivingSelectOne().getCYes())) {
d6.setDailyLivingAffected("TRUE");
} else if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCDoTheseSideEffectsAffectYourDailyLivingSelectOne().getCNo())) {
d6.setDailyLivingAffected("FALSE");
} else if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCDoTheseSideEffectsAffectYourDailyLivingSelectOne().getCUnknown())) {
d6.setDailyLivingAffected("UNK");
} else if ("T".equals(staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCDoTheseSideEffectsAffectYourDailyLivingSelectOne().getCClientDeclinedToAnswer())) {
d6.setDailyLivingAffected("CDA");
}
SideEffectsDetailList sedl = of.createSideEffectsDetailList();
d6.setSideEffectsDetailList(sedl);
List<Object> sideEffectsDesc = staff.getC6PhysicalHealthHowWellDoYouFeelPhysicallyAreYouGettingAnyTreatmentForPhysical().getCDescriptionOfSideEffectsCheckAllThatApply().getContent();
for (Object obj : sideEffectsDesc) {
try {
JAXBElement<?> e = (JAXBElement<?>) obj;
if ("COther_".equals(e.getName().toString())) {
sedl.setOtherSideEffectsDetail(e.getValue().toString());
}
if ("T".equals(e.getValue().toString())) {
if ("CNone".equals(e.getName().toString())) {//None
sedl.getSideEffectsDetail().add("410516002");
}
if ("Cblurred_dimmed_vision".equals(e.getName().toString())) {//Blurred/ dimmed vision
sedl.getSideEffectsDetail().add("246636008");
}
if ("CChanges_in_appetite".equals(e.getName().toString())) {//Changes in appetite
sedl.getSideEffectsDetail().add("249473004");
}
if ("CDizziness_spinning".equals(e.getName().toString())) {//Dizziness/ spinning
sedl.getSideEffectsDetail().add("404640003");
}
if ("CDrowsiness_sedation".equals(e.getName().toString())) {//Drowsiness/ sedation
sedl.getSideEffectsDetail().add("271782001");
}
if ("CDry_mouth".equals(e.getName().toString())) {//Dry mouth
sedl.getSideEffectsDetail().add("87715008");
}
if ("CFatigue_weakness".equals(e.getName().toString())) {//Fatigue/ weakness
sedl.getSideEffectsDetail().add("84229001");
}
if ("CFast_heart_beat".equals(e.getName().toString())) {//Fast heart beat
sedl.getSideEffectsDetail().add("6285003");
}
if ("CGastrointestinal_distress".equals(e.getName().toString())) {//Gastrointestinal distress
sedl.getSideEffectsDetail().add("53619000");
}
if ("CHeadache".equals(e.getName().toString())) {//Headache
sedl.getSideEffectsDetail().add("25064002");
}
if ("CInsomnia".equals(e.getName().toString())) {//Insomnia
sedl.getSideEffectsDetail().add("193462001");
}
if ("CMenstrual_changes".equals(e.getName().toString())) {//Menstrual changes
sedl.getSideEffectsDetail().add("106002000");
}
if ("CMilky_discharge_from_breasts".equals(e.getName().toString())) {//Milky discharge from breasts
sedl.getSideEffectsDetail().add("271941007");
}
if ("CMuscle_spasms".equals(e.getName().toString())) {//Muscle spasms
sedl.getSideEffectsDetail().add("106030000");
}
if ("CNumbness_tingling".equals(e.getName().toString())) {//Numbness/ tingling
sedl.getSideEffectsDetail().add("44077006");
}
if ("CRestlessness".equals(e.getName().toString())) {//Restlessness
sedl.getSideEffectsDetail().add("24199005");
}
if ("CSexual_disturbance".equals(e.getName().toString())) {//Sexual disturbance
sedl.getSideEffectsDetail().add("106142007");
}
if ("CTremors_rigidity_balance_problems".equals(e.getName().toString())) {//Tremors/ rigidity/ balance problems
sedl.getSideEffectsDetail().add("26079004");
}
if ("CWeight_gain".equals(e.getName().toString())) {//Weight gain
sedl.getSideEffectsDetail().add("8943002");
}
if ("COther_".equals(e.getName().toString())) {//Other
sedl.getSideEffectsDetail().add("410515003");
}
}
} catch (ClassCastException e) {
continue;
}
}
Domain d7 = createCommonDomain(of, "07-psychotic symptoms",
staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getC1DoesThePersonHaveAnyPsychoticSymptoms(),
client.getCQuestions().getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughts().getAnswerGroup(),
staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesForThesePsychoticSymptoms(),
staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesForThesePsychoticSymptoms(),
staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesForThesePsychoticSymptoms());
ods.getDomain().add(d7);
List<Object> communityTreatmentOrderOrCPsychiatricHistory = staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCCommunityTreatmentOrderOrCPsychiatricHistory();
CPsychiatricHistory history = null;
CCommunityTreatmentOrder treatment = null;
for (Object obj : communityTreatmentOrderOrCPsychiatricHistory) {
if (obj instanceof CPsychiatricHistory) {
history = (CPsychiatricHistory) obj;
} else if (obj instanceof CCommunityTreatmentOrder) {
treatment = (CCommunityTreatmentOrder) obj;
}
}
if ("Yes".equals(history.getCHaveYouBeenHospitalizedDueToYourMentalHealthDuringThePastTwoYears())) {
d7.setHospitalizedPastTwoYears("TRUE");
d7.setTotalAdmissions(history.getCIfYesTotalNumberOfAdmissionLastTwoYears());
d7.setTotalHospitalDays(history.getCIfYesTotalNumberOfHospitalizationDaysLastTwoYears());
} else if ("No".equals(history.getCHaveYouBeenHospitalizedDueToYourMentalHealthDuringThePastTwoYears())) {
d7.setHospitalizedPastTwoYears("FALSE");
} else if ("Unknown".equals(history.getCHaveYouBeenHospitalizedDueToYourMentalHealthDuringThePastTwoYears())) {
d7.setHospitalizedPastTwoYears("UNK");
} else if ("Client declined to answer".equals(history.getCHaveYouBeenHospitalizedDueToYourMentalHealthDuringThePastTwoYears())) {
d7.setHospitalizedPastTwoYears("CDA");
}
if ("T".equals(treatment.getCIssuedCTO())) {
d7.setCommunityTreatOrder("015-01");
} else if ("T".equals(treatment.getCNoCTO())) {
d7.setCommunityTreatOrder("015-02");
} else if ("T".equals(treatment.getCUnknown())) {
d7.setCommunityTreatOrder("015-03");
} else if ("T".equals(treatment.getCClientDeclinedToAnswer())) {
d7.setCommunityTreatOrder("015-04");
}
SymptomList sl = of.createSymptomList();
d7.setSymptomList(sl);
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCNone())) {
sl.getSymptom().add("410516002");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCAbnormalAffect())) {
sl.getSymptom().add("416383008");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCAbnormalThoughtProcessForm())) {
sl.getSymptom().add("78633001");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCAnger())) {
sl.getSymptom().add("75408008");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCAnxiety())) {
sl.getSymptom().add("48694002");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCCommandHallucinations())) {
sl.getSymptom().add("78595002");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCCompulsiveBehaviour())) {
sl.getSymptom().add("12479006");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCDecreasedEnergy())) {
sl.getSymptom().add("248274002");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCDelusions())) {
sl.getSymptom().add("2073000");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCEpisodesOfPanic())) {
sl.getSymptom().add("225624000");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCFears())) {
sl.getSymptom().add("1402001");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCGuiltShame())) {
sl.getSymptom().add("7571003");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCHallucinations())) {
sl.getSymptom().add("7011001");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCHopelessness())) {
sl.getSymptom().add("307077003");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCHygiene())) {
sl.getSymptom().add("410428008");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCInabilityTOExperienceJoyPleasure())) {
sl.getSymptom().add("28669007");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCInflatedSelfWorth())) {
sl.getSymptom().add("247783009");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCIntrusiveThoughts())) {
sl.getSymptom().add("225445003");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCIrritability())) {
sl.getSymptom().add("55929007");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCObsessiveThoughts())) {
sl.getSymptom().add("67698009");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCPhobias())) {
sl.getSymptom().add("386808001");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCPressuredSpeech())) {
sl.getSymptom().add("53890003");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCRacingThoughts())) {
sl.getSymptom().add("285303006");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCRapidMoodChanges())) {
sl.getSymptom().add("18963009");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCRelivingTraumaticMemories())) {
sl.getSymptom().add("285216009");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCSelfDeprecation())) {
sl.getSymptom().add("247892001");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCSleepProblems())) {
sl.getSymptom().add("301345002");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCTearfulness())) {
sl.getSymptom().add("271951008");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCUnusualOrAbnormalPhysicalMovements())) {
sl.getSymptom().add("225606002");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCUnknown())) {
sl.getSymptom().add("261665006");
}
if ("T".equals(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCOther())) {
sl.getSymptom().add("410515003");
}
sl.setOtherSymptom(staff.getC7PsychoticSymptomsDoYouEverHearVoicesOrHaveProblemsWithYourThoughtsAreYouOn().getCSymptomChecklist().getCSpecify());
Domain d8 = createCommonDomain(of, "08-condition and treatment",
staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getC1HasThePersonHadClearVerbalOrWrittenInformationAboutConditionAndTreatmentIfRa(),
client.getCQuestions().getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getAnswerGroup(),
staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesInObtainingSuchInformatio(),
staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesInObtainingSuchInformation(),
staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesInObtainingSuchInformation());
ods.getDomain().add(d8);
DiagnosticList dl = of.createDiagnosticList();
d8.setDiagnosticList(dl);
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCAdjustmentDisorders())) {
dl.getDiagnostic().add("17226007");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCAnxietyDisorder())) {
dl.getDiagnostic().add("197480006");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCDeliriumDementiaAndAmnesticAndCognitiveDisorders())) {
dl.getDiagnostic().add("2776000");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCDisorderOfChildhoodAdolescence())) {
dl.getDiagnostic().add("DCA");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCDissociativeDisorders())) {
dl.getDiagnostic().add("44376007");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCEatingDisorders())) {
dl.getDiagnostic().add("72366004");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCFactitiousDisorders())) {
dl.getDiagnostic().add("50705009");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCImpulseControlDisordersNotElsewhereClassified())) {
dl.getDiagnostic().add("66347000");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCMentalDisordersDueToGeneralMedicalConditions())) {
dl.getDiagnostic().add("MDGMC");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCMoodDisorder())) {
dl.getDiagnostic().add("46206005");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCPersonalityDisorders())) {
dl.getDiagnostic().add("33449004");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCSchizopherniaAndOtherPsychoticDisorders())) {
dl.getDiagnostic().add("58214004");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCSexualAndGenderIdentityDisorders())) {
dl.getDiagnostic().add("39898005");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCSleepDisorders())) {
dl.getDiagnostic().add("31297008");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCSomatoformDisorders())) {
dl.getDiagnostic().add("87858002");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCSubstanceRelatedDisorders())) {
dl.getDiagnostic().add("SRDDH");
}
// if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCDevelopmentalHandicap())) {
// dl.getDiagnostic().add("DH");
// }
// if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCUnknown)) {
// dl.getDiagnostic().add("261665006");
// }
// if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCDiagnosticCategoriesCheckAllThatApply().getCClientDeclinedToAnswer())) {
// dl.getDiagnostic().add("CDA");
// }
OtherIllnessList oil = of.createOtherIllnessList();
d8.setOtherIllnessList(oil);
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCOtherIllnessInformationCheckAllThatApply().getCConcurrentDisorderSubstanceAbuse())) {
oil.getOtherIllness().add("016A-01");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCOtherIllnessInformationCheckAllThatApply().getCDualDiagnosisDevelopmentalDisability())) {
oil.getOtherIllness().add("016A-02");
}
if ("T".equals(staff.getC8InformationOnConditionAndTreatmentHaveYouBeenGivenClearInformationAboutYourMed().getCOtherIllnessInformationCheckAllThatApply().getCOtherChronicIllnessesAndOrPhysicalDisabilities())) {
oil.getOtherIllness().add("016A-03");
}
Domain d9 = createCommonDomain(of, "09-psychological distress",
staff.getC9PsychologicalDistressHaveYouRecentlyFeltVerySadOrLowHaveYouFeltOverlyAnxious().getC1DoesThePersonSufferFromCurrentPsychologicalDistressIfRated0Or9GoToTheNext(),
client.getCQuestions().getC9PsychologicalDistressHaveYouRecentlyFeltVerySadOrLow().getAnswerGroup(),
staff.getC9PsychologicalDistressHaveYouRecentlyFeltVerySadOrLowHaveYouFeltOverlyAnxious().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesForThisDistress(),
staff.getC9PsychologicalDistressHaveYouRecentlyFeltVerySadOrLowHaveYouFeltOverlyAnxious().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesForThisDistress(),
staff.getC9PsychologicalDistressHaveYouRecentlyFeltVerySadOrLowHaveYouFeltOverlyAnxious().getC3BHowMuchHelpDoesThisPersonNeedFromLocalServicesForThisDistress());
ods.getDomain().add(d9);
Domain d10 = createCommonDomain(of, "10-safety to self",
staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getC1IsThePersonADangerToHimOrHerselfIfRated0Or9SkipQuestions23AndProceed(),
client.getCQuestions().getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourself().getAnswerGroup(),
staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesToReduceTheRiskOfSelfH(),
staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesToReduceTheRiskOfSelfHarm(),
staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesToReduceTheRiskOfSelfHarm());
ods.getDomain().add(d10);
if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCHaveYouAttemptedSuicideInThePastSelectOne().getCYes())) {
d10.setSuicideAttempt("TRUE");
} else if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCHaveYouAttemptedSuicideInThePastSelectOne().getCNo())) {
d10.setSuicideAttempt("FALSE");
} else if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCHaveYouAttemptedSuicideInThePastSelectOne().getCUnknown())) {
d10.setSuicideAttempt("UNK");
} else if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCHaveYouAttemptedSuicideInThePastSelectOne().getCClientDeclinedToAnswer())) {
d10.setSuicideAttempt("CDA");
}
if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCDoYouCurrentlyHaveSuicidalThoughtsSelectOne().getCYes())) {
d10.setSuicideThoughts("TRUE");
} else if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCDoYouCurrentlyHaveSuicidalThoughtsSelectOne().getCNo())) {
d10.setSuicideThoughts("FALSE");
} else if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCDoYouCurrentlyHaveSuicidalThoughtsSelectOne().getCUnknown())) {
d10.setSuicideThoughts("UNK");
} else if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCDoYouCurrentlyHaveSuicidalThoughtsSelectOne().getCClientDeclinedToAnswer())) {
d10.setSuicideThoughts("CDA");
}
if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCDoYouHaveAnyConcernsFroYourOwnSafetySelectOne().getCYes())) {
d10.setSafetyConcernSelf("TRUE");
} else if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCDoYouHaveAnyConcernsFroYourOwnSafetySelectOne().getCNo())) {
d10.setSafetyConcernSelf("FALSE");
} else if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCDoYouHaveAnyConcernsFroYourOwnSafetySelectOne().getCUnknown())) {
d10.setSafetyConcernSelf("UNK");
} else if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCDoYouHaveAnyConcernsFroYourOwnSafetySelectOne().getCClientDeclinedToAnswer())) {
d10.setSafetyConcernSelf("CDA");
}
SafetyToSelfRiskList ssrl = of.createSafetyToSelfRiskList();
d10.setSafetyToSelfRiskList(ssrl);
if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCRisksSelectAllThatApply().getCAbuseNeglect())) {
ssrl.getSafetyToSelfRisk().add("225915006");
}
if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCRisksSelectAllThatApply().getCAccidentalSelfHarm())) {
ssrl.getSafetyToSelfRisk().add("242056005");
}
if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCRisksSelectAllThatApply().getCDeliberateSelfHarm())) {
ssrl.getSafetyToSelfRisk().add("401206008");
}
if ("T".equals(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCRisksSelectAllThatApply().getCExploitationRisk())) {
ssrl.getSafetyToSelfRisk().add("417430008");
}
if (staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCRisksSelectAllThatApply().getCOther()!=null &&
staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCRisksSelectAllThatApply().getCOther().length() > 0) {
ssrl.getSafetyToSelfRisk().add("410515003");
ssrl.setOtherSafetyToSelfRisk(staff.getC10SafetyToSelfDoYouEverHaveThoughtsOfHarmingYourselfOrActuallyHarmingYourself().getCRisksSelectAllThatApply().getCOther());
}
Domain d11 = createCommonDomain(of, "11-safety to others",
staff.getC11SafetyToOthersDoYouThinkYouCouldBeADangerToOtherPeopleSSafetyDoYouEver().getC1IsThePersonACurrentOrPotentialRiskToOtherPeopleSSafetyIfRated0Or9GoTo(),
client.getCQuestions().getC11SafetyToOthersDoYouThinkYouCouldBeADangerToOtherPeopleSSafety().getAnswerGroup(),
staff.getC11SafetyToOthersDoYouThinkYouCouldBeADangerToOtherPeopleSSafetyDoYouEver().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesToReduceTheRiskThatHeO(),
staff.getC11SafetyToOthersDoYouThinkYouCouldBeADangerToOtherPeopleSSafetyDoYouEver().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesToReduceTheRiskThatHeOrShe(),
staff.getC11SafetyToOthersDoYouThinkYouCouldBeADangerToOtherPeopleSSafetyDoYouEver().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesToReduceTheRiskThatHeOrSheMi());
ods.getDomain().add(d11);
Domain d12 = createCommonDomain(of, "12-alcohol",
staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getC1DoesThePersonDrinkExcessivelyOrHaveAProblemControllingHisOrHerDrinkingIfRa(),
client.getCQuestions().getC12AlcoholDoesDrinkingCauseYouAnyProblems().getAnswerGroup(),
staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesForThisDrinking(),
staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesForThisDrinking(),
staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesForThisDrinking());
ods.getDomain().add(d12);
DrinkAlcohol da = of.createDrinkAlcohol();
d12.setDrinkAlcohol(da);
if (staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinksDaily() != null &&
staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinksDaily().intValue() > 0) {
da.setFrequency("1");
da.setQuantity(staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinksDaily());
} else if (staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinks23TimesWeekly() != null &&
staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinks23TimesWeekly().intValue() > 0) {
da.setFrequency("2");
da.setQuantity(staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinks23TimesWeekly());
} else if (staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinksWeekly() != null &&
staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinksWeekly().intValue() > 0) {
da.setFrequency("3");
da.setQuantity(staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinksWeekly());
} else if (staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinksMonthly() != null &&
staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinksMonthly().intValue() > 0) {
da.setFrequency("4");
da.setQuantity(staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCHowOftenDoYouDrinkAlcoholIENumberOfDrinks().getCDrinksMonthly());
}
if ("T".equals(staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCPrecontemplation())) {
d12.setStageOfChangeAlcohol("1");
} else if ("T".equals(staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCContemplation())) {
d12.setStageOfChangeAlcohol("2");
} else if ("T".equals(staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCAction())) {
d12.setStageOfChangeAlcohol("3");
} else if ("T".equals(staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCMaintenance())) {
d12.setStageOfChangeAlcohol("4");
} else if ("T".equals(staff.getC12AlcoholDoesDrinkingCauseYouAnyProblemsDoYouWishYouCouldCutDownOnYourDrink().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCRelapsePrevention())) {
d12.setStageOfChangeAlcohol("5");
}
Domain d13 = createCommonDomain(of, "13-drugs",
staff.getC13DrugsDoYouTakeDrugsThatArenTPrescribedAreThereAnyDrugsYouWouldFindHardTo().getC1DoesThePersonHaveProblemsWithDrugMisuseIfRated0Or9SkipQuestions23AndP(),
client.getCQuestions().getC13DrugsDoYouTakeAnyDrugsThatArenTPrescribed().getAnswerGroup(),
staff.getC13DrugsDoYouTakeDrugsThatArenTPrescribedAreThereAnyDrugsYouWouldFindHardTo().getC2HowMuchHelpWithDrugMisuseDoesThePersonReceiveFromFriendsOrRelatives(),
staff.getC13DrugsDoYouTakeDrugsThatArenTPrescribedAreThereAnyDrugsYouWouldFindHardTo().getC3AHowMuchHelpWithDrugMisuseDoesThePersonReceiveFromLocalServices(),
staff.getC13DrugsDoYouTakeDrugsThatArenTPrescribedAreThereAnyDrugsYouWouldFindHardTo().getC3BHowMuchHelpWithDrugMisuseDoesThePersonNeedFromLocalServices());
ods.getDomain().add(d13);
DrugUseList dul = of.createDrugUseList();
d13.setDrugUseList(dul);
CWhichOfTheFollowingDrugsHaveYouUsedCheckAllThatApply whichOfTheFollowing = staff.getC13DrugsDoYouTakeDrugsThatArenTPrescribedAreThereAnyDrugsYouWouldFindHardTo().getCWhichOfTheFollowingDrugsHaveYouUsedCheckAllThatApply();
if ("T".equals(whichOfTheFollowing.getCHasTheSubstanceBeenInjected().getCPast6Months())) {
dul.setInjected("5");
} else if ("T".equals(whichOfTheFollowing.getCHasTheSubstanceBeenInjected().getCEver())) {
dul.setInjected("6");
}
String frequency = null;
if ("T".equals(whichOfTheFollowing.getCMarijuana().getCPast6Months())) {
frequency = "5";
} else if ("T".equals(whichOfTheFollowing.getCMarijuana().getCEver())) {
frequency = "6";
}
if (frequency != null) {
DrugUse du1 = of.createDrugUse();
du1.setFrequency(frequency);
du1.setName("398705004");
dul.getDrugUse().add(du1);
}
frequency = null;
if ("T".equals(whichOfTheFollowing.getCCocaineCrack().getCPast6Months())) {
frequency = "5";
} else if ("T".equals(whichOfTheFollowing.getCCocaineCrack().getCEver())) {
frequency = "6";
}
if (frequency != null) {
DrugUse du1 = of.createDrugUse();
du1.setFrequency(frequency);
du1.setName("288453002");
dul.getDrugUse().add(du1);
}
frequency = null;
if ("T".equals(whichOfTheFollowing.getCHallucinogensEGLSDPCP().getCPast6Months())) {
frequency = "5";
} else if ("T".equals(whichOfTheFollowing.getCHallucinogensEGLSDPCP().getCEver())) {
frequency = "6";
}
if (frequency != null) {
DrugUse du1 = of.createDrugUse();
du1.setFrequency(frequency);
du1.setName("229005006");
dul.getDrugUse().add(du1);
}
frequency = null;
if ("T".equals(whichOfTheFollowing.getCStimulantsEGAmphetamines().getCPast6Months())) {
frequency = "5";
} else if ("T".equals(whichOfTheFollowing.getCStimulantsEGAmphetamines().getCEver())) {
frequency = "6";
}
if (frequency != null) {
DrugUse du1 = of.createDrugUse();
du1.setFrequency(frequency);
du1.setName("226059005");
dul.getDrugUse().add(du1);
}
frequency = null;
if ("T".equals(whichOfTheFollowing.getCOpiatesEGHeroin().getCPast6Months())) {
frequency = "5";
} else if ("T".equals(whichOfTheFollowing.getCOpiatesEGHeroin().getCEver())) {
frequency = "6";
}
if (frequency != null) {
DrugUse du1 = of.createDrugUse();
du1.setFrequency(frequency);
du1.setName("226044004");
dul.getDrugUse().add(du1);
}
frequency = null;
if ("T".equals(whichOfTheFollowing.getCSedativesNotPrescribedOrNotTakenAsPrescribedEGValium().getCPast6Months())) {
frequency = "5";
} else if ("T".equals(whichOfTheFollowing.getCSedativesNotPrescribedOrNotTakenAsPrescribedEGValium().getCEver())) {
frequency = "6";
}
if (frequency != null) {
DrugUse du1 = of.createDrugUse();
du1.setFrequency(frequency);
du1.setName("372614000");
dul.getDrugUse().add(du1);
}
frequency = null;
if ("T".equals(whichOfTheFollowing.getCOverTheCounter().getCPast6Months())) {
frequency = "5";
} else if ("T".equals(whichOfTheFollowing.getCOverTheCounter().getCEver())) {
frequency = "6";
}
if (frequency != null) {
DrugUse du1 = of.createDrugUse();
du1.setFrequency(frequency);
du1.setName("80288002");
dul.getDrugUse().add(du1);
}
frequency = null;
if ("T".equals(whichOfTheFollowing.getCSolvents().getCPast6Months())) {
frequency = "5";
} else if ("T".equals(whichOfTheFollowing.getCSolvents().getCEver())) {
frequency = "6";
}
if (frequency != null) {
DrugUse du1 = of.createDrugUse();
du1.setFrequency(frequency);
du1.setName("61010005");
dul.getDrugUse().add(du1);
}
frequency = null;
List<Serializable> otherDrugs = whichOfTheFollowing.getCOther().getContent();
for (Object obj : otherDrugs) {
try {
JAXBElement<?> e = (JAXBElement<?>) obj;
if ("T".equals(e.getValue().toString())) {
if ("CPast_6_months".equals(e.getName().toString())) {
frequency = "5";
}
if ("CEver".equals(e.getName().toString())) {
frequency = "6";
}
}
} catch (ClassCastException e) {
continue;
}
}
if (frequency != null) {
DrugUse du1 = of.createDrugUse();
du1.setFrequency(frequency);
du1.setName("410515003");
dul.getDrugUse().add(du1);
}
if ("T".equals(staff.getC13DrugsDoYouTakeDrugsThatArenTPrescribedAreThereAnyDrugsYouWouldFindHardTo().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCPrecontemplation())) {
d13.setStageOfChangeDrugs("1");
} else if ("T".equals(staff.getC13DrugsDoYouTakeDrugsThatArenTPrescribedAreThereAnyDrugsYouWouldFindHardTo().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCContemplation())) {
d13.setStageOfChangeDrugs("2");
} else if ("T".equals(staff.getC13DrugsDoYouTakeDrugsThatArenTPrescribedAreThereAnyDrugsYouWouldFindHardTo().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCAction())) {
d13.setStageOfChangeDrugs("3");
} else if ("T".equals(staff.getC13DrugsDoYouTakeDrugsThatArenTPrescribedAreThereAnyDrugsYouWouldFindHardTo().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCMaintenance())) {
d13.setStageOfChangeDrugs("4");
} else if ("T".equals(staff.getC13DrugsDoYouTakeDrugsThatArenTPrescribedAreThereAnyDrugsYouWouldFindHardTo().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCRelapsePrevention())) {
d13.setStageOfChangeDrugs("5");
}
Domain d14 = createCommonDomain(of, "14-other addictions",
staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getC1DoesThePersonHaveProblemsWithAddictionsIfRated0Or9GoToTheNextDomain(),
client.getCQuestions().getCOtherAddictionsDoYouHaveAnyOtherAddictionsSuchAsGambling().getAnswerGroup(),
staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getC2HowMuchHelpWithAddictionsDoesThePersonReceiveFromFriendsOrRelatives(),
staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getC3AHowMuchHelpWithAddictionsDoesThePersonReceiveFromLocalServices(),
staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getC3BHowMucHelpWithAddictionsDoesThePersonNeedFromLocalServices());
ods.getDomain().add(d14);
AddictionTypeList atl = of.createAddictionTypeList();
d14.setAddictionTypeList(atl);
if ("T".equals(staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getCTypeOfAddictionCheckAllThatApply().getCGambling())) {
atl.getAddictionType().add("105523009");
} else if ("T".equals(staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getCTypeOfAddictionCheckAllThatApply().getCNicotine())) {
atl.getAddictionType().add("56294008");
} else if (staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getCTypeOfAddictionCheckAllThatApply().getCOther() != null &&
staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getCTypeOfAddictionCheckAllThatApply().getCOther().length() > 0) {
atl.getAddictionType().add("410515003");
atl.setOtherAddictionType(staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getCTypeOfAddictionCheckAllThatApply().getCOther());
}
if ("T".equals(staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCPrecontemplation())) {
d14.setStageOfChangeAddictions("1");
} else if ("T".equals(staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCContemplation())) {
d14.setStageOfChangeAddictions("2");
} else if ("T".equals(staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCAction())) {
d14.setStageOfChangeAddictions("3");
} else if ("T".equals(staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCMaintenance())) {
d14.setStageOfChangeAddictions("4");
} else if ("T".equals(staff.getC14OtherAddictionsDoYouHaveAnAddictionIsYourAddictionAProblem().getCIndicateTheStageOfChangeClientIsAtOptionalSelectOne().getCRelapsePrevention())) {
d14.setStageOfChangeAddictions("5");
}
Domain d15 = createCommonDomain(of, "15-company",
staff.getC15CompanyAreYouHappyWithYourSocialLifeDoYouWishYouHadMoreContactWithOthers().getC1DoesThePersonNeedHelpWithSocialContactIfRated0Or9SkipQuestions23AndPr(),
client.getCQuestions().getC15CompanyAreYouHappyWithYourSocialLife().getAnswerGroup(),
staff.getC15CompanyAreYouHappyWithYourSocialLifeDoYouWishYouHadMoreContactWithOthers().getC2HowMuchHelpWithAddictionsDoesThePersonReceiveFromFriendsOrRelatives(),
staff.getC15CompanyAreYouHappyWithYourSocialLifeDoYouWishYouHadMoreContactWithOthers().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesInOrganizingSocialContact(),
staff.getC15CompanyAreYouHappyWithYourSocialLifeDoYouWishYouHadMoreContactWithOthers().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesInOrganizingSocialContact());
ods.getDomain().add(d15);
if ("T".equals(staff.getC15CompanyAreYouHappyWithYourSocialLifeDoYouWishYouHadMoreContactWithOthers().getCHaveThereBeenAnyChangesToYourSocialPatternsRecently().getCYes())) {
d15.setChangedSocialPatterns("TRUE");
} else if ("T".equals(staff.getC15CompanyAreYouHappyWithYourSocialLifeDoYouWishYouHadMoreContactWithOthers().getCHaveThereBeenAnyChangesToYourSocialPatternsRecently().getCNo())) {
d15.setChangedSocialPatterns("FALSE");
} else if ("T".equals(staff.getC15CompanyAreYouHappyWithYourSocialLifeDoYouWishYouHadMoreContactWithOthers().getCHaveThereBeenAnyChangesToYourSocialPatternsRecently().getCUnknown())) {
d15.setChangedSocialPatterns("UNK");
} else if ("T".equals(staff.getC15CompanyAreYouHappyWithYourSocialLifeDoYouWishYouHadMoreContactWithOthers().getCHaveThereBeenAnyChangesToYourSocialPatternsRecently().getCClientDeclinedToAnswer())) {
d15.setChangedSocialPatterns("CDA");
}
Domain d16 = createCommonDomain(of, "16-intimate relationships",
staff.getC16IntimateRelationshipsDoYouHaveAPartnerDoYouHaveProblemsInYourPartnershipMar().getC1DoesThisPersonHaveAnyDifficultyInFindingAPartnerOrInMaintainingACloseRelation(),
client.getCQuestions().getC16IntimateRelationshipsDoYouHaveAPartner().getAnswerGroup(),
staff.getC16IntimateRelationshipsDoYouHaveAPartnerDoYouHaveProblemsInYourPartnershipMar().getC2HowMuchHelpWithFormingAndMaintainingCloseRelationshipsDoesThePersonReceiveFrom(),
staff.getC16IntimateRelationshipsDoYouHaveAPartnerDoYouHaveProblemsInYourPartnershipMar().getC3AHowMuchHelpWithFormingAndMaintainingCloseRelationshipsDoesThePersonReceiveFrom(),
staff.getC16IntimateRelationshipsDoYouHaveAPartnerDoYouHaveProblemsInYourPartnershipMar().getC3BHowMuchHelpWithFormingAndMaintainingCloseRelationshipsDoesThePersonNeedFromLo());
ods.getDomain().add(d16);
Domain d17 = createCommonDomain(of, "17-sexual expression",
staff.getC17SexualExpressionHowIsYourSexLife().getC1DoesThePersonHaveProblemsWithHisOrHerSexLifeIfRated0Or9GoToTheNextDom(),
client.getCQuestions().getC17SexualExpressionHowIsYouSexLife().getAnswerGroup(),
staff.getC17SexualExpressionHowIsYourSexLife().getC2HowMuchHelpWithProblemsInHisOrHerSexLifeDoesThePersonReceiveFromFriendsOrR(),
staff.getC17SexualExpressionHowIsYourSexLife().getC3AHowMuchHelpWithProblemsInHisOrHerSexLifeDoesThePersonReceiveFromLocalServi(),
staff.getC17SexualExpressionHowIsYourSexLife().getC3BHowMuchHelpWithProblemsInHisOrHerSexLifeDoesThePersonNeedFromLocalServices());
ods.getDomain().add(d17);
Domain d18 = createCommonDomain(of, "18-childcare",
staff.getC18ChildCareDoYouHaveAnyChildrenUnder18DoYouHaveAnyDifficultInLookingAfterT().getC1DoesThePersonHaveDifficultyLookingAfterHisOrHerChildrenIfRated0Or9GoToT(),
client.getCQuestions().getC18ChildCareDoYouHaveAnyChildrenUnder18().getAnswerGroup(),
staff.getC18ChildCareDoYouHaveAnyChildrenUnder18DoYouHaveAnyDifficultInLookingAfterT().getC2HowMuchHelpWithLookingAfterTheChildrenDoesThePersonReceiveFromFriendsOrRelati(),
staff.getC18ChildCareDoYouHaveAnyChildrenUnder18DoYouHaveAnyDifficultInLookingAfterT().getC3AHowMuchHelpWithLookingAfterTheChildrenDoesThePersonReceiveFromLocalServices(),
staff.getC18ChildCareDoYouHaveAnyChildrenUnder18DoYouHaveAnyDifficultInLookingAfterT().getC3BHowMuchHelpWithLookingAfterTheChildrenDoesThePersonNeedFromLocalServices());
ods.getDomain().add(d18);
Domain d19 = createCommonDomain(of, "19-other dependents",
staff.getC19OtherDependentsDoYouHaveAnyDependentsOtherThanChildrenUnder18SuchAsAnElder().getC1DoesThePersonHaveDifficultyLookingAfterOtherDependentsIfRates0Or9GoToThe(),
client.getCQuestions().getC19OtherDependentsDoYouHaveAnyDependentsOtherThanChildrenUnder18SuchAsAnElder().getAnswerGroup(),
staff.getC19OtherDependentsDoYouHaveAnyDependentsOtherThanChildrenUnder18SuchAsAnElder().getC2HowMuchHelpWithLookingAfterOtherDependentsDoesThePersonReceiveFromFriendsOrRe(),
staff.getC19OtherDependentsDoYouHaveAnyDependentsOtherThanChildrenUnder18SuchAsAnElder().getC3AHowMuchHelpWithLookingAfterOtherDependentsDoesThePersonReceiveFromLocalServic(),
staff.getC19OtherDependentsDoYouHaveAnyDependentsOtherThanChildrenUnder18SuchAsAnElder().getC3BHowMuchHelpWithLookingAfterOtherDependentsDoesThePersonNeedFromLocalServices());
ods.getDomain().add(d19);
Domain d20 = createCommonDomain(of, "20-basic education",
staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getC1DoesThePersonLackBasicSkillsInNumeracyAndLiteracyIfRated0Or9SkipQuestions(),
client.getCQuestions().getC20BasicEducationAnyDifficultyInReadingWritingOrUnderstandingEnglish().getAnswerGroup(),
staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getC2HowMuchHelpWithNumeracyAndLiteracyDoesThePersonReceiveFromFriendsOrRelatives(),
staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getC3AHowMuchHelpWithNumeracyAndLiteracyDoesThePersonReceiveFromLocalServices(),
staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getC3BHowMuchHelpWithNumeracyAndLiteracyDoesThePersonNeedFromLocalServices());
ods.getDomain().add(d20);
if ("T".equals(staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getCWhatIsYourHighestLevelOfEducationSelectOne().getCNoFormalSchooling())) {
d20.setHighestEducationLevel("224304004");
} else if ("T".equals(staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getCWhatIsYourHighestLevelOfEducationSelectOne().getCSomeElementaryJuniorHighSchool())) {
d20.setHighestEducationLevel("HLES-2");
} else if ("T".equals(staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getCWhatIsYourHighestLevelOfEducationSelectOne().getCElementaryJuniorHighSchool())) {
d20.setHighestEducationLevel("224306002");
} else if ("T".equals(staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getCWhatIsYourHighestLevelOfEducationSelectOne().getCSomeSecondaryHighSchool())) {
d20.setHighestEducationLevel("HLES-4");
} else if ("T".equals(staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getCWhatIsYourHighestLevelOfEducationSelectOne().getCSecondaryHighSchool())) {
d20.setHighestEducationLevel("224308001");
} else if ("T".equals(staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getCWhatIsYourHighestLevelOfEducationSelectOne().getCSomeCollegeUniversity())) {
d20.setHighestEducationLevel("HLES-6");
} else if ("T".equals(staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getCWhatIsYourHighestLevelOfEducationSelectOne().getCCollegeUniversity())) {
d20.setHighestEducationLevel("224871002");
} else if ("T".equals(staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getCWhatIsYourHighestLevelOfEducationSelectOne().getCUnknown())) {
d20.setHighestEducationLevel("261665006");
} else if ("T".equals(staff.getC20BasicEducationDoYouHaveDifficultyInReadingWritingSpeakingOrUnderstandingEngl().getCWhatIsYourHighestLevelOfEducationSelectOne().getCClientDeclinedToAnswer())) {
d20.setHighestEducationLevel("CDA");
}
Domain d21 = createCommonDomain(of, "21-telephone",
staff.getC21TelephoneDoYouKnowHowToUseATelephoneIsItEasyToFindOneThatYouCanUse().getC1DoesThePersonHaveDifficultyInGettingAccessToOrUsingATelephoneIfRated0Or9(),
client.getCQuestions().getC21TelephoneDoYouKnowHowToUseATelephone().getAnswerGroup(),
staff.getC21TelephoneDoYouKnowHowToUseATelephoneIsItEasyToFindOneThatYouCanUse().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesToMakeTelephoneCalls(),
staff.getC21TelephoneDoYouKnowHowToUseATelephoneIsItEasyToFindOneThatYouCanUse().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesToMakeTelephoneCalls(),
staff.getC21TelephoneDoYouKnowHowToUseATelephoneIsItEasyToFindOneThatYouCanUse().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesToMakeTelephoneCalls());
ods.getDomain().add(d21);
Domain d22 = createCommonDomain(of, "22-transport",
staff.getC22TransportDoYouHaveAccessToTransportationDoYouHaveAccessToOtherAffordableTra().getC1DoesThePersonHaveAnyProblemsUsingPublicTransportIfRated0Or9GoToTheNextD(),
client.getCQuestions().getC22TransportHowDoYouFindUsingTheBusStreetcarOrTrain().getAnswerGroup(),
staff.getC22TransportDoYouHaveAccessToTransportationDoYouHaveAccessToOtherAffordableTra().getC2HowMuchHelpWithTravellingDoesThePersonReceiveFromFriendsOrRelatives(),
staff.getC22TransportDoYouHaveAccessToTransportationDoYouHaveAccessToOtherAffordableTra().getC3AHowMuchHelpWithTravellingDoesThePersonReceiveFromLocalServices(),
staff.getC22TransportDoYouHaveAccessToTransportationDoYouHaveAccessToOtherAffordableTra().getC3BHowMuchHelpWithTravellingDoesThePersonNeedFromLocalServices());
ods.getDomain().add(d22);
Domain d23 = createCommonDomain(of, "23-money",
staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getC1DoesThePersonHaveProblemsBudgetingHisOrHerMoneyIfRated0Or9SkipQuestions2(),
client.getCQuestions().getC23MoneyHowDoYouFindBudgetingYourMoney().getAnswerGroup(),
staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesInManagingHisOrHerMoney(),
staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesInManagingHisOrHerMoney(),
staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesInManagingHisOrHerMoney());
ods.getDomain().add(d23);
if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCEmployment())) {
d23.setSourceOfIncome("031-01");
} else if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCEmploymentInsurance())) {
d23.setSourceOfIncome("031-02");
} else if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCPension())) {
d23.setSourceOfIncome("031-03");
} else if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCODSP())) {
d23.setSourceOfIncome("031-04");
} else if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCSocialAssistance())) {
d23.setSourceOfIncome("031-05");
} else if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCDisabilityAssistance())) {
d23.setSourceOfIncome("031-06");
} else if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCFamily())) {
d23.setSourceOfIncome("031-07");
} else if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCNoSourceOfIncome())) {
d23.setSourceOfIncome("031-08");
} else if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCOther())) {
d23.setSourceOfIncome("031-09");
} else if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCUnknown())) {
d23.setSourceOfIncome("031-10");
} else if ("T".equals(staff.getC23MoneyHowDoYouFindBudgetingYourMoneyDoYouManageToPayYourBills().getCWhatIsYourPrimarySourceOfIncomeSelectOne().getCClientDeclinedToAnswer())) {
d23.setSourceOfIncome("031-11");
}
Domain d24 = createCommonDomain(of, "24-benefits",
staff.getC24BenefitsAreYouSureThatYouAreGettingAllTheMoneyThatYouAreEntitledTo().getC1IsThePersonDefinitelyReceivingAllTheBenefitsThatHeOrSheIsEntitledToIfRated(),
client.getCQuestions().getC24BenefitsAreYouGettingAllTheMoneyYouAreEntitledTo().getAnswerGroup(),
staff.getC24BenefitsAreYouSureThatYouAreGettingAllTheMoneyThatYouAreEntitledTo().getC2HowMuchHelpDoesThePersonReceiveFromFriendsOrRelativesInObtainingTheFullBenefi(),
staff.getC24BenefitsAreYouSureThatYouAreGettingAllTheMoneyThatYouAreEntitledTo().getC3AHowMuchHelpDoesThePersonReceiveFromLocalServicesInObtainingTheFullBenefitEnt(),
staff.getC24BenefitsAreYouSureThatYouAreGettingAllTheMoneyThatYouAreEntitledTo().getC3BHowMuchHelpDoesThePersonNeedFromLocalServicesInObtainingFullBenefitEntitlemen());
ods.getDomain().add(d24);
// end of 24 Domains
AdditionalElements ae = of.createAdditionalElements();
r1.setAdditionalElements(ae);
// ae.setClientHopesForFuture(client.getCQuestions().getCPleaseWriteAFewSentencesToAnswerTheFollowingQuestions().getCWhatAreYourHopesForTheFuture());
// ae.setClientNeedToGetThere(client.getCQuestions().getCPleaseWriteAFewSentencesToAnswerTheFollowingQuestions().getCWhatDoYouThinkYouNeedInOrderToGetThere());
// ae.setClientViewMentalHealth(client.getCQuestions().getCPleaseWriteAFewSentencesToAnswerTheFollowingQuestions().getCHowDoYouViewYourMentalHealth());
// ae.setClientSpiritualityImportance(client.getCQuestions().getCPleaseWriteAFewSentencesToAnswerTheFollowingQuestions().getCIsSpiritualityAnImportantPartOfYourLife());
// ae.setClientCultureHeritageImportance(client.getCQuestions().getCPleaseWriteAFewSentencesToAnswerTheFollowingQuestions().getCIsCultureHeritageAnImportantPartOfYourLife());
ae.setClientHopesForFuture(staff.getCWhatAreYourHopesForTheFuture().getC());
ae.setClientNeedToGetThere(staff.getCWhatDoYouThinkYouNeedInOrderToGetThere().getC());
ae.setClientViewMentalHealth(staff.getCHowDoYouViewYourMentalHealth().getC());
ae.setClientSpiritualityImportance(staff.getCIsSpiritualityAnImportantPartOfYourLife().getC());
ae.setClientCultureHeritageImportance(staff.getCWhatCultureDoYouIdentifyWith().getC());
PresentingIssueList pil = of.createPresentingIssueList();
ae.setPresentingIssueList(pil);
if ("T".equals(staff.getCPresentingIssues().getCThreatToOthersAttemptedSuicide())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-01");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCSpecificSymptomOfSeriousMentalIllness())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-02");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCPhysicalSexualAbuse())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-03");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCEducational())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-04");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCOccupationalEmploymentVocational())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-05");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCHousing())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-06");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCFinancial())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-07");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCLegal())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-08");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCProblemsWithRelationships())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-09");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCProblemsWithSubstanceAbuseAddictions())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-10");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCActivitiesOfDailyLiving())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-11");
pil.getPresentingIssue().add(pi1);
}
if ("T".equals(staff.getCPresentingIssues().getCOther())) {
PresentingIssue pi1 = of.createPresentingIssue();
pi1.setType("017-12");
pil.getPresentingIssue().add(pi1);
}
ActionList al = of.createActionList();
ae.setActionList(al);
List<JAXBElement<? extends Serializable>> actions = staff.getCSummaryOfActions().getCActionsOrCDomainOrCPriority();
String [] duo = new String[2];
placed = 0;
for (JAXBElement<? extends Serializable> e : actions) {
if ("CPriority_".equals(e.getName().toString())) {
duo[0] = e.getValue().toString();
placed++;
}
if ("CDomain_".equals(e.getName().toString())) {
duo[1] = e.getValue().toString();
placed++;
}
if (placed == 2) {
Action a1 = of.createAction();
// dic item!
a1.setDomain(duo[0]);
a1.setPriority(duo[1]);
al.getAction().add(a1);
placed = 0;
}
}
ReferralList rl = of.createReferralList();
ae.setReferralList(rl);
List<JAXBElement<String>> referrals = staff.getCSummaryOfReferrals().getCSpecifyOrCActualReferralOrCOptimalReferral();
String [] six = new String[6];
placed = 0;
for (JAXBElement<String> e : referrals) {
if ("COptimal_Referral_".equals(e.getName().toString())) {
six[0] = e.getValue().toString();
placed++;
}
if ("CSpecify".equals(e.getName().toString())) {
if (placed == 1) {
six[1] = e.getValue().toString();
placed++;
}
if (placed == 3) {
six[3] = e.getValue().toString();
placed++;
}
}
if ("CActual_Referral_".equals(e.getName().toString())) {
six[2] = e.getValue().toString();
placed++;
}
if ("CReasons_for_Difference_".equals(e.getName().toString())) {
six[4] = e.getValue().toString();
placed++;
}
if ("CReferral_Status_".equals(e.getName().toString())) {
six[5] = e.getValue().toString();
placed++;
}
if (placed == 6) {
// dic items (all 6)!
Referral re1 = of.createReferral();
re1.setOptimal(six[0]);
re1.setSpecifyOptimal(six[1]);
re1.setActual(six[2]);
re1.setSpecifyActual(six[3]);
re1.setDifferenceReason(six[4]);
re1.setStatus(six[5]);
rl.getReferral().add(re1);
placed = 0;
}
}
process.file.getOCANSubmissionRecord().add(r1);
return r1;
}
private static MedicationDetail createMedicationDetail(ObjectFactory of, String tap, String ihp, String ihn) {
MedicationDetail md = of.createMedicationDetail();
md.setTakenAsPrescribed("Yes".equals(tap)?"TRUE":("No".equals(tap)?"FALSE":"UNK"));
md.setIsHelpProvided("Yes".equals(ihp)?"TRUE":("No".equals(ihp)?"FALSE":"UNK"));
md.setIsHelpNeeded("Yes".equals(ihn)?"TRUE":("No".equals(ihn)?"FALSE":"UNK"));
return md;
}
private static Domain createCommonDomain(ObjectFactory of, String name, Object _nrs, AnswerGroup _nrc, Object _ihr, Object _fhr, Object _fhn) {
Domain d = of.createDomain();
d.setName(name);
NeedRating nr = of.createNeedRating();
nr.setStaff(_nrs instanceof String ? Byte.valueOf((String)_nrs) : ((BigInteger)_nrs).byteValue());
byte b_nrc = 0;
if ("T".equals(_nrc.getCNoNeed())) {
b_nrc = 1;
} else if ("T".equals(_nrc.getCMetNeed())) {
b_nrc = 2;
} else if ("T".equals(_nrc.getCUnmetNeed())) {
b_nrc = 9;
} else {
b_nrc = -1;
}
nr.setClient(b_nrc);
d.setNeedRating(nr);
InformalHelpRecvd ihr = of.createInformalHelpRecvd();
ihr.setStaff(Byte.valueOf(_ihr instanceof String ? Byte.valueOf((String)_ihr) : ((BigInteger)_ihr).byteValue()));
d.setInformalHelpRecvd(ihr);
FormalHelpRecvd fhr = of.createFormalHelpRecvd();
fhr.setStaff(Byte.valueOf(_fhr instanceof String ? Byte.valueOf((String)_fhr) : ((BigInteger)_fhr).byteValue()));
d.setFormalHelpRecvd(fhr);
FormalHelpNeed fhn = of.createFormalHelpNeed();
fhn.setStaff(Byte.valueOf(_fhn instanceof String ? Byte.valueOf((String)_fhn) : ((BigInteger)_fhn).byteValue()));
d.setFormalHelpNeed(fhn);
return d;
}
private <T> JAXBElement<T> wrap(String ns, String tag, T o) {
QName qtag = new QName(ns, tag);
Class<?> clazz = o.getClass();
@SuppressWarnings("unchecked")
JAXBElement<T> jbe = new JAXBElement(qtag, clazz, o);
return jbe;
}
@SuppressWarnings("unchecked")
private <T> T unmarshal(Class<T> docClass, InputStream inputStream)
throws JAXBException {
String packageName = docClass.getPackage().getName();
JAXBContext jc = JAXBContext.newInstance( packageName );
Unmarshaller u = jc.createUnmarshaller();
return (T) u.unmarshal( inputStream );
}
private void marshal(Object doc, String name) throws FileNotFoundException, JAXBException {
/* Class<T> clazz = document.getValue().getClass(); */
JAXBContext jc = JAXBContext.newInstance("oscar.ocan.domain.submission"
/* clazz.getPackage().getName() */);
Marshaller m = jc.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
FileOutputStream os = new FileOutputStream(name);
m.marshal(doc, os);
try {
os.close();
} catch (Exception ignored) {}
}
public void setServiceOrganizationNumber(String serviceOrganizationNumber) {
this.serviceOrganizationNumber = serviceOrganizationNumber;
}
public void setSubmissionFileLocation(String submissionFileLocation) {
this.submissionFileLocation = submissionFileLocation;
}
}
| gpl-2.0 |
rkferreira/tools | match_network_acl/match_network_acl.py | 10403 | #!/usr/bin/python
##################
# Find CISCO ACLs
# You probably should adjust guessFile function, if you want.
# That is based on my file format, maybe not same as yours.
# Rodrigo Kellermann Ferreira
# rkferreira@gmail.com
import ipaddress as ip
import re as re
import sys, os, subprocess
from optparse import OptionParser
exp1 = re.compile('(permit|deny) (ip|tcp|udp) host [0-9]{1,3}\..*.host [0-9]{1,3}\..*', re.IGNORECASE)
exp2 = re.compile('(permit|deny) (ip|tcp|udp) [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*.host [0-9]{1,3}\..*', re.IGNORECASE)
exp3 = re.compile('(permit|deny) (ip|tcp|udp) host [0-9]{1,3}\..*.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*', re.IGNORECASE)
exp4 = re.compile('(permit|deny) (ip|tcp|udp) [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*', re.IGNORECASE)
exp5 = re.compile('(permit|deny) (ip|tcp|udp) any.*.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*', re.IGNORECASE)
exp6 = re.compile('(permit|deny) (ip|tcp|udp) [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*.any.*', re.IGNORECASE)
exp7 = re.compile('(permit|deny) (ip|tcp|udp) host [0-9]{1,3}\..*.any.*', re.IGNORECASE)
exp8 = re.compile('(permit|deny) (ip|tcp|udp) any.*.host [0-9]{1,3}\..*', re.IGNORECASE)
exp9 = re.compile('(permit|deny) (ip|tcp|udp) any.*.any.*', re.IGNORECASE)
URL_FILTERS = 'https://filters.mydomain.com/'
FILTERS_POPS = ['DATACENTER01','DATACENTER02','DATACENTER03']
def download(dirprefix=None, abspath=None):
if (not(dirprefix) and not(abspath)):
dest = '.'
else:
if dirprefix:
dest = './'+dirprefix+'/'
else:
dest = '.'+abspath+'/'
for i in FILTERS_POPS:
tgt_url = URL_FILTERS+i+'/invalid/ipv4/'
cmd = 'cd '+dest+' ; '+'wget -A \'*.txt\' -r -nH --cut-dirs=3 '+tgt_url+' --no-check-certificate'
output = os.system(cmd)
if output:
print "something went wront downloading, try it manually. I'm exiting now, see you."
sys.exit(1)
tgt_url = URL_FILTERS+i+'/valid/ipv4/'
cmd = 'cd '+dest+' ; '+'wget -A \'*.txt\' -r -nH --cut-dirs=3 '+tgt_url+' --no-check-certificate'
output = os.system(cmd)
if output:
print "something went wront downloading, try it manually. I'm exiting now, see you."
sys.exit(1)
sys.exit(0)
def guessFile(vlan, dirprefix=None, abspath=None):
#default format v2513-BK_name-BACK_DC01_vl2513_out.txt
#DC01-BK-2513-OUT
parts = vlan.split('-')
strVlan = '.*'+str(parts[2])+'-'+str(parts[1])+'.*.'+str(parts[0])+'.*.'+str(parts[3])+'.*'
expVlan = re.compile(strVlan, re.IGNORECASE)
if (not(dirprefix) and not(abspath)):
proc = subprocess.Popen('ls -1 *.txt', stdout=subprocess.PIPE, shell=True)
if dirprefix:
cmd = 'ls -1 ./'+dirprefix+'/*.txt'
#files = os.system(cmd)
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
else:
if abspath:
cmd = 'ls -1 .'+abspath+'/*.txt'
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
#files = os.system(cmd)
files = list(proc.stdout.readlines())
for f in files:
if expVlan.match(f):
print '#### '+f.rstrip('\n')+' ####\n'
return f.rstrip('\n')
return None
def readFile(f):
fd = open(f, 'r')
txt = fd.readlines()
fd.close()
return txt
def findNetRange(netrange, acl):
if netrange:
netrange = ip.ip_interface(unicode(netrange))
ipandwildcard = str(netrange.ip) + " " + str(netrange.hostmask)
else:
ipandwildcard = None
if exp2.match(acl):
strToFind = '(permit|deny) (ip|tcp|udp) '+str(ipandwildcard)+'.*.host [0-9]{1,3}\..*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 3 " + i
print acl.rstrip('\n')
if exp3.match(acl):
strToFind = '(permit|deny) (ip|tcp|udp) host [0-9]{1,3}\..*.'+str(ipandwildcard)+'.*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 6 " + i
print acl.rstrip('\n')
if exp4.match(acl):
strToFind = '(permit|deny) (ip|tcp|udp) '+str(ipandwildcard)+'.*.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 7 " + i
print acl.rstrip('\n')
else:
strToFind = '(permit|deny) (ip|tcp|udp) [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*.'+str(ipandwildcard)+'.*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 8 " + i
print acl.rstrip('\n')
if exp5.match(acl):
strToFind = '(permit|deny) (ip|tcp|udp) any.*.'+str(ipandwildcard)+'.*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 9 " + i
print acl.rstrip('\n')
if exp6.match(acl):
strToFind = '(permit|deny) (ip|tcp|udp) '+str(ipandwildcard)+'.*.any.*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 10 " + i
print acl.rstrip('\n')
return ""
def findIP(listipaddr, acl):
for ipaddr in listipaddr:
if exp1.match(acl):
strToFind = '(permit|deny) (ip|tcp|udp) host '+ipaddr+'.*.host [0-9]{1,3}\..*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 1 " + i
print acl.rstrip('\n')
else:
strToFind = '(permit|deny) (ip|tcp|udp) host [0-9]{1,3}\..*.host '+ipaddr+'.*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 2 " + i
print acl.rstrip('\n')
if exp2.match(acl):
strToFind = '(permit|deny) (ip|tcp|udp) [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*.host '+ipaddr+'.*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 4 " + i
print acl.rstrip('\n')
if exp3.match(acl):
strToFind = '(permit|deny) (ip|tcp|udp) host '+ipaddr+'.*.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 5 " + i
print acl.rstrip('\n')
if exp7.match(acl):
strToFind = '(permit|deny) (ip|tcp|udp) host '+ipaddr+'.*.any.*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 11 " + i
print acl.rstrip('\n')
if exp8.match(acl):
strToFind = '(permit|deny) (ip|tcp|udp) any.*.host '+ipaddr+'.*'
expToFind = re.compile(strToFind, re.IGNORECASE)
if expToFind.match(acl):
#print "####### 12 " + i
print acl.rstrip('\n')
if exp9.match(acl):
#print "####### 13 " + i
print acl.rstrip('\n')
return ""
def helpTxt(option, opt, value, parser):
print "\n-i/--ip --> find exactly this ip address. input format eg.: 10.1.1.1"
print "-r/--range --> find a line that matchs the range. input format eg.: 10.1.1.0/24 \n It will find for 10.1.1.0 0.0.0.255"
print "-a/--allips --> find all ips from a range line. input format eg.: 10.1.1.0/30 \n It will find for 10.1.1.1 and 10.1.1.2"
print "-f/--file --> file name/path \n"
print "-v/--vlan --> I'll guest the file name based on vlan number. input format eg.: DC01-BK-2559-OUT \n It will find for vlan 2559 in datacenter rules DC01 and it is backnet BK"
print "-d/--download --> I'll download acl files from site, so I can parse later. You must have ~/.wgetrc configured correctly \n"
sys.exit(0)
def main():
ipaddr = []
netrange = None
file = None
vlan = None
#file = "test.txt"
parser = OptionParser()
parser.add_option("-i", "--ip", dest="ipaddr", help="find exactly this ip address (eg.: 10.1.1.1)")
parser.add_option("-r", "--range", dest="netrange", help="find a line that matchs the range (eg.: 10.1.1.0/24)")
parser.add_option("-a", "--allips", dest="allips", help="find all ips from a range line (eg.: 10.1.1.0/24)")
parser.add_option("-f", "--file", dest="file", help="file name/path where are the rules)")
parser.add_option("-v", "--vlan", dest="vlan", help="saying this I'm going to guess the file. Yes, I know how todo magic!")
parser.add_option("-d", "--download", action="store_true", dest="download", help="download acl files, must be called alone. Just --prefix and --abspath are supported for that", default=False)
parser.add_option("--prefixdir", dest="prefixdir", help="prefix for opening or downloadin files")
parser.add_option("--abspath", dest="abspath", help="absolute path for opening or downloading files")
parser.add_option("-?", action="callback", callback=helpTxt, help="detailed help. -h/--help also work")
(options, args) = parser.parse_args()
if (not(options.ipaddr) and not(options.netrange) and not(options.allips) and not(options.download)):
helpTxt("","","","")
if options.download:
print "I'll just download, no combined options are possible. Just --prefix and --abspath for saving those files."
download(options.prefixdir, options.abspath)
if not(options.file) and not(options.vlan):
print "let me know the FILE I should check, I'm a dummy script.\nCall again using -f/--file or -v/--vlan\n"
sys.exit(0)
else:
if options.file:
file = options.file
else:
file = None
vlan = options.vlan
if vlan:
file = guessFile(vlan, options.prefixdir, options.abspath)
if not(file):
print "I couldnt get the file for parse, please check vlan parameters. Maybe you should download before."
if options.ipaddr:
ipaddr.append(options.ipaddr)
if options.allips:
for i in ip.ip_network(unicode(options.allips)):
ipaddr.append(str(i))
if options.netrange:
netrange = options.netrange
res = readFile(file)
if len(ipaddr) >= 1:
print "Finding lines for "+str(len(ipaddr))+" ips... \n Maybe you can get dup lines, if there is more than one ip, \"any\" matchs every one, try \"sort\" and \"uniq\" the output.\n"
if netrange:
print "Finding lines for 1 range..."
for idx, i in enumerate(res):
if netrange:
got = findNetRange(netrange, i)
if ipaddr:
got = findIP(ipaddr, i)
if __name__ == "__main__":
main()
| gpl-2.0 |
bvcms/bvcms | CmsWeb/Areas/Main/Controllers/UserPrefController.cs | 1242 | using CmsData;
using CmsWeb.Lifecycle;
using System.Linq;
using System.Web.Mvc;
namespace CmsWeb.Areas.Main.Controllers
{
[RouteArea("Main", AreaPrefix = "UserPref"), Route("{action}/{id?}")]
public class UserPrefController : CmsStaffController
{
public UserPrefController(IRequestManager requestManager) : base(requestManager)
{
}
[Route("~/UserPref")]
public ActionResult Index()
{
return View();
}
[Route("Set/{id}/{value}")]
public ActionResult Set(string id, string value)
{
CurrentDatabase.SetUserPreference(id, value);
return Content($"set {id}: {value}");
}
[Route("UnSet/{id}")]
public ActionResult UnSet(string id)
{
var p =
CurrentDatabase.Preferences.SingleOrDefault(
pp => pp.UserId == CurrentDatabase.CurrentUser.UserId && pp.PreferenceX == id);
if (p == null)
{
return Message(id + " not found");
}
CurrentDatabase.Preferences.DeleteOnSubmit(p);
CurrentDatabase.SubmitChanges();
return Message("unset " + id);
}
}
}
| gpl-2.0 |
dmyerson/d8ecs | sites/default/files/php/twig/ff165d8e_field--node--created.html.twig_b2b61160843a714fbe06862da1c13fe079610f7c2ac2087d4cc3c8f6ecb4749b/17e289f03015c0cfff0e0e758c6cca3a3a1917fb6cecfdcd7803f8781b2ee35e.php | 3523 | <?php
/* core/themes/classy/templates/field/field--node--created.html.twig */
class __TwigTemplate_fc8252413f26e74069a9e99aa2b361a156187645fdfebfb2b5aa8c0f0b619ba1 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 23
$context["classes"] = array(0 => "field", 1 => ("field--name-" . \Drupal\Component\Utility\Html::getClass( // line 25
(isset($context["field_name"]) ? $context["field_name"] : null))), 2 => ("field--type-" . \Drupal\Component\Utility\Html::getClass( // line 26
(isset($context["field_type"]) ? $context["field_type"] : null))), 3 => ("field--label-" . // line 27
(isset($context["label_display"]) ? $context["label_display"] : null)));
// line 30
echo "<span";
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["attributes"]) ? $context["attributes"] : null), "addClass", array(0 => (isset($context["classes"]) ? $context["classes"] : null)), "method"), "html", null, true);
echo ">";
// line 31
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable((isset($context["items"]) ? $context["items"] : null));
foreach ($context['_seq'] as $context["_key"] => $context["item"]) {
// line 32
echo $this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute($context["item"], "content", array()), "html", null, true);
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['item'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 34
echo "</span>
";
}
public function getTemplateName()
{
return "core/themes/classy/templates/field/field--node--created.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 38 => 34, 32 => 32, 28 => 31, 24 => 30, 22 => 27, 21 => 26, 20 => 25, 19 => 23,);
}
}
/* {#*/
/* /***/
/* * @file*/
/* * Theme override for the node created field.*/
/* **/
/* * This is an override of field.html.twig for the node created field. See that*/
/* * template for documentation about its details and overrides.*/
/* **/
/* * Available variables:*/
/* * - attributes: HTML attributes for the containing span element.*/
/* * - items: List of all the field items. Each item contains:*/
/* * - attributes: List of HTML attributes for each item.*/
/* * - content: The field item content.*/
/* * - entity_type: The entity type to which the field belongs.*/
/* * - field_name: The name of the field.*/
/* * - field_type: The type of the field.*/
/* * - label_display: The display settings for the label.*/
/* **/
/* * @see field.html.twig*/
/* *//* */
/* #}*/
/* {%*/
/* set classes = [*/
/* 'field',*/
/* 'field--name-' ~ field_name|clean_class,*/
/* 'field--type-' ~ field_type|clean_class,*/
/* 'field--label-' ~ label_display,*/
/* ]*/
/* %}*/
/* <span{{ attributes.addClass(classes) }}>*/
/* {%- for item in items -%}*/
/* {{ item.content }}*/
/* {%- endfor -%}*/
/* </span>*/
/* */
| gpl-2.0 |
dook-studio/dookcms | DookCMS/WebUI/Crm/upload.aspx.cs | 5061 | using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Collections.Generic;
public partial class upload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
// Get the data
string file_id = Request.QueryString["file_id"] as string;
HttpPostedFile jpeg_image_upload = Request.Files["Filedata"];
//string photobid = Request.Cookies["photobid"].Value;
string UploadPath = Server.MapPath("~/upload/photos/" + DateTime.Now.ToString("yyyy\\/MM\\/dd")) + "/";
string httpPath = "/upload/photos/" + DateTime.Now.ToString("yyyy\\/MM\\/dd") + "/";
if(!Directory.Exists(UploadPath))
Directory.CreateDirectory(UploadPath);
System.Drawing.Image originalImage = System.Drawing.Image.FromStream(jpeg_image_upload.InputStream);
int thisWidth = originalImage.Width;
int thisHeight = originalImage.Height;
int solidW =thisWidth>670?670:thisWidth;
int solidH =thisHeight>503?503:thisHeight;
string mode="W";
mode = thisWidth>thisHeight ? "W" : "H";
string picId = DateTime.Now.ToString("yyMMddHHssfff");
string filename = picId + ".jpg";
StringHelper.MakeThumbnail(originalImage, filename, UploadPath, solidW, solidH,mode);
////Éú³ÉÖ±·½Í¼500*500
//System.Drawing.Image bigImage = System.Drawing.Image.FromStream(jpeg_image_upload.InputStream);
//string upBigPath = Server.MapPath("/upload/") + MyWeb.instance.userId + "/pic/";
//if (!Directory.Exists(upBigPath))
// Directory.CreateDirectory(upBigPath);
//int solidW2 = thisWidth > 500 ? 500 : thisWidth;
//int solidH2 = thisHeight > 500 ? 500 : thisHeight;
//StringHelper.MakeThumbnail(bigImage, filename, upBigPath, solidW2, solidH2, mode);
////Éú³ÉËõÂÔͼ85*85
//System.Drawing.Image thumbImage = System.Drawing.Image.FromStream(jpeg_image_upload.InputStream);
//string upThumbPath = Server.MapPath("/upload/") + MyWeb.instance.userId + "/thumb/";
//if (!Directory.Exists(upThumbPath))
// Directory.CreateDirectory(upThumbPath);
//int solidW3 = thisWidth > 85 ? 85 : thisWidth;
//int solidH3 = thisHeight > 85 ? 85 : thisHeight;
//StringHelper.MakeThumbnail(thumbImage, filename, upThumbPath, solidW3, solidH3, mode);
////²éѯ¼Ç¼
//string[] paras = new string[7];
//paras[0] = picId;
//paras[1] = MyWeb.instance.userId;
//paras[2] = jpeg_image_upload.FileName;
//paras[3] = filename;
//paras[4] = "";
//paras[5] = "";
//paras[6] = albumId;
//BOL.Photos.instance.Insert(paras);
//}
// Session.Clear();
//}
int photobid =0;
if(Request.Cookies["photobid"]!=null)
{
int.TryParse(Request.Cookies["photobid"].Value,out photobid);
}
Dukey.Model.Photos model = new Dukey.Model.Photos();
model.title = jpeg_image_upload.FileName;
model.brief = "";
model.imgurl = httpPath + filename;
model.bid = photobid;
model.isshow = true;
model.dots = 0;
model.px = 0;
model.iscomment = true;
model.addtime = DateTime.Now;
model.uptime = DateTime.Now;
model.adminId = BaseWeb.instance.AdminId;
model.userId = 0;
new BLL.Photos().Add(model);
}
catch (Exception ex)
{
// If any kind of error occurs return a 500 Internal Server error
Response.StatusCode = 500;
Response.Write(ex.ToString());
Response.End();
}
}
}
//public class Thumbnail
//{
// public Thumbnail(string file_id, byte[] data)
// {
// this.FileID = file_id;
// this.Data = data;
// }
// private string file_id;
// public string FileID
// {
// get
// {
// return this.file_id;
// }
// set
// {
// this.file_id = value;
// }
// }
// private byte[] thumbnail_data;
// public byte[] Data
// {
// get
// {
// return this.thumbnail_data;
// }
// set
// {
// this.thumbnail_data = value;
// }
// }
//}
| gpl-2.0 |
huhuanming/PadAdmin-Github | spec/views/informs/new.html.erb_spec.rb | 674 | require 'rails_helper'
RSpec.describe "informs/new", :type => :view do
before(:each) do
assign(:inform, Inform.new(
:company_id => "MyString",
:title => "MyString",
:author => "MyString",
:context => "MyString"
))
end
it "renders new inform form" do
render
assert_select "form[action=?][method=?]", informs_path, "post" do
assert_select "input#inform_company_id[name=?]", "inform[company_id]"
assert_select "input#inform_title[name=?]", "inform[title]"
assert_select "input#inform_author[name=?]", "inform[author]"
assert_select "input#inform_context[name=?]", "inform[context]"
end
end
end
| gpl-2.0 |
makiozmurai/dig-wp | wp-content/themes/albatros/parts_sns.php | 3937 | <?php
$url_encode=urlencode(get_permalink());
$site_title_encode=urlencode(get_home_url());
$title_encode=urlencode(get_the_title());
$tw_url = get_the_author_meta( 'twitter' );
$tw_domain = array("http://twitter.com/"=>"","https://twitter.com/"=>"","//twitter.com/"=>"");
$tw_user = '&via=' . strtr($tw_url , $tw_domain);
$fdly_url = array("http%3A%2F%2F"=>"","https%3A%2F%2F"=>"");
$plainurl= strtr( $site_title_encode, $fdly_url );
?>
<div class="share">
<div class="sns">
<ul class="clearfix">
<!--ツイートボタン-->
<li class="twitter">
<a target="blank" href="http://twitter.com/intent/tweet?url=<?php echo $url_encode ?>&text=<?php echo urlencode( the_title( "" , "" , 0 ) ) ?><?php if(get_the_author_meta('twitter')) : ?><?php echo $tw_user ;?><?php endif ;?>&tw_p=tweetbutton" onclick="window.open(this.href, 'tweetwindow', 'width=550, height=450,personalbar=0,toolbar=0,scrollbars=1,resizable=1'); return false;"><i class="fa fa-twitter"></i><span class="text">Twitter</span><span class="count"><?php if(function_exists('scc_get_share_twitter')) echo (scc_get_share_twitter()==0)?'':scc_get_share_twitter(); ?></span></a>
</li>
<!--Facebookボタン-->
<li class="facebook">
<a href="http://www.facebook.com/share.php?u=<?php the_permalink(); ?>" onclick="window.open(this.href, 'FBwindow', 'width=650, height=450, menubar=no, toolbar=no, scrollbars=yes'); return false;"><i class="fa fa-facebook"></i>
<span class="text">Facebook</span><span class="count"><?php if(function_exists('scc_get_share_facebook')) echo (scc_get_share_facebook()==0)?'':scc_get_share_facebook(); ?></span></a>
</li>
<!--Google+1ボタン-->
<li class="googleplus">
<a href="https://plusone.google.com/_/+1/confirm?hl=ja&url=<?php echo get_permalink() ?>" onclick="window.open(this.href, 'window', 'width=550, height=450,personalbar=0,toolbar=0,scrollbars=1,resizable=1'); return false;" rel="tooltip" data-toggle="tooltip" data-placement="top" title="GooglePlusで共有"><i class="fa fa-google-plus"></i><span class="text">Google+</span><span class="count"><?php if(function_exists('scc_get_share_gplus')) echo (scc_get_share_gplus()==0)?'':scc_get_share_gplus(); ?></span></a>
</li>
<!--はてブボタン-->
<li class="hatebu">
<a href="http://b.hatena.ne.jp/add?mode=confirm&url=<?php the_permalink() ?>&title=<?php echo urlencode( the_title( "" , "" , 0 ) ) ?>" onclick="window.open(this.href, 'HBwindow', 'width=600, height=400, menubar=no, toolbar=no, scrollbars=yes'); return false;" target="_blank"><span class="text">はてブ</span><span class="count"><?php if(function_exists('scc_get_share_hatebu')) echo (scc_get_share_hatebu()==0)?'':scc_get_share_hatebu(); ?></span></a>
</li>
<!--LINEボタン-->
<li class="line">
<a href="http://line.me/R/msg/text/?<?php echo $title_encode . '%0A' . $url_encode;?>"><span class="text">LINE</span></a>
</li>
<!--ポケットボタン-->
<li class="pocket">
<a href="http://getpocket.com/edit?url=<?php the_permalink() ?>&title=<?php the_title(); ?>" onclick="window.open(this.href, 'FBwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;"><i class="fa fa-get-pocket"></i><span class="text">Pocket</span><span class="count"><?php if(function_exists('scc_get_share_pocket')) echo (scc_get_share_pocket()==0)?'':scc_get_share_pocket(); ?></span></a></li>
<!--RSSボタン-->
<li class="rss">
<a href="<?php echo home_url(); ?>/?feed=rss2"><i class="fa fa-rss"></i><span class="text">RSS</span></a></li>
<!--feedlyボタン-->
<li class="feedly">
<a href="http://feedly.com/index.html#subscription%2Ffeed%2Fhttp%3A%2F%2F<?php echo $plainurl ;?>%2Ffeed%2F" target="blank"><i class="fa fa-rss"></i><span class="text">feedly</span><span class="count"><?php if(function_exists('scc_get_follow_feedly')) echo (scc_get_follow_feedly()==0)?'':scc_get_follow_feedly(); ?></span></a></li>
</ul>
</div>
</div> | gpl-2.0 |