* its action called 'display', and we pass a param to select the view file
* to use (in this case, /app/View/Pages/home.ctp)...
*/
- // HOME = PAR DEFAUT
+ // DEFAULT HOME (CAKEPHP PAGE)
//Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
- // HOME = INSTANCES
+ // INSTANCES INDEX AS HOME PAGE
Router::connect('/', array('controller' => 'instances', 'action' => 'index'));
/**
* ...and connect the rest of 'Pages' controller's URLs.
//Router::parseExtensions('json');
- // MODE REFERENCE, POUR CHANGER -> lib/Cake/Routing/Router.php ligne 531
+ // REFERENCE MODE, IN ORDER TO CHANGE IT -> lib/Cake/Routing/Router.php l531
/*Router::resourceMap(array(
array('action' => 'rest_get_all', 'method' => 'GET', 'reference' => false),
array('action' => 'rest_get', 'method' => 'GET', 'reference' => true),
--- /dev/null
+<?php
+ class AdministrateursController extends AppController {
+ public $helpers = array('Html', 'Form');
+ public $components = array('RequestHandler');
+
+ public function index() {
+ $administrateurs = $this->Administrateur->find('all');
+ $this->set(array(
+ 'administrateurs' => $administrateurs,
+ '_serialize' => array('administrateurs')
+ ));
+ }
+
+ public function login() {
+ if ($this->request->is('POST')) {
+ $administrateurs = $this->Administrateur->find('all');
+ $success = false;
+ $login = $_POST['login'];
+ $pass = md5($_POST['pass']);
+ foreach($administrateurs as $administrateur) {
+ if($administrateur['Administrateur']['login'] === $login && $administrateur['Administrateur']['pass'] == $pass) {
+ $success = true;
+ break;
+ }
+ }
+ if ($success) {
+ $this->Session->setFlash(__("Login OK."));
+ return $this->redirect(array(/*'controller' => 'instances', */'action' => 'index'));
+
+ } else {
+ $this->Session->setFlash(__("Login FAIL."));
+ return $this->redirect(array('action' => 'login'));
+ }
+ }
+ }
+
+ public function register() {
+ if ($this->request->is('POST')) {
+ $login = $_POST['login'];
+ // VERIFICATION DE LA DISPONIBILITÉ DU PSEUDO
+ $administrateurs = $this->Administrateur->find('all');
+ $loginDispo = true;
+ foreach($administrateurs as $administrateur) {
+ if($administrateur['Administrateur']['login'] === $login) {
+ $loginDispo = false;
+ break;
+ }
+ }
+ if($loginDispo) {
+ $pass = md5($_POST['pass']);
+ $this->Administrateur->create();
+ $this->Administrateur->value('login', $login);
+ $this->Administrateur->value('pass', $pass);
+ $this->Administrateur->save();
+ if (isset($this->Administrateur)) {
+ $this->Session->setFlash(__("Register OK."));
+ return $this->redirect(array(/*'controller' => 'instances', */'action' => 'index'));
+ }
+ $this->Session->setFlash(__("Register FAIL."));
+ } else {
+ $this->Session->setFlash(__("Ce pseudo est déjà utilisé."));
+ }
+ }
+ }
+ }
--- /dev/null
+<?php
+ class ClientsController extends AppController {
+ public $helpers = array('Html', 'Form');
+ public $components = array('RequestHandler');
+
+ public function index() {
+ $clients = $this->Client->find('all');
+ $this->set(array(
+ 'clients' => $clients,
+ '_serialize' => array('clients')
+ ));
+ }
+
+ public function view($id = null) {
+ if (!$id) {
+ throw new NotFoundException(__('Mauvais client'));
+ }
+
+ $client = $this->Client->findById($id);
+ if (!$client) {
+ throw new NotFoundException(__('Mauvais client'));
+ }
+ $this->set('client', $client);
+ }
+ }
+?>
public $components = array('RequestHandler');
public function index() {
- //$this->set('historiques', $this->Historique->find('all'));
$historiques = $this->Historique->find('all');
$this->set(array(
'historiques' => $historiques,
throw new NotFoundException(__('Historique introuvable'));
}
+ // GETTING THE CHANGELOG OF THE APPLIANCE
$this->Historique->id = $id;
$historique = $this->Historique->findById($id);
if (!$historique) {
}
$this->set('historique', $historique);
- // Récupération des alertes de l'historique
+ // GETTING ALL WARNINGS FROM THE CHANGELOG
if($this->Historique->value('alertes')) {
$alertes_id = explode('|', $this->Historique->value('alertes'));
App::import('Controller', 'Alertes');
foreach ($alertes_id as $alerte_id) {
$alertes[] = $alertesController->Alerte->findById($alerte_id);
}
- //$this->set('alertes', $alertes);
+
+ // SENDING DATA TO VIEW
$this->set(array(
'alertes' => $alertes,
'_serialize' => array('alertes')
}
}
- public function actionAlerte($id = null, $alerte_id = null) {
- // Récupération de l'historique
+ public function actionAlerte($id = null, $alerte_id = null, $valider = false, $ref_install = null) {
+
+ // GETTING CHANGELOG
$this->Historique->id = $id;
$historique = $this->Historique->findById($id);
if (!$historique) {
throw new NotFoundException(__('Historique introuvable'));
}
- // Récupération de l'alerte
+ // GETTING WARNINGS OF CHANGELOG
App::import('Controller', 'Alertes');
$alertesController = new AlertesController;
$alerte = $alertesController->Alerte->findById($alerte_id);
throw new NotFoundException(__('Alerte introuvable'));
}
- // Ajout de la version à l'historique
+ // ADDING VERSION AND DATE OF WARNING TO CHANGELOG
$version = $alerte['Alerte']['version'];
+ $date = $alerte['Alerte']['creation'];
switch($alerte['Alerte']['nature']) {
case 'version':
if($this->Historique->value('versions')) {
} else {
$versions = array();
}
- $versions[] = $version;
+ $versions[] = $version.";".$date;
$this->Historique->value('versions', implode('|', $versions));
break;
case 'creation':
$creation = $alerte['Alerte']['creation'];
- // To-do : Modification état produit
+ // TO-DO : CHANGE APPLIANCE STATE ?
break;
default:
}
- // Suppression de l'alerte
+ // IN CASE OF VALIDATION => OPPORTUNITY CREATION IN SUGAR THROUGH ALLO SERVEUR CONNECTOR
+ if($valider) {
+ $reference = str_replace("SLASH", "\\/", $ref_install);
+ $url = 'http://allo_serveur/?action=create_fiche_installation&nom='.$reference;
+ $options = array("http" => array("method" => "GET"));
+ $context = stream_context_create($options);
+ $reponse = file_get_contents($url, false, $context);
+ if(isset($reponse)) {
+ // USE THE ID SENT ?
+ }
+ }
+
+ // DELETING WARNING
$alertesController->Alerte->delete($alerte_id);
$alertes_id = explode('|', $this->Historique->value('alertes'));
if(($key = array_search($alerte_id, $alertes_id)) !== false) {
}
$this->Historique->value('alertes', implode('|', $alertes_id));
- // Redirection
+ // REDIRECTION TO APPLIANCES PAGE
return $this->redirect(array('controller' => 'instances', 'action' => 'index'));
}
}
class InstancesController extends AppController {
public $helpers = array('Html', 'Form');
public $components = array('RequestHandler');
+ public $uses = array('Instance', 'Historique');
public function index() {
- // IMPORT DES CONTROLLEURS
+
+ // GETTING CONTROLLERS
App::import('Controller', 'Alertes');
$alertesController = new AlertesController;
App::import('Controller', 'Historiques');
$historiquesController = new HistoriquesController;
+ App::import('Controller', 'Clients');
+ $clientsController = new ClientsController;
- // RÉCUPÉRATION DES INSTANCES
+ // GETTING ALL APPLIANCES
$instances = $this->Instance->find('all');
- // RECUPERATION DES INFOS DE CHAQUE INSTANCE
+ // GETTING ALL CLIENTS
+ $totalClients = $clientsController->Client->find('all');
+
+ // GETTING INFORMATION FOR EACH APPLIANCE
$historiques = array();
$totalAlertes = array();
$clients = array();
+ $last_updates = array();
foreach($instances as $instance) {
- // RECUPERATION DE L'HISTORIQUE
+ // GETTING CHANGELOG
$historique = $historiquesController->Historique->findById($instance['Instance']['historique']);
if ($historique) {
- // RÉCUPÉRATION DES ALERTES DE L'HISTORIQUE
+ // GETTING WARNINGS OF CHANGELOG
if($historique['Historique']['alertes']) {
$alertes_id = explode('|', $historique['Historique']['alertes']);
$alertes = array();
foreach ($alertes_id as $alerte_id) {
$alertes[] = $alertesController->Alerte->findById($alerte_id);
}
- // AJOUT DANS LA LISTE DES ALERTES
+ // ADDING WARNING TO LIST
$totalAlertes[$historique['Historique']['id']] = $alertes;
}
- // AJOUT DANS LA LISTE DES HISTORIQUES
+ // GETTING LAST VERSION DECLARED OF CHANGELOG
+ if($historique['Historique']['versions']) {
+ $infos_versions = explode('|', $historique['Historique']['versions']);
+ $last_update = $historique['Historique']['installation'];
+ foreach ($infos_versions as $infos_version) {
+ $infos_version_array = explode(';', $infos_version);
+ if(isset($infos_version_array[1])) {
+ $update = $infos_version_array[1];
+ if($update > $last_update) {
+ $last_update = $update;
+ }
+ }
+ }
+ // ADDING UPDATE DATE TO LIST
+ $last_updates[$instance['Instance']['id']] = $last_update;
+ }
+ // ADDING CHANGELOG TO LIST
$historiques[$instance['Instance']['id']] = $historique;
}
- // RECUPERATION DU NOM DU CLIENT
- $reference = str_replace("/", "\\/", $instance['Instance']['reference']);
- $url = 'http://allo_serveur/?action=get_client&reference='.$reference;
- $options = array("http" => array("method" => "GET"));
- $context = stream_context_create($options);
- $client = file_get_contents($url, false, $context);
- if ($client) {
- $clients[$instance['Instance']['id']] = $client;
+
+ // GETTING CUSTOMER
+ $refInstanceSansProduit = explode("/",$instance['Instance']['reference']);
+ $idAPClient = substr($refInstanceSansProduit[1],0,-11);
+ foreach($totalClients as $client) {
+ // ADDING CUSTOMER TO LIST
+ if($client['Client']['identifiant_AP'] === $idAPClient) {
+ $clients[$instance['Instance']['id']] = $client;
+ }
}
}
- // ENVOI DES DONNÉES À LA VUE
+ // SENDING DATA TO VIEW
$this->set(array(
'instances' => $instances,
'_serialize' => array('instances')
'totalAlertes' => $totalAlertes,
'_serialize' => array('totalAlertes')
));
+ $this->set(array(
+ 'last_updates' => $last_updates,
+ '_serialize' => array('last_updates')
+ ));
}
public function view($id = null) {
if (!$instance) {
throw new NotFoundException(__('Instance introuvable'));
}
+ $this->Instance->id = $id;
+
+ // GETTING PRODUCT CONTROLLER AND PRODUCTS
+ App::import('Controller', 'Produits');
+ $produitsController = new ProduitsController;
+ $produits = $produitsController->Produit->find('all');
+
+ // GETTING VERSION CONTROLLER AND VERSIONS
+ App::import('Controller', 'Versions');
+ $versionsController = new VersionsController;
+ $versions = $versionsController->Version->find('all');
+
+ // GETTING PRODUCT ID FOR THIS APPLIANCE
+ foreach($produits as $produit) {
+ if($produit['Produit']['nom'] == $this->Instance->value('nom')) {
+ $idProduit = $produit['Produit']['id'];
+ break;
+ }
+ }
+
+ // GETTING ALL AVAILABLE VERSIONS FOR THIS PRODUCT
+ $versionsPossibles = array();
+ foreach($versions as $version) {
+ if($version['Version']['produit'] == $idProduit) {
+ $versionsPossibles[] = $version['Version']['valeur'];
+ }
+ }
+ // SENDING DATA TO VIEW
+ $this->set(array(
+ 'versionsPossibles' => $versionsPossibles,
+ '_serialize' => array('versionsPossibles')
+ ));
+
+ // IN CASE OF A PUT REQUEST
if ($this->request->is(array('instance', 'put'))) {
- $this->Instance->id = $id;
+
+ // GETTING CHANGELOG
+ $historique = $this->Historique->findById($this->Instance->value('historique'));
+ if (!$historique) {
+ throw new NotFoundException(__('Historique introuvable'));
+ }
+ $this->Historique->id = $this->Instance->value('historique');
+
+ // GETTING VERSIONS OF APPLIANCE
+ if($this->Historique->value('versions')) {
+ $historiqueVersions = explode('|', $this->Historique->value('versions'));
+ } else {
+ $historiqueVersions = array();
+ }
+
+ // SAVING APPLIANCE
if ($this->Instance->save($this->request->data)) {
+
+ // GETTING VERSION TO ADD TO CHANGELOG
+ foreach($versionsPossibles as $versionPossible) {
+ if($versionPossible['Version']['valeur'] == $this->Instance->value('version')) {
+ $idVersion = $versionPossible['Version']['id'];
+ break;
+ }
+ }
+
+ // CHANGING AND SAVING CHANGELOG
+ $historiqueVersions[] = $idVersion.";".date('Y-m-d');
+ $this->Historique->value('versions', implode('|', $historiqueVersions));
+ $this->Historique->save();
$this->Session->setFlash(__("L'instance a été mise à jour."));
return $this->redirect(array('action' => 'index'));
}
}
}
- // API REST
+ // REST API
/*public function rest_get_all() {
$instances = $this->Instance->find('all');
public $components = array('RequestHandler');
public function index() {
- // RÉCUPÉRATION DES PRODUITS
+ // GETTING ALL PRODUCTS
$produits = $this->Produit->find('all');
- // IMPORT DU CONTROLLEUR DE VERSION
+ // GETTING VERSION CONTROLLER AND ALL VERSIONS
App::import('Controller', 'Versions');
$versionsController = new VersionsController;
-
- // RÉCUPERATION DES VERSIONS
$versions = $versionsController->Version->find('all');
- // ENVOI DES DONNÉES À LA VUE
+ // SENDING DATA TO VIEW
$this->set(array(
'produits' => $produits,
'_serialize' => array('produits')
public $components = array('RequestHandler');
public function index() {
- // RÉCUPÉRATION DES VERSIONS
+ // GETTING ALL VERSIONS
$versions = $this->Version->find('all');
- // ENVOI DES DONNÉES À LA VUE
+ // SENDING DATA TO VIEW
$this->set(array(
'versions' => $versions,
'_serialize' => array('versions')
$this->set('version', $version);
}
- public function add() {
- if ($this->request->is('version')) {
+ public function add($produit_id = null) {
+ if ($this->request->is('POST')) {
$this->Version->create();
+ $this->Version->value('valeur', $_POST['valeur']);
+ $this->Version->value('nature', $_POST['nature']);
+ $this->Version->value('produit', $_POST['produit']);
if ($this->Version->save($this->request->data)) {
$this->Session->setFlash(__("La version a été enregistrée."));
return $this->redirect(array('action' => 'index'));
}
$this->Session->setFlash(__("Enregistrement de la version impossible."));
+ } else {
+ // RECUPÉRATION DU / DES PRODUITS LIÉS
+ App::import('Controller', 'Produits');
+ $produitsController = new ProduitsController;
+ if(isset($produit_id)) {
+ $produit = $produitsController->Produit->findById($produit_id);
+ $this->set('produit', $produit);
+ } else {
+ $produits = $produitsController->Produit->find('all');
+ $this->set(array(
+ 'produits' => $produits,
+ '_serialize' => array('produits')
+ ));
+ }
}
}
--- /dev/null
+<?php
+ class Administrateur extends AppModel {
+ public $validate = array(
+ 'identifiant_AP' => array(
+ 'rule' => 'notEmpty'
+ )
+ );
+
+ public function value($field, $value = null) {
+ if(func_num_args() === 1){
+ $result = $this->field($field);
+ if($result){
+ return $result;
+ }
+ } else {
+ if($this->saveField($field, $value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+?>
--- /dev/null
+<?php
+ class Client extends AppModel {
+ public $validate = array(
+ 'identifiant_AP' => array(
+ 'rule' => 'notEmpty'
+ )
+ );
+
+ public function value($field, $value = null) {
+ if(func_num_args() === 1){
+ $result = $this->field($field);
+ if($result){
+ return $result;
+ }
+ } else {
+ if($this->saveField($field, $value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+?>
<?php
class Version extends AppModel {
public $validate = array(
- /*'fqdn' => array(
- 'rule' => 'notEmpty'
- ),*/
- /*'nom' => array(
- 'rule' => 'notEmpty'
- ),*/
'valeur' => array(
'rule' => 'notEmpty'
)
--- /dev/null
+<h1>Liste des administrateurs</h1>
+<table>
+ <tr>
+ <th>Login</th>
+ </tr>
+
+ <?php foreach ($administrateurs as $administrateur): ?>
+ <tr>
+ <td><?php echo $administrateur['Administrateur']['login'] ?></td>
+ </tr>
+ <?php endforeach; ?>
+ <?php unset($administrateur); ?>
+</table>
--- /dev/null
+<h1>Merci de vous authentifier en tant qu'administrateur</h1>
+<?php
+echo $this->Form->create('Administrateur');
+echo $this->Form->input('login', array('name' => 'login'));
+echo $this->Form->input('pass', array('name' => 'pass'));
+echo $this->Form->end("Login");
+?>
--- /dev/null
+<h1>Enregistrement d'un nouvel administrateur</h1>
+<?php
+echo $this->Form->create('Administrateur');
+echo $this->Form->input('login', array('name' => 'login'));
+echo $this->Form->input('pass', array('name' => 'pass'));
+echo $this->Form->end("Login");
+?>
--- /dev/null
+<h1>Liste de clients</h1>
+<button onclick="synchroniserInfosClients();">Synchronisation</button>
+<table>
+ <tr>
+ <th>Nom</th>
+ <th>Identifiant AP</th>
+ </tr>
+
+ <?php foreach ($clients as $client): ?>
+ <tr>
+ <td><?php echo $client['Client']['nom'] ?></td>
+ <td><?php echo $client['Client']['identifiant_AP']; ?></td>
+ </tr>
+ <?php endforeach; ?>
+ <?php unset($client); ?>
+</table>
+
+<script>
+ var synchroniserInfosClients = function () {
+ $.ajax({
+ url: "http://allo_serveur/?action=synchroniser_infos_clients",
+ beforeSend: function( xhr ) {
+ xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
+ }
+ })
+ .done(function( data ) {
+ if ( console && console.log ) {
+ //console.log( "Sample of data:", data.slice( 0, 100 ) );
+ }
+ location.href = "/clients";
+ });
+ };
+</script>
\ No newline at end of file
--- /dev/null
+<h1>Nom : <?php echo h($exploitant['Exploitant']['nom']); ?></h1>
+
+<p>Reference : <?php echo h($exploitant['Exploitant']['reference']); ?></p>
+
+<p>Instances : <?php echo h($exploitant['Exploitant']['exploitants']); ?></p>
echo $this->Form->input('nom');
echo $this->Form->input('reference');
echo $this->Form->input('exploitant');
-echo $this->Form->input('version', array('options' => array('4.1.02' => '4.1.02', '3.5.00' => '3.5.00')));
+echo $this->Form->input('version', array('options' => $versionsPossibles));
echo $this->Form->input('fqdn_interne');
echo $this->Form->input('maintenu', array('type' => 'radio', 'options' => array('0' => 'Faux', '1' => 'Vrai')));
//echo $this->Form->input('fqdn_externe');
array('controller' => 'instances', 'action' => 'add')
); ?>
</h1>
+<button onclick="checkInfosInstances();">Vérifier ces informations avec Sugar</button>
<table>
<tr>
- <th>Référence</th>
- <th>Produit</th>
+ <th>Référence fiche d'installation</th>
<th>Client</th>
- <th>Version</th>
- <th>Alertes</th>
+ <th>Produit</th>
+ <th>Version déclarée</th>
+ <th>Canal</th>
+ <?php if(isset($totalAlertes) && count($totalAlertes) > 0) { ?>
+ <th>Alertes</th>
+ <?php } ?>
<th>Actions</th>
</tr>
<?php foreach ($instances as $instance): ?>
<tr>
<td><?php echo $instance['Instance']['reference']; ?></td>
- <td><?php echo $instance['Instance']['nom']; ?></td>
<?php if(array_key_exists($instance['Instance']['id'], $clients)) {
$client = $clients[$instance['Instance']['id']]; ?>
- <td><?php echo $client; ?></td>
+ <td><?php echo $client['Client']['identifiant_AP']; ?></td>
<?php } else { ?>
<td>Client pour cette instance inexistant ou introuvable</td>
<?php } ?>
- <td><?php echo $instance['Instance']['version']; ?></td>
+ <td><?php echo $instance['Instance']['nom']; ?></td>
+
+ <td><?php
+ if(array_key_exists($instance['Instance']['id'], $last_updates)) {
+ $last_update = $last_updates[$instance['Instance']['id']];
+ echo $instance['Instance']['version']." le ".$last_update;
+ } else {
+ echo $instance['Instance']['version'];
+ }
+
+ ?>
+ </td>
+
+ <td><?php echo strtoupper($instance['Instance']['canal']); ?></td>
<?php if(array_key_exists($instance['Instance']['id'], $historiques)) {
$historique = $historiques[$instance['Instance']['id']];
+ if(isset($totalAlertes) && count($totalAlertes) > 0) {
?>
<td>
<table>
<th>Actions</th>
<?php } ?>
</tr>
- <tr>
<?php if(array_key_exists($historique['Historique']['id'], $totalAlertes)) { ?>
<?php foreach ($totalAlertes[$historiques[$instance['Instance']['id']]['Historique']['id']] as $alerte): ?>
- <td>
- <?php echo $alerte['Alerte']['message'] ?>
- </td>
- <td>
- <?php
- echo $this->Html->link(
- $this->Html->image('validate.png', array('class' => 'button')),
- array('controller' => 'historiques', 'action' => 'actionAlerte', $historique['Historique']['id'], $alerte['Alerte']['id']),
- array('escape' => false)
- )
- .' '.
- $this->Html->link(
- $this->Html->image('delete.png', array('class' => 'button')), '#',
- array('escape' => false,
- 'onclick' => 'actionMaintien('.$instance['Instance']['id'].', '.$historique['Historique']['id'].', '.$alerte['Alerte']['id'].')'
- )
- );
- ?>
- </td>
+
+ <tr>
+ <td>
+ <?php echo $alerte['Alerte']['message'] ?>
+ </td>
+ <td>
+ <?php
+ $reference = str_replace("/", "SLASH", $instance['Instance']['reference']);
+ echo $this->Html->link(
+ $this->Html->image('validate.png', array('class' => 'button')),
+ array('controller' => 'historiques', 'action' => 'actionAlerte', $historique['Historique']['id'], $alerte['Alerte']['id'], true, $reference),
+ array('escape' => false)
+ )
+ .' '.
+ $this->Html->link(
+ $this->Html->image('delete.png', array('class' => 'button')), '#',
+ array('escape' => false,
+ 'onclick' => 'actionMaintien('.$instance['Instance']['id'].', '.$historique['Historique']['id'].', '.$alerte['Alerte']['id'].')'
+ )
+ );
+ ?>
+ </td>
+ </tr>
<?php endforeach; ?>
<?php unset($alerte);
} ?>
- </tr>
</table>
</td>
+ <?php }?>
<td>
<?php echo $this->Html->link(
$this->Html->image('edit.jpg', array('class' => 'button')),
})();
var actionMaintien = function (instance_id, historique_id, alerte_id) {
- var garderMaintien = confirm("Conserver le maintien de l'instance ?");
+ var urlActionAlerte = "/historiques/actionAlerte/"+historique_id+"/"+alerte_id+"/false",
+ garderMaintien = confirm("Conserver le maintien de l'instance ?");
if(garderMaintien) {
alert('Maintien conservé');
- location.href = "/historiques/actionAlerte/"+historique_id+"/"+alerte_id;
+ location.href = urlActionAlerte;
} else {
alert('Maintien supprimé');
$.ajax({
if ( console && console.log ) {
//console.log( "Sample of data:", data.slice( 0, 100 ) );
}
- location.href = "/historiques/actionAlerte/"+historique_id+"/"+alerte_id;
+ location.href = urlActionAlerte;
});
}
};
}
}
};
+
+ var checkInfosInstances = function () {
+ $.ajax({
+ url: "http://allo_serveur/?action=check_synchro_info_version",
+ beforeSend: function( xhr ) {
+ xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
+ }
+ })
+ .done(function( data ) {
+ if ( console && console.log ) {
+ //console.log( "Sample of data:", data.slice( 0, 100 ) );
+ }
+ location.href = "/instances";
+ });
+ };
</script>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="//rawgit.com/saribe/eModal/master/dist/eModal.js"></script>
<?php echo $this->Html->charset(); ?>
echo $this->fetch('meta');
echo $this->fetch('css');
echo $this->fetch('script');
+
+ echo $this->Html->script('jquery.min');
?>
</head>
<body>
<a href="/instances">INSTANCES</a>
<a href="/alertes">ALERTES</a>
<a href="/produits">PRODUITS</a>
+ <a href="/clients">CLIENTS</a>
</div>
</div>
<div id="content">
<tr>
<td><?php echo $produit['Produit']['nom']; ?></td>
<td>
+ <?php echo $this->Html->link(
+ 'Nouvelle version',
+ array('controller' => 'versions', 'action' => 'add', $produit['Produit']['id'])
+ ); ?>
<table>
<tr>
<th>Valeur</th>
<th>Type</th>
<th>Actions</th>
</tr>
+ <?php foreach ($versions as $version): if($version['Version']['produit'] == $produit['Produit']['id']) { ?>
<tr>
- <?php foreach ($versions as $version): if($version['Version']['produit'] == $produit['Produit']['id']) { ?>
- <td><?php echo $version['Version']['valeur']; ?></td>
- <td><?php echo $version['Version']['nature']; ?></td>
- <td>
- <?php echo $this->Html->link(
- $this->Html->image('edit.jpg', array('class' => 'button')),
- array('controller' => 'versions', 'action' => 'edit', $version['Version']['id']),
- array('escape' => false)
- ).' '.
- $this->Form->postLink(
- $this->Html->image('delete.png', array('class' => 'button')),
- array('action' => 'delete', $version['Version']['id']),
- array('escape' => false, 'confirm' => 'Etes-vous certain ?')
- );
- ?>
- </td>
- <?php } endforeach; unset($version); ?>
+ <td><?php echo $version['Version']['valeur']; ?></td>
+ <td><?php echo $version['Version']['nature']; ?></td>
+ <td>
+ <?php echo $this->Html->link(
+ $this->Html->image('edit.jpg', array('class' => 'button')),
+ array('controller' => 'versions', 'action' => 'edit', $version['Version']['id']),
+ array('escape' => false)
+ ).' '.
+ $this->Form->postLink(
+ $this->Html->image('delete.png', array('class' => 'button')),
+ array('action' => 'delete', $version['Version']['id']),
+ array('escape' => false, 'confirm' => 'Etes-vous certain ?')
+ );
+ ?>
+ </td>
</tr>
+ <?php } endforeach; unset($version); ?>
</table>
</td>
<td>
<?php
echo $this->Form->create('Version');
echo $this->Form->input('valeur');
+echo $this->Form->input('nature', array('options' => array('patch' => 'Patch', 'majmin' => 'Mise à jour mineure', 'majmaj' => 'Mise à jour majeure')));
+if(isset($produit)) {
+ echo 'Produit : '.$produit['Produit']['nom'];
+ echo $this->Form->input('produit', array('type' => 'hidden', 'value' => $produit['Produit']['id']));
+} else if (isset($produits)) {
+ $options = array();
+ foreach($produits as $produit) {
+ $options[$produit['Produit']['id']] = $produit['Produit']['nom'];
+ }
+ echo $this->Form->input('produit', array('options' => $options));
+}
echo $this->Form->end("Enregistrer la version");
?>
\ No newline at end of file
#header #home {
padding-left: 30px;
float: left;
- width: 33%;
+ width: 30%;
}
#header #menu {
text-align: center;
--- /dev/null
+/*
+ * jQuery JavaScript Library v1.7.1
+ * http://jquery.com/
+ *
+ * Copyright 2011, John Resig
+ * Dual licensed under the MIT or GPL Version 2 licenses.
+ * http://jquery.org/license
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ *
+ * Date: Mon Nov 21 21:11:03 2011 -0500
+ */
+(function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b4<b3;b4++){if((b9=arguments[b4])!=null){for(b2 in b9){b0=b5[b2];b1=b9[b2];if(b5===b1){continue}if(b8&&b1&&(bF.isPlainObject(b1)||(b6=bF.isArray(b1)))){if(b6){b6=false;b7=b0&&bF.isArray(b0)?b0:[]}else{b7=b0&&bF.isPlainObject(b0)?b0:{}}b5[b2]=bF.extend(b8,b7,b1)}else{if(b1!==L){b5[b2]=b1}}}}}return b5};bF.extend({noConflict:function(b0){if(bb.$===bF){bb.$=bH}if(b0&&bb.jQuery===bF){bb.jQuery=bU}return bF},isReady:false,readyWait:1,holdReady:function(b0){if(b0){bF.readyWait++}else{bF.ready(true)}},ready:function(b0){if((b0===true&&!--bF.readyWait)||(b0!==true&&!bF.isReady)){if(!av.body){return setTimeout(bF.ready,1)}bF.isReady=true;if(b0!==true&&--bF.readyWait>0){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b4<b5;){if(b6.apply(b3[b4++],b2)===false){break}}}}else{if(b0){for(b1 in b3){if(b6.call(b3[b1],b1,b3[b1])===false){break}}}else{for(;b4<b5;){if(b6.call(b3[b4],b4,b3[b4++])===false){break}}}}return b3},trim:bO?function(b0){return b0==null?"":bO.call(b0)}:function(b0){return b0==null?"":b0.toString().replace(bI,"").replace(bE,"")},makeArray:function(b3,b1){var b0=b1||[];if(b3!=null){var b2=bF.type(b3);if(b3.length==null||b2==="string"||b2==="function"||b2==="regexp"||bF.isWindow(b3)){bz.call(b0,b3)}else{bF.merge(b0,b3)}}return b0},inArray:function(b2,b3,b1){var b0;if(b3){if(bv){return bv.call(b3,b2,b1)}b0=b3.length;b1=b1?b1<0?Math.max(0,b0+b1):b1:0;for(;b1<b0;b1++){if(b1 in b3&&b3[b1]===b2){return b1}}}return -1},merge:function(b4,b2){var b3=b4.length,b1=0;if(typeof b2.length==="number"){for(var b0=b2.length;b1<b0;b1++){b4[b3++]=b2[b1]}}else{while(b2[b1]!==L){b4[b3++]=b2[b1++]}}b4.length=b3;return b4},grep:function(b1,b6,b0){var b2=[],b5;b0=!!b0;for(var b3=0,b4=b1.length;b3<b4;b3++){b5=!!b6(b1[b3],b3);if(b0!==b5){b2.push(b1[b3])}}return b2},map:function(b0,b7,b8){var b5,b6,b4=[],b2=0,b1=b0.length,b3=b0 instanceof bF||b1!==L&&typeof b1==="number"&&((b1>0&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b2<b1;b2++){b5=b7(b0[b2],b2,b8);if(b5!=null){b4[b4.length]=b5}}}else{for(b6 in b0){b5=b7(b0[b6],b6,b8);if(b5!=null){b4[b4.length]=b5}}}return b4.concat.apply([],b4)},guid:1,proxy:function(b4,b3){if(typeof b3==="string"){var b2=b4[b3];b3=b4;b4=b2}if(!bF.isFunction(b4)){return L}var b0=bK.call(arguments,2),b1=function(){return b4.apply(b3,b0.concat(bK.call(arguments)))};b1.guid=b4.guid=b4.guid||b1.guid||bF.guid++;return b1},access:function(b0,b8,b6,b2,b5,b7){var b1=b0.length;if(typeof b8==="object"){for(var b3 in b8){bF.access(b0,b3,b8[b3],b2,b5,b6)}return b0}if(b6!==L){b2=!b7&&b2&&bF.isFunction(b6);for(var b4=0;b4<b1;b4++){b5(b0[b4],b8,b2?b6.call(b0[b4],b4,b5(b0[b4],b8)):b6,b7)}return b0}return b1?b5(b0[0],b8):L},now:function(){return(new Date()).getTime()},uaMatch:function(b1){b1=b1.toLowerCase();var b0=by.exec(b1)||bR.exec(b1)||bQ.exec(b1)||b1.indexOf("compatible")<0&&bS.exec(b1)||[];return{browser:b0[1]||"",version:b0[2]||"0"}},sub:function(){function b0(b3,b4){return new b0.fn.init(b3,b4)}bF.extend(true,b0,this);b0.superclass=this;b0.fn=b0.prototype=this();b0.fn.constructor=b0;b0.sub=this.sub;b0.fn.init=function b2(b3,b4){if(b4&&b4 instanceof bF&&!(b4 instanceof b0)){b4=b0(b4)}return bF.fn.init.call(this,b3,b4,b1)};b0.fn.init.prototype=b0.fn;var b1=b0(av);return b0},browser:{}});bF.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(b1,b0){bx["[object "+b0+"]"]=b0.toLowerCase()});bV=bF.uaMatch(bX);if(bV.browser){bF.browser[bV.browser]=true;bF.browser.version=bV.version}if(bF.browser.webkit){bF.browser.safari=true}if(bM.test("\xA0")){bI=/^[\s\xA0]+/;bE=/[\s\xA0]+$/}bD=bF(av);if(av.addEventListener){e=function(){av.removeEventListener("DOMContentLoaded",e,false);bF.ready()}}else{if(av.attachEvent){e=function(){if(av.readyState==="complete"){av.detachEvent("onreadystatechange",e);bF.ready()}}}}function bw(){if(bF.isReady){return}try{av.documentElement.doScroll("left")}catch(b0){setTimeout(bw,1);return}bF.ready()}return bF})();var a2={};function X(e){var bv=a2[e]={},bw,bx;e=e.split(/\s+/);for(bw=0,bx=e.length;bw<bx;bw++){bv[e[bw]]=true}return bv}b.Callbacks=function(bw){bw=bw?(a2[bw]||X(bw)):{};var bB=[],bC=[],bx,by,bv,bz,bA,bE=function(bF){var bG,bJ,bI,bH,bK;for(bG=0,bJ=bF.length;bG<bJ;bG++){bI=bF[bG];bH=b.type(bI);if(bH==="array"){bE(bI)}else{if(bH==="function"){if(!bw.unique||!bD.has(bI)){bB.push(bI)}}}}},e=function(bG,bF){bF=bF||[];bx=!bw.memory||[bG,bF];by=true;bA=bv||0;bv=0;bz=bB.length;for(;bB&&bA<bz;bA++){if(bB[bA].apply(bG,bF)===false&&bw.stopOnFalse){bx=true;break}}by=false;if(bB){if(!bw.once){if(bC&&bC.length){bx=bC.shift();bD.fireWith(bx[0],bx[1])}}else{if(bx===true){bD.disable()}else{bB=[]}}}},bD={add:function(){if(bB){var bF=bB.length;bE(arguments);if(by){bz=bB.length}else{if(bx&&bx!==true){bv=bF;e(bx[0],bx[1])}}}return this},remove:function(){if(bB){var bF=arguments,bH=0,bI=bF.length;for(;bH<bI;bH++){for(var bG=0;bG<bB.length;bG++){if(bF[bH]===bB[bG]){if(by){if(bG<=bz){bz--;if(bG<=bA){bA--}}}bB.splice(bG--,1);if(bw.unique){break}}}}}return this},has:function(bG){if(bB){var bF=0,bH=bB.length;for(;bF<bH;bF++){if(bG===bB[bF]){return true}}}return false},empty:function(){bB=[];return this},disable:function(){bB=bC=bx=L;return this},disabled:function(){return !bB},lock:function(){bC=L;if(!bx||bx===true){bD.disable()}return this},locked:function(){return !bC},fireWith:function(bG,bF){if(bC){if(by){if(!bw.once){bC.push([bG,bF])}}else{if(!(bw.once&&bx)){e(bG,bF)}}}return this},fire:function(){bD.fireWith(this,arguments);return this},fired:function(){return !!bx}};return bD};var aJ=[].slice;b.extend({Deferred:function(by){var bx=b.Callbacks("once memory"),bw=b.Callbacks("once memory"),bv=b.Callbacks("memory"),e="pending",bA={resolve:bx,reject:bw,notify:bv},bC={done:bx.add,fail:bw.add,progress:bv.add,state:function(){return e},isResolved:bx.fired,isRejected:bw.fired,then:function(bE,bD,bF){bB.done(bE).fail(bD).progress(bF);return this},always:function(){bB.done.apply(bB,arguments).fail.apply(bB,arguments);return this},pipe:function(bF,bE,bD){return b.Deferred(function(bG){b.each({done:[bF,"resolve"],fail:[bE,"reject"],progress:[bD,"notify"]},function(bI,bL){var bH=bL[0],bK=bL[1],bJ;if(b.isFunction(bH)){bB[bI](function(){bJ=bH.apply(this,arguments);if(bJ&&b.isFunction(bJ.promise)){bJ.promise().then(bG.resolve,bG.reject,bG.notify)}else{bG[bK+"With"](this===bB?bG:this,[bJ])}})}else{bB[bI](bG[bK])}})}).promise()},promise:function(bE){if(bE==null){bE=bC}else{for(var bD in bC){bE[bD]=bC[bD]}}return bE}},bB=bC.promise({}),bz;for(bz in bA){bB[bz]=bA[bz].fire;bB[bz+"With"]=bA[bz].fireWith}bB.done(function(){e="resolved"},bw.disable,bv.lock).fail(function(){e="rejected"},bx.disable,bv.lock);if(by){by.call(bB,bB)}return bB},when:function(bA){var bx=aJ.call(arguments,0),bv=0,e=bx.length,bB=new Array(e),bw=e,by=e,bC=e<=1&&bA&&b.isFunction(bA.promise)?bA:b.Deferred(),bE=bC.promise();function bD(bF){return function(bG){bx[bF]=arguments.length>1?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv<e;bv++){if(bx[bv]&&bx[bv].promise&&b.isFunction(bx[bv].promise)){bx[bv].promise().then(bD(bv),bC.reject,bz(bv))}else{--bw}}if(!bw){bC.resolveWith(bC,bx)}}else{if(bC!==bA){bC.resolveWith(bC,e?[bA]:[])}}return bE}});b.support=(function(){var bJ,bI,bF,bG,bx,bE,bA,bD,bz,bK,bB,by,bw,bv=av.createElement("div"),bH=av.documentElement;bv.setAttribute("className","t");bv.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav></:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="<div "+e+"><div></div></div><table "+e+" cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="<div style='width:4px;'></div>";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA<bz;bA++){delete bB[bv[bA]]}if(!(by?S:b.isEmptyObject)(bB)){return}}}if(!by){delete e[bw].data;if(!S(e[bw])){return}}if(b.support.deleteExpando||!e.setInterval){delete e[bw]}else{e[bw]=null}if(bD){if(b.support.deleteExpando){delete bx[bC]}else{if(bx.removeAttribute){bx.removeAttribute(bC)}else{bx[bC]=null}}}},_data:function(bv,e,bw){return b.data(bv,e,bw,true)},acceptData:function(bv){if(bv.nodeName){var e=b.noData[bv.nodeName.toLowerCase()];if(e){return !(e===true||bv.getAttribute("classid")!==e)}}return true}});b.fn.extend({data:function(by,bA){var bB,e,bw,bz=null;if(typeof by==="undefined"){if(this.length){bz=b.data(this[0]);if(this[0].nodeType===1&&!b._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var bx=0,bv=e.length;bx<bv;bx++){bw=e[bx].name;if(bw.indexOf("data-")===0){bw=b.camelCase(bw.substring(5));a5(this[0],bw,bz[bw])}}b._data(this[0],"parsedAttrs",true)}}return bz}else{if(typeof by==="object"){return this.each(function(){b.data(this,by)})}}bB=by.split(".");bB[1]=bB[1]?"."+bB[1]:"";if(bA===L){bz=this.triggerHandler("getData"+bB[1]+"!",[bB[0]]);if(bz===L&&this.length){bz=b.data(this[0],by);bz=a5(this[0],by,bz)}return bz===L&&bB[1]?this.data(bB[0]):bz}else{return this.each(function(){var bC=b(this),bD=[bB[0],bA];bC.triggerHandler("setData"+bB[1]+"!",bD);b.data(this,by,bA);bC.triggerHandler("changeData"+bB[1]+"!",bD)})}},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function a5(bx,bw,by){if(by===L&&bx.nodeType===1){var bv="data-"+bw.replace(aA,"-$1").toLowerCase();by=bx.getAttribute(bv);if(typeof by==="string"){try{by=by==="true"?true:by==="false"?false:by==="null"?null:b.isNumeric(by)?parseFloat(by):aS.test(by)?b.parseJSON(by):by}catch(bz){}b.data(bx,bw,by)}else{by=L}}return by}function S(bv){for(var e in bv){if(e==="data"&&b.isEmptyObject(bv[e])){continue}if(e!=="toJSON"){return false}}return true}function bi(by,bx,bA){var bw=bx+"defer",bv=bx+"queue",e=bx+"mark",bz=b._data(by,bw);if(bz&&(bA==="queue"||!b._data(by,bv))&&(bA==="mark"||!b._data(by,e))){setTimeout(function(){if(!b._data(by,bv)&&!b._data(by,e)){b.removeData(by,bw,true);bz.fire()}},0)}}b.extend({_mark:function(bv,e){if(bv){e=(e||"fx")+"mark";b._data(bv,e,(b._data(bv,e)||0)+1)}},_unmark:function(by,bx,bv){if(by!==true){bv=bx;bx=by;by=false}if(bx){bv=bv||"fx";var e=bv+"mark",bw=by?0:((b._data(bx,e)||1)-1);if(bw){b._data(bx,e,bw)}else{b.removeData(bx,e,true);bi(bx,bv,"mark")}}},queue:function(bv,e,bx){var bw;if(bv){e=(e||"fx")+"queue";bw=b._data(bv,e);if(bx){if(!bw||b.isArray(bx)){bw=b._data(bv,e,b.makeArray(bx))}else{bw.push(bx)}}return bw||[]}},dequeue:function(by,bx){bx=bx||"fx";var bv=b.queue(by,bx),bw=bv.shift(),e={};if(bw==="inprogress"){bw=bv.shift()}if(bw){if(bx==="fx"){bv.unshift("inprogress")}b._data(by,bx+".run",e);bw.call(by,function(){b.dequeue(by,bx)},e)}if(!bv.length){b.removeData(by,bx+"queue "+bx+".run",true);bi(by,bx,"queue")}}});b.fn.extend({queue:function(e,bv){if(typeof e!=="string"){bv=e;e="fx"}if(bv===L){return b.queue(this[0],e)}return this.each(function(){var bw=b.queue(this,e,bv);if(e==="fx"&&bw[0]!=="inprogress"){b.dequeue(this,e)}})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(bv,e){bv=b.fx?b.fx.speeds[bv]||bv:bv;e=e||"fx";return this.queue(e,function(bx,bw){var by=setTimeout(bx,bv);bw.stop=function(){clearTimeout(by)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(bD,bw){if(typeof bD!=="string"){bw=bD;bD=L}bD=bD||"fx";var e=b.Deferred(),bv=this,by=bv.length,bB=1,bz=bD+"defer",bA=bD+"queue",bC=bD+"mark",bx;function bE(){if(!(--bB)){e.resolveWith(bv,[bv])}}while(by--){if((bx=b.data(bv[by],bz,L,true)||(b.data(bv[by],bA,L,true)||b.data(bv[by],bC,L,true))&&b.data(bv[by],bz,b.Callbacks("once memory"),true))){bB++;bx.add(bE)}}bE();return e.promise()}});var aP=/[\n\t\r]/g,af=/\s+/,aU=/\r/g,g=/^(?:button|input)$/i,D=/^(?:button|input|object|select|textarea)$/i,l=/^a(?:rea)?$/i,ao=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,F=b.support.getSetAttribute,be,aY,aF;b.fn.extend({attr:function(e,bv){return b.access(this,e,bv,true,b.attr)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,bv){return b.access(this,e,bv,true,b.prop)},removeProp:function(e){e=b.propFix[e]||e;return this.each(function(){try{this[e]=L;delete this[e]}catch(bv){}})},addClass:function(by){var bA,bw,bv,bx,bz,bB,e;if(b.isFunction(by)){return this.each(function(bC){b(this).addClass(by.call(this,bC,this.className))})}if(by&&typeof by==="string"){bA=by.split(af);for(bw=0,bv=this.length;bw<bv;bw++){bx=this[bw];if(bx.nodeType===1){if(!bx.className&&bA.length===1){bx.className=by}else{bz=" "+bx.className+" ";for(bB=0,e=bA.length;bB<e;bB++){if(!~bz.indexOf(" "+bA[bB]+" ")){bz+=bA[bB]+" "}}bx.className=b.trim(bz)}}}}return this},removeClass:function(bz){var bA,bw,bv,by,bx,bB,e;if(b.isFunction(bz)){return this.each(function(bC){b(this).removeClass(bz.call(this,bC,this.className))})}if((bz&&typeof bz==="string")||bz===L){bA=(bz||"").split(af);for(bw=0,bv=this.length;bw<bv;bw++){by=this[bw];if(by.nodeType===1&&by.className){if(bz){bx=(" "+by.className+" ").replace(aP," ");for(bB=0,e=bA.length;bB<e;bB++){bx=bx.replace(" "+bA[bB]+" "," ")}by.className=b.trim(bx)}else{by.className=""}}}}return this},toggleClass:function(bx,bv){var bw=typeof bx,e=typeof bv==="boolean";if(b.isFunction(bx)){return this.each(function(by){b(this).toggleClass(bx.call(this,by,this.className,bv),bv)})}return this.each(function(){if(bw==="string"){var bA,bz=0,by=b(this),bB=bv,bC=bx.split(af);while((bA=bC[bz++])){bB=e?bB:!by.hasClass(bA);by[bB?"addClass":"removeClass"](bA)}}else{if(bw==="undefined"||bw==="boolean"){if(this.className){b._data(this,"__className__",this.className)}this.className=this.className||bx===false?"":b._data(this,"__className__")||""}}})},hasClass:function(e){var bx=" "+e+" ",bw=0,bv=this.length;for(;bw<bv;bw++){if(this[bw].nodeType===1&&(" "+this[bw].className+" ").replace(aP," ").indexOf(bx)>-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv<bz;bv++){bx=bC[bv];if(bx.selected&&(b.support.optDisabled?!bx.disabled:bx.getAttribute("disabled")===null)&&(!bx.parentNode.disabled||!b.nodeName(bx.parentNode,"optgroup"))){bA=b(bx).val();if(bw){return bA}bB.push(bA)}}if(bw&&!bB.length&&bC.length){return b(bC[by]).val()}return bB},set:function(bv,bw){var e=b.makeArray(bw);b(bv).find("option").each(function(){this.selected=b.inArray(b(this).val(),e)>=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType;if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw<e;bw++){bv=bA[bw];if(bv){by=b.propFix[bv]||bv;b.attr(bx,bv,"");bx.removeAttribute(F?bv:by);if(ao.test(bv)&&by in bx){bx[by]=false}}}}},attrHooks:{type:{set:function(e,bv){if(g.test(e.nodeName)&&e.parentNode){b.error("type property can't be changed")}else{if(!b.support.radioValue&&bv==="radio"&&b.nodeName(e,"input")){var bw=e.value;e.setAttribute("type",bv);if(bw){e.value=bw}return bv}}}},value:{get:function(bv,e){if(be&&b.nodeName(bv,"button")){return be.get(bv,e)}return e in bv?bv.value:null},set:function(bv,bw,e){if(be&&b.nodeName(bv,"button")){return be.set(bv,bw,e)}bv.value=bw}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(bz,bx,bA){var bw,e,by,bv=bz.nodeType;if(!bz||bv===3||bv===8||bv===2){return}by=bv!==1||!b.isXMLDoc(bz);if(by){bx=b.propFix[bx]||bx;e=b.propHooks[bx]}if(bA!==L){if(e&&"set" in e&&(bw=e.set(bz,bA,bx))!==L){return bw}else{return(bz[bx]=bA)}}else{if(e&&"get" in e&&(bw=e.get(bz,bx))!==null){return bw}else{return bz[bx]}}},propHooks:{tabIndex:{get:function(bv){var e=bv.getAttributeNode("tabindex");return e&&e.specified?parseInt(e.value,10):D.test(bv.nodeName)||l.test(bv.nodeName)&&bv.href?0:L}}}});b.attrHooks.tabindex=b.propHooks.tabIndex;aY={get:function(bv,e){var bx,bw=b.prop(bv,e);return bw===true||typeof bw!=="boolean"&&(bx=bv.getAttributeNode(e))&&bx.nodeValue!==false?e.toLowerCase():L},set:function(bv,bx,e){var bw;if(bx===false){b.removeAttr(bv,e)}else{bw=b.propFix[e]||e;if(bw in bv){bv[bw]=true}bv.setAttribute(e,e.toLowerCase())}return e}};if(!F){aF={name:true,id:true};be=b.valHooks.button={get:function(bw,bv){var e;e=bw.getAttributeNode(bv);return e&&(aF[bv]?e.nodeValue!=="":e.specified)?e.nodeValue:L},set:function(bw,bx,bv){var e=bw.getAttributeNode(bv);if(!e){e=av.createAttribute(bv);bw.setAttributeNode(e)}return(e.nodeValue=bx+"")}};b.attrHooks.tabindex.set=be.set;b.each(["width","height"],function(bv,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{set:function(bw,bx){if(bx===""){bw.setAttribute(e,"auto");return bx}}})});b.attrHooks.contenteditable={get:be.get,set:function(bv,bw,e){if(bw===""){bw="false"}be.set(bv,bw,e)}}}if(!b.support.hrefNormalized){b.each(["href","src","width","height"],function(bv,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{get:function(bx){var bw=bx.getAttribute(e,2);return bw===null?L:bw}})})}if(!b.support.style){b.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||L},set:function(e,bv){return(e.style.cssText=""+bv)}}}if(!b.support.optSelected){b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(bv){var e=bv.parentNode;if(e){e.selectedIndex;if(e.parentNode){e.parentNode.selectedIndex}}return null}})}if(!b.support.enctype){b.propFix.enctype="encoding"}if(!b.support.checkOn){b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}})}b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,bv){if(b.isArray(bv)){return(e.checked=b.inArray(b(e).val(),bv)>=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI<bC.length;bI++){bH=n.exec(bC[bI])||[];bF=bH[1];e=(bH[2]||"").split(".").sort();bE=b.event.special[bF]||{};bF=(by?bE.delegateType:bE.bindType)||bF;bE=b.event.special[bF]||{};bG=b.extend({type:bF,origType:bH[1],data:bA,handler:bJ,guid:bJ.guid,selector:by,quick:Y(by),namespace:e.join(".")},bv);bw=bK[bF];if(!bw){bw=bK[bF]=[];bw.delegateCount=0;if(!bE.setup||bE.setup.call(bx,bA,e,bB)===false){if(bx.addEventListener){bx.addEventListener(bF,bB,false)}else{if(bx.attachEvent){bx.attachEvent("on"+bF,bB)}}}}if(bE.add){bE.add.call(bx,bG);if(!bG.handler.guid){bG.handler.guid=bJ.guid}}if(by){bw.splice(bw.delegateCount++,0,bG)}else{bw.push(bG)}b.event.global[bF]=true}bx=null},global:{},remove:function(bJ,bE,bv,bH,bB){var bI=b.hasData(bJ)&&b._data(bJ),bF,bx,bz,bL,bC,bA,bG,bw,by,bK,bD,e;if(!bI||!(bw=bI.events)){return}bE=b.trim(bt(bE||"")).split(" ");for(bF=0;bF<bE.length;bF++){bx=n.exec(bE[bF])||[];bz=bL=bx[1];bC=bx[2];if(!bz){for(bz in bw){b.event.remove(bJ,bz+bE[bF],bv,bH,true)}continue}by=b.event.special[bz]||{};bz=(bH?by.delegateType:by.bindType)||bz;bD=bw[bz]||[];bA=bD.length;bC=bC?new RegExp("(^|\\.)"+bC.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(bG=0;bG<bD.length;bG++){e=bD[bG];if((bB||bL===e.origType)&&(!bv||bv.guid===e.guid)&&(!bC||bC.test(e.namespace))&&(!bH||bH===e.selector||bH==="**"&&e.selector)){bD.splice(bG--,1);if(e.selector){bD.delegateCount--}if(by.remove){by.remove.call(bJ,e)}}}if(bD.length===0&&bA!==bD.length){if(!by.teardown||by.teardown.call(bJ,bC)===false){b.removeEvent(bJ,bz,bI.handle)}delete bw[bz]}}if(b.isEmptyObject(bw)){bK=bI.handle;if(bK){bK.elem=null}b.removeData(bJ,["events","handle"],true)}},customEvent:{getData:true,setData:true,changeData:true},trigger:function(bv,bD,bA,bJ){if(bA&&(bA.nodeType===3||bA.nodeType===8)){return}var bG=bv.type||bv,bx=[],e,bw,bC,bH,bz,by,bF,bE,bB,bI;if(T.test(bG+b.event.triggered)){return}if(bG.indexOf("!")>=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bC<bB.length&&!bv.isPropagationStopped();bC++){bH=bB[bC][0];bv.type=bB[bC][1];bE=(b._data(bH,"events")||{})[bv.type]&&b._data(bH,"handle");if(bE){bE.apply(bH,bD)}bE=by&&bH[by];if(bE&&b.acceptData(bH)&&bE.apply(bH,bD)===false){bv.preventDefault()}}bv.type=bG;if(!bJ&&!bv.isDefaultPrevented()){if((!bF._default||bF._default.apply(bA.ownerDocument,bD)===false)&&!(bG==="click"&&b.nodeName(bA,"a"))&&b.acceptData(bA)){if(by&&bA[bG]&&((bG!=="focus"&&bG!=="blur")||bv.target.offsetWidth!==0)&&!b.isWindow(bA)){bz=bA[by];if(bz){bA[by]=null}b.event.triggered=bG;bA[bG]();b.event.triggered=L;if(bz){bA[by]=bz}}}}return bv.result},dispatch:function(e){e=b.event.fix(e||bb.event);var bz=((b._data(this,"events")||{})[e.type]||[]),bA=bz.delegateCount,bG=[].slice.call(arguments,0),by=!e.exclusive&&!e.namespace,bH=[],bC,bB,bK,bx,bF,bE,bv,bD,bI,bw,bJ;bG[0]=e;e.delegateTarget=this;if(bA&&!e.target.disabled&&!(e.button&&e.type==="click")){bx=b(this);bx.context=this.ownerDocument||this;for(bK=e.target;bK!=this;bK=bK.parentNode||this){bE={};bD=[];bx[0]=bK;for(bC=0;bC<bA;bC++){bI=bz[bC];bw=bI.selector;if(bE[bw]===L){bE[bw]=(bI.quick?j(bK,bI.quick):bx.is(bw))}if(bE[bw]){bD.push(bI)}}if(bD.length){bH.push({elem:bK,matches:bD})}}}if(bz.length>bA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC<bH.length&&!e.isPropagationStopped();bC++){bv=bH[bC];e.currentTarget=bv.elem;for(bB=0;bB<bv.matches.length&&!e.isImmediatePropagationStopped();bB++){bI=bv.matches[bB];if(by||(!e.namespace&&!bI.namespace)||e.namespace_re&&e.namespace_re.test(bI.namespace)){e.data=bI.data;e.handleObj=bI;bF=((b.event.special[bI.origType]||{}).handle||bI.handler).apply(bv.elem,bG);if(bF!==L){e.result=bF;if(bF===false){e.preventDefault();e.stopPropagation()}}}}}return e.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(bv,e){if(bv.which==null){bv.which=e.charCode!=null?e.charCode:e.keyCode}return bv}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(bx,bw){var by,bz,e,bv=bw.button,bA=bw.fromElement;if(bx.pageX==null&&bw.clientX!=null){by=bx.target.ownerDocument||av;bz=by.documentElement;e=by.body;bx.pageX=bw.clientX+(bz&&bz.scrollLeft||e&&e.scrollLeft||0)-(bz&&bz.clientLeft||e&&e.clientLeft||0);bx.pageY=bw.clientY+(bz&&bz.scrollTop||e&&e.scrollTop||0)-(bz&&bz.clientTop||e&&e.clientTop||0)}if(!bx.relatedTarget&&bA){bx.relatedTarget=bA===bx.target?bw.toElement:bA}if(!bx.which&&bv!==L){bx.which=(bv&1?1:(bv&2?3:(bv&4?2:0)))}return bx}},fix:function(bw){if(bw[b.expando]){return bw}var bv,bz,e=bw,bx=b.event.fixHooks[bw.type]||{},by=bx.props?this.props.concat(bx.props):this.props;bw=b.Event(e);for(bv=by.length;bv;){bz=by[--bv];bw[bz]=e[bz]}if(!bw.target){bw.target=e.srcElement||av}if(bw.target.nodeType===3){bw.target=bw.target.parentNode}if(bw.metaKey===L){bw.metaKey=bw.ctrlKey}return bx.filter?bx.filter(bw,e):bw},special:{ready:{setup:b.bindReady},load:{noBubble:true},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(bw,bv,e){if(b.isWindow(this)){this.onbeforeunload=e}},teardown:function(bv,e){if(this.onbeforeunload===e){this.onbeforeunload=null}}}},simulate:function(bw,by,bx,bv){var bz=b.extend(new b.Event(),bx,{type:bw,isSimulated:true,originalEvent:{}});if(bv){b.event.trigger(bz,null,by)}else{b.event.dispatch.call(by,bz)}if(bz.isDefaultPrevented()){bx.preventDefault()}}};b.event.handle=b.event.dispatch;b.removeEvent=av.removeEventListener?function(bv,e,bw){if(bv.removeEventListener){bv.removeEventListener(e,bw,false)}}:function(bv,e,bw){if(bv.detachEvent){bv.detachEvent("on"+e,bw)}};b.Event=function(bv,e){if(!(this instanceof b.Event)){return new b.Event(bv,e)}if(bv&&bv.type){this.originalEvent=bv;this.type=bv.type;this.isDefaultPrevented=(bv.defaultPrevented||bv.returnValue===false||bv.getPreventDefault&&bv.getPreventDefault())?i:bk}else{this.type=bv}if(e){b.extend(this,e)}this.timeStamp=bv&&bv.timeStamp||b.now();this[b.expando]=true};function bk(){return false}function i(){return true}b.Event.prototype={preventDefault:function(){this.isDefaultPrevented=i;var bv=this.originalEvent;if(!bv){return}if(bv.preventDefault){bv.preventDefault()}else{bv.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=i;var bv=this.originalEvent;if(!bv){return}if(bv.stopPropagation){bv.stopPropagation()}bv.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=i;this.stopPropagation()},isDefaultPrevented:bk,isPropagationStopped:bk,isImmediatePropagationStopped:bk};b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(bv,e){b.event.special[bv]={delegateType:e,bindType:e,handle:function(bz){var bB=this,bA=bz.relatedTarget,by=bz.handleObj,bw=by.selector,bx;if(!bA||(bA!==bB&&!b.contains(bB,bA))){bz.type=by.origType;bx=by.handler.apply(this,arguments);bz.type=e}return bx}}});if(!b.support.submitBubbles){b.event.special.submit={setup:function(){if(b.nodeName(this,"form")){return false}b.event.add(this,"click._submit keypress._submit",function(bx){var bw=bx.target,bv=b.nodeName(bw,"input")||b.nodeName(bw,"button")?bw.form:L;if(bv&&!bv._submit_attached){b.event.add(bv,"submit._submit",function(e){if(this.parentNode&&!e.isTrigger){b.event.simulate("submit",this.parentNode,e,true)}});bv._submit_attached=true}})},teardown:function(){if(b.nodeName(this,"form")){return false}b.event.remove(this,"._submit")}}}if(!b.support.changeBubbles){b.event.special.change={setup:function(){if(bd.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio"){b.event.add(this,"propertychange._change",function(e){if(e.originalEvent.propertyName==="checked"){this._just_changed=true}});b.event.add(this,"click._change",function(e){if(this._just_changed&&!e.isTrigger){this._just_changed=false;b.event.simulate("change",this,e,true)}})}return false}b.event.add(this,"beforeactivate._change",function(bw){var bv=bw.target;if(bd.test(bv.nodeName)&&!bv._change_attached){b.event.add(bv,"change._change",function(e){if(this.parentNode&&!e.isSimulated&&!e.isTrigger){b.event.simulate("change",this.parentNode,e,true)}});bv._change_attached=true}})},handle:function(bv){var e=bv.target;if(this!==e||bv.isSimulated||bv.isTrigger||(e.type!=="radio"&&e.type!=="checkbox")){return bv.handleObj.handler.apply(this,arguments)}},teardown:function(){b.event.remove(this,"._change");return bd.test(this.nodeName)}}}if(!b.support.focusinBubbles){b.each({focus:"focusin",blur:"focusout"},function(bx,e){var bv=0,bw=function(by){b.event.simulate(e,by.target,b.event.fix(by),true)};b.event.special[e]={setup:function(){if(bv++===0){av.addEventListener(bx,bw,true)}},teardown:function(){if(--bv===0){av.removeEventListener(bx,bw,true)}}}})}b.fn.extend({on:function(bw,e,bz,by,bv){var bA,bx;if(typeof bw==="object"){if(typeof e!=="string"){bz=e;e=L}for(bx in bw){this.on(bx,e,bz,bw[bx],bv)}return this}if(bz==null&&by==null){by=e;bz=e=L}else{if(by==null){if(typeof e==="string"){by=bz;bz=L}else{by=bz;bz=e;e=L}}}if(by===false){by=bk}else{if(!by){return this}}if(bv===1){bA=by;by=function(bB){b().off(bB);return bA.apply(this,arguments)};by.guid=bA.guid||(bA.guid=b.guid++)}return this.each(function(){b.event.add(this,bw,by,bz,e)})},one:function(bv,e,bx,bw){return this.on.call(this,bv,e,bx,bw,1)},off:function(bw,e,by){if(bw&&bw.preventDefault&&bw.handleObj){var bv=bw.handleObj;b(bw.delegateTarget).off(bv.namespace?bv.type+"."+bv.namespace:bv.type,bv.selector,bv.handler);return this}if(typeof bw==="object"){for(var bx in bw){this.off(bx,e,bw[bx])}return this}if(e===false||typeof e==="function"){by=e;e=L}if(by===false){by=bk}return this.each(function(){b.event.remove(this,bw,by,e)})},bind:function(e,bw,bv){return this.on(e,null,bw,bv)},unbind:function(e,bv){return this.off(e,null,bv)},live:function(e,bw,bv){b(this.context).on(e,this.selector,bw,bv);return this},die:function(e,bv){b(this.context).off(e,this.selector||"**",bv);return this},delegate:function(e,bv,bx,bw){return this.on(bv,e,bx,bw)},undelegate:function(e,bv,bw){return arguments.length==1?this.off(e,"**"):this.off(bv,e,bw)},trigger:function(e,bv){return this.each(function(){b.event.trigger(e,bv,this)})},triggerHandler:function(e,bv){if(this[0]){return b.event.trigger(e,bv,this[0],true)}},toggle:function(bx){var bv=arguments,e=bx.guid||b.guid++,bw=0,by=function(bz){var bA=(b._data(this,"lastToggle"+bx.guid)||0)%bw;b._data(this,"lastToggle"+bx.guid,bA+1);bz.preventDefault();return bv[bA].apply(this,arguments)||false};by.guid=e;while(bw<bv.length){bv[bw++].guid=e}return this.click(by)},hover:function(e,bv){return this.mouseenter(e).mouseleave(bv||e)}});b.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu").split(" "),function(bv,e){b.fn[e]=function(bx,bw){if(bw==null){bw=bx;bx=null}return arguments.length>0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}});
+/*
+ * Sizzle CSS Selector Engine
+ * Copyright 2011, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){var bH=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bC="sizcache"+(Math.random()+"").replace(".",""),bI=0,bL=Object.prototype.toString,bB=false,bA=true,bK=/\\/g,bO=/\r\n/g,bQ=/\W/;[0,0].sort(function(){bA=false;return 0});var by=function(bV,e,bY,bZ){bY=bY||[];e=e||av;var b1=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bV||typeof bV!=="string"){return bY}var bS,b3,b6,bR,b2,b5,b4,bX,bU=true,bT=by.isXML(e),bW=[],b0=bV;do{bH.exec("");bS=bH.exec(b0);if(bS){b0=bS[3];bW.push(bS[1]);if(bS[2]){bR=bS[3];break}}}while(bS);if(bW.length>1&&bD.exec(bV)){if(bW.length===2&&bE.relative[bW[0]]){b3=bM(bW[0]+bW[1],e,bZ)}else{b3=bE.relative[bW[0]]?[e]:by(bW.shift(),e);while(bW.length){bV=bW.shift();if(bE.relative[bV]){bV+=bW.shift()}b3=bM(bV,b3,bZ)}}}else{if(!bZ&&bW.length>1&&e.nodeType===9&&!bT&&bE.match.ID.test(bW[0])&&!bE.match.ID.test(bW[bW.length-1])){b2=by.find(bW.shift(),e,bT);e=b2.expr?by.filter(b2.expr,b2.set)[0]:b2.set[0]}if(e){b2=bZ?{expr:bW.pop(),set:bF(bZ)}:by.find(bW.pop(),bW.length===1&&(bW[0]==="~"||bW[0]==="+")&&e.parentNode?e.parentNode:e,bT);b3=b2.expr?by.filter(b2.expr,b2.set):b2.set;if(bW.length>0){b6=bF(b3)}else{bU=false}while(bW.length){b5=bW.pop();b4=b5;if(!bE.relative[b5]){b5=""}else{b4=bW.pop()}if(b4==null){b4=e}bE.relative[b5](b6,b4,bT)}}else{b6=bW=[]}}if(!b6){b6=b3}if(!b6){by.error(b5||bV)}if(bL.call(b6)==="[object Array]"){if(!bU){bY.push.apply(bY,b6)}else{if(e&&e.nodeType===1){for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&(b6[bX]===true||b6[bX].nodeType===1&&by.contains(e,b6[bX]))){bY.push(b3[bX])}}}else{for(bX=0;b6[bX]!=null;bX++){if(b6[bX]&&b6[bX].nodeType===1){bY.push(b3[bX])}}}}}else{bF(b6,bY)}if(bR){by(bR,b1,bY,bZ);by.uniqueSort(bY)}return bY};by.uniqueSort=function(bR){if(bJ){bB=bA;bR.sort(bJ);if(bB){for(var e=1;e<bR.length;e++){if(bR[e]===bR[e-1]){bR.splice(e--,1)}}}}return bR};by.matches=function(e,bR){return by(e,null,null,bR)};by.matchesSelector=function(e,bR){return by(bR,null,null,[e]).length>0};by.find=function(bX,e,bY){var bW,bS,bU,bT,bV,bR;if(!bX){return[]}for(bS=0,bU=bE.order.length;bS<bU;bS++){bV=bE.order[bS];if((bT=bE.leftMatch[bV].exec(bX))){bR=bT[1];bT.splice(1,1);if(bR.substr(bR.length-1)!=="\\"){bT[1]=(bT[1]||"").replace(bK,"");bW=bE.find[bV](bT,e,bY);if(bW!=null){bX=bX.replace(bE.match[bV],"");break}}}}if(!bW){bW=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:bW,expr:bX}};by.filter=function(b1,b0,b4,bU){var bW,e,bZ,b6,b3,bR,bT,bV,b2,bS=b1,b5=[],bY=b0,bX=b0&&b0[0]&&by.isXML(b0[0]);while(b1&&b0.length){for(bZ in bE.filter){if((bW=bE.leftMatch[bZ].exec(b1))!=null&&bW[2]){bR=bE.filter[bZ];bT=bW[1];e=false;bW.splice(1,1);if(bT.substr(bT.length-1)==="\\"){continue}if(bY===b5){b5=[]}if(bE.preFilter[bZ]){bW=bE.preFilter[bZ](bW,bY,b4,b5,bU,bX);if(!bW){e=b6=true}else{if(bW===true){continue}}}if(bW){for(bV=0;(b3=bY[bV])!=null;bV++){if(b3){b6=bR(b3,bW,bV,bY);b2=bU^b6;if(b4&&b6!=null){if(b2){e=true}else{bY[bV]=false}}else{if(b2){b5.push(b3);e=true}}}}}if(b6!==L){if(!b4){bY=b5}b1=b1.replace(bE.match[bZ],"");if(!e){return[]}break}}}if(b1===bS){if(e==null){by.error(b1)}else{break}}bS=b1}return bY};by.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};var bw=by.getText=function(bU){var bS,bT,e=bU.nodeType,bR="";if(e){if(e===1||e===9){if(typeof bU.textContent==="string"){return bU.textContent}else{if(typeof bU.innerText==="string"){return bU.innerText.replace(bO,"")}else{for(bU=bU.firstChild;bU;bU=bU.nextSibling){bR+=bw(bU)}}}}else{if(e===3||e===4){return bU.nodeValue}}}else{for(bS=0;(bT=bU[bS]);bS++){if(bT.nodeType!==8){bR+=bw(bT)}}}return bR};var bE=by.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(bW,bR){var bT=typeof bR==="string",bV=bT&&!bQ.test(bR),bX=bT&&!bV;if(bV){bR=bR.toLowerCase()}for(var bS=0,e=bW.length,bU;bS<e;bS++){if((bU=bW[bS])){while((bU=bU.previousSibling)&&bU.nodeType!==1){}bW[bS]=bX||bU&&bU.nodeName.toLowerCase()===bR?bU||false:bU===bR}}if(bX){by.filter(bR,bW,true)}},">":function(bW,bR){var bV,bU=typeof bR==="string",bS=0,e=bW.length;if(bU&&!bQ.test(bR)){bR=bR.toLowerCase();for(;bS<e;bS++){bV=bW[bS];if(bV){var bT=bV.parentNode;bW[bS]=bT.nodeName.toLowerCase()===bR?bT:false}}}else{for(;bS<e;bS++){bV=bW[bS];if(bV){bW[bS]=bU?bV.parentNode:bV.parentNode===bR}}if(bU){by.filter(bR,bW,true)}}},"":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("parentNode",bR,bS,bT,bU,bV)},"~":function(bT,bR,bV){var bU,bS=bI++,e=bN;if(typeof bR==="string"&&!bQ.test(bR)){bR=bR.toLowerCase();bU=bR;e=bv}e("previousSibling",bR,bS,bT,bU,bV)}},find:{ID:function(bR,bS,bT){if(typeof bS.getElementById!=="undefined"&&!bT){var e=bS.getElementById(bR[1]);return e&&e.parentNode?[e]:[]}},NAME:function(bS,bV){if(typeof bV.getElementsByName!=="undefined"){var bR=[],bU=bV.getElementsByName(bS[1]);for(var bT=0,e=bU.length;bT<e;bT++){if(bU[bT].getAttribute("name")===bS[1]){bR.push(bU[bT])}}return bR.length===0?null:bR}},TAG:function(e,bR){if(typeof bR.getElementsByTagName!=="undefined"){return bR.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(bT,bR,bS,e,bW,bX){bT=" "+bT[1].replace(bK,"")+" ";if(bX){return bT}for(var bU=0,bV;(bV=bR[bU])!=null;bU++){if(bV){if(bW^(bV.className&&(" "+bV.className+" ").replace(/[\t\n\r]/g," ").indexOf(bT)>=0)){if(!bS){e.push(bV)}}else{if(bS){bR[bU]=false}}}}return false},ID:function(e){return e[1].replace(bK,"")},TAG:function(bR,e){return bR[1].replace(bK,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){by.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bR=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bR[1]+(bR[2]||1))-0;e[3]=bR[3]-0}else{if(e[2]){by.error(e[0])}}e[0]=bI++;return e},ATTR:function(bU,bR,bS,e,bV,bW){var bT=bU[1]=bU[1].replace(bK,"");if(!bW&&bE.attrMap[bT]){bU[1]=bE.attrMap[bT]}bU[4]=(bU[4]||bU[5]||"").replace(bK,"");if(bU[2]==="~="){bU[4]=" "+bU[4]+" "}return bU},PSEUDO:function(bU,bR,bS,e,bV){if(bU[1]==="not"){if((bH.exec(bU[3])||"").length>1||/^\w/.test(bU[3])){bU[3]=by(bU[3],null,null,bR)}else{var bT=by.filter(bU[3],bR,bS,true^bV);if(!bS){e.push.apply(e,bT)}return false}}else{if(bE.match.POS.test(bU[0])||bE.match.CHILD.test(bU[0])){return true}}return bU},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bS,bR,e){return !!by(e[3],bS).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bS){var e=bS.getAttribute("type"),bR=bS.type;return bS.nodeName.toLowerCase()==="input"&&"text"===bR&&(e===bR||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bR.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bR){var e=bR.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bR.type},button:function(bR){var e=bR.nodeName.toLowerCase();return e==="input"&&"button"===bR.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bR,e){return e===0},last:function(bS,bR,e,bT){return bR===bT.length-1},even:function(bR,e){return e%2===0},odd:function(bR,e){return e%2===1},lt:function(bS,bR,e){return bR<e[3]-0},gt:function(bS,bR,e){return bR>e[3]-0},nth:function(bS,bR,e){return e[3]-0===bR},eq:function(bS,bR,e){return e[3]-0===bR}},filter:{PSEUDO:function(bS,bX,bW,bY){var e=bX[1],bR=bE.filters[e];if(bR){return bR(bS,bW,bX,bY)}else{if(e==="contains"){return(bS.textContent||bS.innerText||bw([bS])||"").indexOf(bX[3])>=0}else{if(e==="not"){var bT=bX[3];for(var bV=0,bU=bT.length;bV<bU;bV++){if(bT[bV]===bS){return false}}return true}else{by.error(e)}}}},CHILD:function(bS,bU){var bT,b0,bW,bZ,e,bV,bY,bX=bU[1],bR=bS;switch(bX){case"only":case"first":while((bR=bR.previousSibling)){if(bR.nodeType===1){return false}}if(bX==="first"){return true}bR=bS;case"last":while((bR=bR.nextSibling)){if(bR.nodeType===1){return false}}return true;case"nth":bT=bU[2];b0=bU[3];if(bT===1&&b0===0){return true}bW=bU[0];bZ=bS.parentNode;if(bZ&&(bZ[bC]!==bW||!bS.nodeIndex)){bV=0;for(bR=bZ.firstChild;bR;bR=bR.nextSibling){if(bR.nodeType===1){bR.nodeIndex=++bV}}bZ[bC]=bW}bY=bS.nodeIndex-b0;if(bT===0){return bY===0}else{return(bY%bT===0&&bY/bT>=0)}}},ID:function(bR,e){return bR.nodeType===1&&bR.getAttribute("id")===e},TAG:function(bR,e){return(e==="*"&&bR.nodeType===1)||!!bR.nodeName&&bR.nodeName.toLowerCase()===e},CLASS:function(bR,e){return(" "+(bR.className||bR.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bV,bT){var bS=bT[1],e=by.attr?by.attr(bV,bS):bE.attrHandle[bS]?bE.attrHandle[bS](bV):bV[bS]!=null?bV[bS]:bV.getAttribute(bS),bW=e+"",bU=bT[2],bR=bT[4];return e==null?bU==="!=":!bU&&by.attr?e!=null:bU==="="?bW===bR:bU==="*="?bW.indexOf(bR)>=0:bU==="~="?(" "+bW+" ").indexOf(bR)>=0:!bR?bW&&e!==false:bU==="!="?bW!==bR:bU==="^="?bW.indexOf(bR)===0:bU==="$="?bW.substr(bW.length-bR.length)===bR:bU==="|="?bW===bR||bW.substr(0,bR.length+1)===bR+"-":false},POS:function(bU,bR,bS,bV){var e=bR[2],bT=bE.setFilters[e];if(bT){return bT(bU,bS,bR,bV)}}}};var bD=bE.match.POS,bx=function(bR,e){return"\\"+(e-0+1)};for(var bz in bE.match){bE.match[bz]=new RegExp(bE.match[bz].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bE.leftMatch[bz]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bE.match[bz].source.replace(/\\(\d+)/g,bx))}var bF=function(bR,e){bR=Array.prototype.slice.call(bR,0);if(e){e.push.apply(e,bR);return e}return bR};try{Array.prototype.slice.call(av.documentElement.childNodes,0)[0].nodeType}catch(bP){bF=function(bU,bT){var bS=0,bR=bT||[];if(bL.call(bU)==="[object Array]"){Array.prototype.push.apply(bR,bU)}else{if(typeof bU.length==="number"){for(var e=bU.length;bS<e;bS++){bR.push(bU[bS])}}else{for(;bU[bS];bS++){bR.push(bU[bS])}}}return bR}}var bJ,bG;if(av.documentElement.compareDocumentPosition){bJ=function(bR,e){if(bR===e){bB=true;return 0}if(!bR.compareDocumentPosition||!e.compareDocumentPosition){return bR.compareDocumentPosition?-1:1}return bR.compareDocumentPosition(e)&4?-1:1}}else{bJ=function(bY,bX){if(bY===bX){bB=true;return 0}else{if(bY.sourceIndex&&bX.sourceIndex){return bY.sourceIndex-bX.sourceIndex}}var bV,bR,bS=[],e=[],bU=bY.parentNode,bW=bX.parentNode,bZ=bU;if(bU===bW){return bG(bY,bX)}else{if(!bU){return -1}else{if(!bW){return 1}}}while(bZ){bS.unshift(bZ);bZ=bZ.parentNode}bZ=bW;while(bZ){e.unshift(bZ);bZ=bZ.parentNode}bV=bS.length;bR=e.length;for(var bT=0;bT<bV&&bT<bR;bT++){if(bS[bT]!==e[bT]){return bG(bS[bT],e[bT])}}return bT===bV?bG(bY,e[bT],-1):bG(bS[bT],bX,1)};bG=function(bR,e,bS){if(bR===e){return bS}var bT=bR.nextSibling;while(bT){if(bT===e){return -1}bT=bT.nextSibling}return 1}}(function(){var bR=av.createElement("div"),bS="script"+(new Date()).getTime(),e=av.documentElement;bR.innerHTML="<a name='"+bS+"'/>";e.insertBefore(bR,e.firstChild);if(av.getElementById(bS)){bE.find.ID=function(bU,bV,bW){if(typeof bV.getElementById!=="undefined"&&!bW){var bT=bV.getElementById(bU[1]);return bT?bT.id===bU[1]||typeof bT.getAttributeNode!=="undefined"&&bT.getAttributeNode("id").nodeValue===bU[1]?[bT]:L:[]}};bE.filter.ID=function(bV,bT){var bU=typeof bV.getAttributeNode!=="undefined"&&bV.getAttributeNode("id");return bV.nodeType===1&&bU&&bU.nodeValue===bT}}e.removeChild(bR);e=bR=null})();(function(){var e=av.createElement("div");e.appendChild(av.createComment(""));if(e.getElementsByTagName("*").length>0){bE.find.TAG=function(bR,bV){var bU=bV.getElementsByTagName(bR[1]);if(bR[1]==="*"){var bT=[];for(var bS=0;bU[bS];bS++){if(bU[bS].nodeType===1){bT.push(bU[bS])}}bU=bT}return bU}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bE.attrHandle.href=function(bR){return bR.getAttribute("href",2)}}e=null})();if(av.querySelectorAll){(function(){var e=by,bT=av.createElement("div"),bS="__sizzle__";bT.innerHTML="<p class='TEST'></p>";if(bT.querySelectorAll&&bT.querySelectorAll(".TEST").length===0){return}by=function(b4,bV,bZ,b3){bV=bV||av;if(!b3&&!by.isXML(bV)){var b2=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b4);if(b2&&(bV.nodeType===1||bV.nodeType===9)){if(b2[1]){return bF(bV.getElementsByTagName(b4),bZ)}else{if(b2[2]&&bE.find.CLASS&&bV.getElementsByClassName){return bF(bV.getElementsByClassName(b2[2]),bZ)}}}if(bV.nodeType===9){if(b4==="body"&&bV.body){return bF([bV.body],bZ)}else{if(b2&&b2[3]){var bY=bV.getElementById(b2[3]);if(bY&&bY.parentNode){if(bY.id===b2[3]){return bF([bY],bZ)}}else{return bF([],bZ)}}}try{return bF(bV.querySelectorAll(b4),bZ)}catch(b0){}}else{if(bV.nodeType===1&&bV.nodeName.toLowerCase()!=="object"){var bW=bV,bX=bV.getAttribute("id"),bU=bX||bS,b6=bV.parentNode,b5=/^\s*[+~]/.test(b4);if(!bX){bV.setAttribute("id",bU)}else{bU=bU.replace(/'/g,"\\$&")}if(b5&&b6){bV=bV.parentNode}try{if(!b5||b6){return bF(bV.querySelectorAll("[id='"+bU+"'] "+b4),bZ)}}catch(b1){}finally{if(!bX){bW.removeAttribute("id")}}}}}return e(b4,bV,bZ,b3)};for(var bR in e){by[bR]=e[bR]}bT=null})()}(function(){var e=av.documentElement,bS=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bS){var bU=!bS.call(av.createElement("div"),"div"),bR=false;try{bS.call(av.documentElement,"[test!='']:sizzle")}catch(bT){bR=true}by.matchesSelector=function(bW,bY){bY=bY.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!by.isXML(bW)){try{if(bR||!bE.match.PSEUDO.test(bY)&&!/!=/.test(bY)){var bV=bS.call(bW,bY);if(bV||!bU||bW.document&&bW.document.nodeType!==11){return bV}}}catch(bX){}}return by(bY,null,null,[bW]).length>0}}})();(function(){var e=av.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bE.order.splice(1,0,"CLASS");bE.find.CLASS=function(bR,bS,bT){if(typeof bS.getElementsByClassName!=="undefined"&&!bT){return bS.getElementsByClassName(bR[1])}};e=null})();function bv(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1&&!bY){e[bC]=bV;e.sizset=bT}if(e.nodeName.toLowerCase()===bW){bU=e;break}e=e[bR]}bZ[bT]=bU}}}function bN(bR,bW,bV,bZ,bX,bY){for(var bT=0,bS=bZ.length;bT<bS;bT++){var e=bZ[bT];if(e){var bU=false;e=e[bR];while(e){if(e[bC]===bV){bU=bZ[e.sizset];break}if(e.nodeType===1){if(!bY){e[bC]=bV;e.sizset=bT}if(typeof bW!=="string"){if(e===bW){bU=true;break}}else{if(by.filter(bW,[e]).length>0){bU=e;break}}}e=e[bR]}bZ[bT]=bU}}}if(av.documentElement.contains){by.contains=function(bR,e){return bR!==e&&(bR.contains?bR.contains(e):true)}}else{if(av.documentElement.compareDocumentPosition){by.contains=function(bR,e){return !!(bR.compareDocumentPosition(e)&16)}}else{by.contains=function(){return false}}}by.isXML=function(e){var bR=(e?e.ownerDocument||e:0).documentElement;return bR?bR.nodeName!=="HTML":false};var bM=function(bS,e,bW){var bV,bX=[],bU="",bY=e.nodeType?[e]:e;while((bV=bE.match.PSEUDO.exec(bS))){bU+=bV[0];bS=bS.replace(bE.match.PSEUDO,"")}bS=bE.relative[bS]?bS+"*":bS;for(var bT=0,bR=bY.length;bT<bR;bT++){by(bS,bY[bT],bX,bW)}return by.filter(bU,bX)};by.attr=b.attr;by.selectors.attrMap={};b.find=by;b.expr=by.selectors;b.expr[":"]=b.expr.filters;b.unique=by.uniqueSort;b.text=by.getText;b.isXMLDoc=by.isXML;b.contains=by.contains})();var ab=/Until$/,aq=/^(?:parents|prevUntil|prevAll)/,a9=/,/,bp=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,H=b.expr.match.POS,ay={children:true,contents:true,next:true,prev:true};b.fn.extend({find:function(e){var bw=this,by,bv;if(typeof e!=="string"){return b(e).filter(function(){for(by=0,bv=bw.length;by<bv;by++){if(b.contains(bw[by],this)){return true}}})}var bx=this.pushStack("","find",e),bA,bB,bz;for(by=0,bv=this.length;by<bv;by++){bA=bx.length;b.find(e,this[by],bx);if(by>0){for(bB=bA;bB<bx.length;bB++){for(bz=0;bz<bA;bz++){if(bx[bz]===bx[bB]){bx.splice(bB--,1);break}}}}}return bx},has:function(bv){var e=b(bv);return this.filter(function(){for(var bx=0,bw=e.length;bx<bw;bx++){if(b.contains(this,e[bx])){return true}}})},not:function(e){return this.pushStack(aG(this,e,false),"not",e)},filter:function(e){return this.pushStack(aG(this,e,true),"filter",e)},is:function(e){return !!e&&(typeof e==="string"?H.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(by,bx){var bv=[],bw,e,bz=this[0];if(b.isArray(by)){var bB=1;while(bz&&bz.ownerDocument&&bz!==bx){for(bw=0;bw<by.length;bw++){if(b(bz).is(by[bw])){bv.push({selector:by[bw],elem:bz,level:bB})}}bz=bz.parentNode;bB++}return bv}var bA=H.test(by)||typeof by!=="string"?b(by,bx||this.context):0;for(bw=0,e=this.length;bw<e;bw++){bz=this[bw];while(bz){if(bA?bA.index(bz)>-1:b.find.matchesSelector(bz,by)){bv.push(bz);break}else{bz=bz.parentNode;if(!bz||!bz.ownerDocument||bz===bx||bz.nodeType===11){break}}}}bv=bv.length>1?b.unique(bv):bv;return this.pushStack(bv,"closest",by)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bv){var bx=typeof e==="string"?b(e,bv):b.makeArray(e&&e.nodeType?[e]:e),bw=b.merge(this.get(),bx);return this.pushStack(C(bx[0])||C(bw[0])?bw:b.unique(bw))},andSelf:function(){return this.add(this.prevObject)}});function C(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bv){var e=bv.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bv,e,bw){return b.dir(bv,"parentNode",bw)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bv,e,bw){return b.dir(bv,"nextSibling",bw)},prevUntil:function(bv,e,bw){return b.dir(bv,"previousSibling",bw)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bv){b.fn[e]=function(by,bw){var bx=b.map(this,bv,by);if(!ab.test(e)){bw=by}if(bw&&typeof bw==="string"){bx=b.filter(bw,bx)}bx=this.length>1&&!ay[e]?b.unique(bx):bx;if((this.length>1||a9.test(bw))&&aq.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,P.call(arguments).join(","))}});b.extend({filter:function(bw,e,bv){if(bv){bw=":not("+bw+")"}return e.length===1?b.find.matchesSelector(e[0],bw)?[e[0]]:[]:b.find.matches(bw,e)},dir:function(bw,bv,by){var e=[],bx=bw[bv];while(bx&&bx.nodeType!==9&&(by===L||bx.nodeType!==1||!b(bx).is(by))){if(bx.nodeType===1){e.push(bx)}bx=bx[bv]}return e},nth:function(by,e,bw,bx){e=e||1;var bv=0;for(;by;by=by[bw]){if(by.nodeType===1&&++bv===e){break}}return by},sibling:function(bw,bv){var e=[];for(;bw;bw=bw.nextSibling){if(bw.nodeType===1&&bw!==bv){e.push(bw)}}return e}});function aG(bx,bw,e){bw=bw||0;if(b.isFunction(bw)){return b.grep(bx,function(bz,by){var bA=!!bw.call(bz,by,bz);return bA===e})}else{if(bw.nodeType){return b.grep(bx,function(bz,by){return(bz===bw)===e})}else{if(typeof bw==="string"){var bv=b.grep(bx,function(by){return by.nodeType===1});if(bp.test(bw)){return b.filter(bw,bv,!e)}else{bw=b.filter(bw,bv)}}}}return b.grep(bx,function(bz,by){return(b.inArray(bz,bw)>=0)===e})}function a(e){var bw=aR.split("|"),bv=e.createDocumentFragment();if(bv.createElement){while(bw.length){bv.createElement(bw.pop())}}return bv}var aR="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ag=/ jQuery\d+="(?:\d+|null)"/g,ar=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,d=/<([\w:]+)/,w=/<tbody/i,W=/<|&#?\w+;/,ae=/<(?:script|style)/i,O=/<(?:script|object|embed|option|style)/i,ah=new RegExp("<(?:"+aR+")","i"),o=/checked\s*(?:[^=]|=\s*.checked.)/i,bm=/\/(java|ecma)script/i,aN=/^\s*<!(?:\[CDATA\[|\-\-)/,ax={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ac=a(av);ax.optgroup=ax.option;ax.tbody=ax.tfoot=ax.colgroup=ax.caption=ax.thead;ax.th=ax.td;if(!b.support.htmlSerialize){ax._default=[1,"div<div>","</div>"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this);bv.text(e.call(this,bw,bv.text()))})}if(typeof e!=="object"&&e!==L){return this.empty().append((this[0]&&this[0].ownerDocument||av).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bw){b(this).wrapAll(e.call(this,bw))})}if(this[0]){var bv=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bv.insertBefore(this[0])}bv.map(function(){var bw=this;while(bw.firstChild&&bw.firstChild.nodeType===1){bw=bw.firstChild}return bw}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapInner(e.call(this,bv))})}return this.each(function(){var bv=b(this),bw=bv.contents();if(bw.length){bw.wrapAll(e)}else{bv.append(e)}})},wrap:function(e){var bv=b.isFunction(e);return this.each(function(bw){b(this).wrapAll(bv?e.call(this,bw):e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this)})}else{if(arguments.length){var e=b.clean(arguments);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bv){this.parentNode.insertBefore(bv,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b.clean(arguments));return e}}},remove:function(e,bx){for(var bv=0,bw;(bw=this[bv])!=null;bv++){if(!e||b.filter(e,[bw]).length){if(!bx&&bw.nodeType===1){b.cleanData(bw.getElementsByTagName("*"));b.cleanData([bw])}if(bw.parentNode){bw.parentNode.removeChild(bw)}}}return this},empty:function(){for(var e=0,bv;(bv=this[e])!=null;e++){if(bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"))}while(bv.firstChild){bv.removeChild(bv.firstChild)}}return this},clone:function(bv,e){bv=bv==null?false:bv;e=e==null?bv:e;return this.map(function(){return b.clone(this,bv,e)})},html:function(bx){if(bx===L){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ag,""):null}else{if(typeof bx==="string"&&!ae.test(bx)&&(b.support.leadingWhitespace||!ar.test(bx))&&!ax[(d.exec(bx)||["",""])[1].toLowerCase()]){bx=bx.replace(R,"<$1></$2>");try{for(var bw=0,bv=this.length;bw<bv;bw++){if(this[bw].nodeType===1){b.cleanData(this[bw].getElementsByTagName("*"));this[bw].innerHTML=bx}}}catch(by){this.empty().append(bx)}}else{if(b.isFunction(bx)){this.each(function(bz){var e=b(this);e.html(bx.call(this,bz,e.html()))})}else{this.empty().append(bx)}}}return this},replaceWith:function(e){if(this[0]&&this[0].parentNode){if(b.isFunction(e)){return this.each(function(bx){var bw=b(this),bv=bw.html();bw.replaceWith(e.call(this,bx,bv))})}if(typeof e!=="string"){e=b(e).detach()}return this.each(function(){var bw=this.nextSibling,bv=this.parentNode;b(this).remove();if(bw){b(bw).before(e)}else{b(bv).append(e)}})}else{return this.length?this.pushStack(b(b.isFunction(e)?e():e),"replaceWith",e):this}},detach:function(e){return this.remove(e,true)},domManip:function(bB,bF,bE){var bx,by,bA,bD,bC=bB[0],bv=[];if(!b.support.checkClone&&arguments.length===3&&typeof bC==="string"&&o.test(bC)){return this.each(function(){b(this).domManip(bB,bF,bE,true)})}if(b.isFunction(bC)){return this.each(function(bH){var bG=b(this);bB[0]=bC.call(this,bH,bF?bG.html():L);bG.domManip(bB,bF,bE)})}if(this[0]){bD=bC&&bC.parentNode;if(b.support.parentNode&&bD&&bD.nodeType===11&&bD.childNodes.length===this.length){bx={fragment:bD}}else{bx=b.buildFragment(bB,this,bv)}bA=bx.fragment;if(bA.childNodes.length===1){by=bA=bA.firstChild}else{by=bA.firstChild}if(by){bF=bF&&b.nodeName(by,"tr");for(var bw=0,e=this.length,bz=e-1;bw<e;bw++){bE.call(bF?ba(this[bw],by):this[bw],bx.cacheable||(e>1&&bw<bz)?b.clone(bA,true,true):bA)}}if(bv.length){b.each(bv,bo)}}return this}});function ba(e,bv){return b.nodeName(e,"table")?(e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody"))):e}function t(bB,bv){if(bv.nodeType!==1||!b.hasData(bB)){return}var by,bx,e,bA=b._data(bB),bz=b._data(bv,bA),bw=bA.events;if(bw){delete bz.handle;bz.events={};for(by in bw){for(bx=0,e=bw[by].length;bx<e;bx++){b.event.add(bv,by+(bw[by][bx].namespace?".":"")+bw[by][bx].namespace,bw[by][bx],bw[by][bx].data)}}}if(bz.data){bz.data=b.extend({},bz.data)}}function ai(bv,e){var bw;if(e.nodeType!==1){return}if(e.clearAttributes){e.clearAttributes()}if(e.mergeAttributes){e.mergeAttributes(bv)}bw=e.nodeName.toLowerCase();if(bw==="object"){e.outerHTML=bv.outerHTML}else{if(bw==="input"&&(bv.type==="checkbox"||bv.type==="radio")){if(bv.checked){e.defaultChecked=e.checked=bv.checked}if(e.value!==bv.value){e.value=bv.value}}else{if(bw==="option"){e.selected=bv.defaultSelected}else{if(bw==="input"||bw==="textarea"){e.defaultValue=bv.defaultValue}}}}e.removeAttribute(b.expando)}b.buildFragment=function(bz,bx,bv){var by,e,bw,bA,bB=bz[0];if(bx&&bx[0]){bA=bx[0].ownerDocument||bx[0]}if(!bA.createDocumentFragment){bA=av}if(bz.length===1&&typeof bB==="string"&&bB.length<512&&bA===av&&bB.charAt(0)==="<"&&!O.test(bB)&&(b.support.checkClone||!o.test(bB))&&(b.support.html5Clone||!ah.test(bB))){e=true;bw=b.fragments[bB];if(bw&&bw!==1){by=bw}}if(!by){by=bA.createDocumentFragment();b.clean(bz,bA,by,bv)}if(e){b.fragments[bB]=bw?by:1}return{fragment:by,cacheable:e}};b.fragments={};b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,bv){b.fn[e]=function(bw){var bz=[],bC=b(bw),bB=this.length===1&&this[0].parentNode;if(bB&&bB.nodeType===11&&bB.childNodes.length===1&&bC.length===1){bC[bv](this[0]);return this}else{for(var bA=0,bx=bC.length;bA<bx;bA++){var by=(bA>0?this.clone(true):this).get();b(bC[bA])[bv](by);bz=bz.concat(by)}return this.pushStack(bz,e,bC.selector)}}});function bg(e){if(typeof e.getElementsByTagName!=="undefined"){return e.getElementsByTagName("*")}else{if(typeof e.querySelectorAll!=="undefined"){return e.querySelectorAll("*")}else{return[]}}}function az(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function E(e){var bv=(e.nodeName||"").toLowerCase();if(bv==="input"){az(e)}else{if(bv!=="script"&&typeof e.getElementsByTagName!=="undefined"){b.grep(e.getElementsByTagName("input"),az)}}}function al(e){var bv=av.createElement("div");ac.appendChild(bv);bv.innerHTML=e.outerHTML;return bv.firstChild}b.extend({clone:function(by,bA,bw){var e,bv,bx,bz=b.support.html5Clone||!ah.test("<"+by.nodeName)?by.cloneNode(true):al(by);if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(by.nodeType===1||by.nodeType===11)&&!b.isXMLDoc(by)){ai(by,bz);e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){if(bv[bx]){ai(e[bx],bv[bx])}}}if(bA){t(by,bz);if(bw){e=bg(by);bv=bg(bz);for(bx=0;e[bx];++bx){t(e[bx],bv[bx])}}}e=bv=null;return bz},clean:function(bw,by,bH,bA){var bF;by=by||av;if(typeof by.createElement==="undefined"){by=by.ownerDocument||by[0]&&by[0].ownerDocument||av}var bI=[],bB;for(var bE=0,bz;(bz=bw[bE])!=null;bE++){if(typeof bz==="number"){bz+=""}if(!bz){continue}if(typeof bz==="string"){if(!W.test(bz)){bz=by.createTextNode(bz)}else{bz=bz.replace(R,"<$1></$2>");var bK=(d.exec(bz)||["",""])[1].toLowerCase(),bx=ax[bK]||ax._default,bD=bx[0],bv=by.createElement("div");if(by===av){ac.appendChild(bv)}else{a(by).appendChild(bv)}bv.innerHTML=bx[1]+bz+bx[2];while(bD--){bv=bv.lastChild}if(!b.support.tbody){var e=w.test(bz),bC=bK==="table"&&!e?bv.firstChild&&bv.firstChild.childNodes:bx[1]==="<table>"&&!e?bv.childNodes:[];for(bB=bC.length-1;bB>=0;--bB){if(b.nodeName(bC[bB],"tbody")&&!bC[bB].childNodes.length){bC[bB].parentNode.removeChild(bC[bB])}}}if(!b.support.leadingWhitespace&&ar.test(bz)){bv.insertBefore(by.createTextNode(ar.exec(bz)[0]),bv.firstChild)}bz=bv.childNodes}}var bG;if(!b.support.appendChecked){if(bz[0]&&typeof(bG=bz.length)==="number"){for(bB=0;bB<bG;bB++){E(bz[bB])}}else{E(bz)}}if(bz.nodeType){bI.push(bz)}else{bI=b.merge(bI,bz)}}if(bH){bF=function(bL){return !bL.type||bm.test(bL.type)};for(bE=0;bI[bE];bE++){if(bA&&b.nodeName(bI[bE],"script")&&(!bI[bE].type||bI[bE].type.toLowerCase()==="text/javascript")){bA.push(bI[bE].parentNode?bI[bE].parentNode.removeChild(bI[bE]):bI[bE])}else{if(bI[bE].nodeType===1){var bJ=b.grep(bI[bE].getElementsByTagName("script"),bF);bI.splice.apply(bI,[bE+1,0].concat(bJ))}bH.appendChild(bI[bE])}}}return bI},cleanData:function(bv){var by,bw,e=b.cache,bB=b.event.special,bA=b.support.deleteExpando;for(var bz=0,bx;(bx=bv[bz])!=null;bz++){if(bx.nodeName&&b.noData[bx.nodeName.toLowerCase()]){continue}bw=bx[b.expando];if(bw){by=e[bw];if(by&&by.events){for(var bC in by.events){if(bB[bC]){b.event.remove(bx,bC)}else{b.removeEvent(bx,bC,by.handle)}}if(by.handle){by.handle.elem=null}}if(bA){delete bx[b.expando]}else{if(bx.removeAttribute){bx.removeAttribute(b.expando)}}delete e[bw]}}}});function bo(e,bv){if(bv.src){b.ajax({url:bv.src,async:false,dataType:"script"})}else{b.globalEval((bv.text||bv.textContent||bv.innerHTML||"").replace(aN,"/*$0*/"))}if(bv.parentNode){bv.parentNode.removeChild(bv)}}var ak=/alpha\([^)]*\)/i,au=/opacity=([^)]*)/,z=/([A-Z]|^ms)/g,bc=/^-?\d+(?:px)?$/i,bn=/^-?\d/,I=/^([\-+])=([\-+.\de]+)/,a7={position:"absolute",visibility:"hidden",display:"block"},an=["Left","Right"],a1=["Top","Bottom"],Z,aI,aX;b.fn.css=function(e,bv){if(arguments.length===2&&bv===L){return this}return b.access(this,e,bv,true,function(bx,bw,by){return by!==L?b.style(bx,bw,by):b.css(bx,bw)})};b.extend({cssHooks:{opacity:{get:function(bw,bv){if(bv){var e=Z(bw,"opacity","opacity");return e===""?"1":e}else{return bw.style.opacity}}}},cssNumber:{fillOpacity:true,fontWeight:true,lineHeight:true,opacity:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(bx,bw,bD,by){if(!bx||bx.nodeType===3||bx.nodeType===8||!bx.style){return}var bB,bC,bz=b.camelCase(bw),bv=bx.style,bE=b.cssHooks[bz];bw=b.cssProps[bz]||bz;if(bD!==L){bC=typeof bD;if(bC==="string"&&(bB=I.exec(bD))){bD=(+(bB[1]+1)*+bB[2])+parseFloat(b.css(bx,bw));bC="number"}if(bD==null||bC==="number"&&isNaN(bD)){return}if(bC==="number"&&!b.cssNumber[bz]){bD+="px"}if(!bE||!("set" in bE)||(bD=bE.set(bx,bD))!==L){try{bv[bw]=bD}catch(bA){}}}else{if(bE&&"get" in bE&&(bB=bE.get(bx,false,by))!==L){return bB}return bv[bw]}},css:function(by,bx,bv){var bw,e;bx=b.camelCase(bx);e=b.cssHooks[bx];bx=b.cssProps[bx]||bx;if(bx==="cssFloat"){bx="float"}if(e&&"get" in e&&(bw=e.get(by,true,bv))!==L){return bw}else{if(Z){return Z(by,bx)}}},swap:function(bx,bw,by){var e={};for(var bv in bw){e[bv]=bx.style[bv];bx.style[bv]=bw[bv]}by.call(bx);for(bv in bw){bx.style[bv]=e[bv]}}});b.curCSS=b.css;b.each(["height","width"],function(bv,e){b.cssHooks[e]={get:function(by,bx,bw){var bz;if(bx){if(by.offsetWidth!==0){return p(by,e,bw)}else{b.swap(by,a7,function(){bz=p(by,e,bw)})}return bz}},set:function(bw,bx){if(bc.test(bx)){bx=parseFloat(bx);if(bx>=0){return bx+"px"}}else{return bx}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bv,e){return au.test((e&&bv.currentStyle?bv.currentStyle.filter:bv.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(by,bz){var bx=by.style,bv=by.currentStyle,e=b.isNumeric(bz)?"alpha(opacity="+bz*100+")":"",bw=bv&&bv.filter||bx.filter||"";bx.zoom=1;if(bz>=1&&b.trim(bw.replace(ak,""))===""){bx.removeAttribute("filter");if(bv&&!bv.filter){return}}bx.filter=ak.test(bw)?bw.replace(ak,e):bw+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bw,bv){var e;b.swap(bw,{display:"inline-block"},function(){if(bv){e=Z(bw,"margin-right","marginRight")}else{e=bw.style.marginRight}});return e}}}});if(av.defaultView&&av.defaultView.getComputedStyle){aI=function(by,bw){var bv,bx,e;bw=bw.replace(z,"-$1").toLowerCase();if((bx=by.ownerDocument.defaultView)&&(e=bx.getComputedStyle(by,null))){bv=e.getPropertyValue(bw);if(bv===""&&!b.contains(by.ownerDocument.documentElement,by)){bv=b.style(by,bw)}}return bv}}if(av.documentElement.currentStyle){aX=function(bz,bw){var bA,e,by,bv=bz.currentStyle&&bz.currentStyle[bw],bx=bz.style;if(bv===null&&bx&&(by=bx[bw])){bv=by}if(!bc.test(bv)&&bn.test(bv)){bA=bx.left;e=bz.runtimeStyle&&bz.runtimeStyle.left;if(e){bz.runtimeStyle.left=bz.currentStyle.left}bx.left=bw==="fontSize"?"1em":(bv||0);bv=bx.pixelLeft+"px";bx.left=bA;if(e){bz.runtimeStyle.left=e}}return bv===""?"auto":bv}}Z=aI||aX;function p(by,bw,bv){var bA=bw==="width"?by.offsetWidth:by.offsetHeight,bz=bw==="width"?an:a1,bx=0,e=bz.length;if(bA>0){if(bv!=="border"){for(;bx<e;bx++){if(!bv){bA-=parseFloat(b.css(by,"padding"+bz[bx]))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}else{bA-=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}}}return bA+"px"}bA=Z(by,bw,bw);if(bA<0||bA==null){bA=by.style[bw]||0}bA=parseFloat(bA)||0;if(bv){for(;bx<e;bx++){bA+=parseFloat(b.css(by,"padding"+bz[bx]))||0;if(bv!=="padding"){bA+=parseFloat(b.css(by,"border"+bz[bx]+"Width"))||0}if(bv==="margin"){bA+=parseFloat(b.css(by,bv+bz[bx]))||0}}}return bA+"px"}if(b.expr&&b.expr.filters){b.expr.filters.hidden=function(bw){var bv=bw.offsetWidth,e=bw.offsetHeight;return(bv===0&&e===0)||(!b.support.reliableHiddenOffsets&&((bw.style&&bw.style.display)||b.css(bw,"display"))==="none")};b.expr.filters.visible=function(e){return !b.expr.filters.hidden(e)}}var k=/%20/g,ap=/\[\]$/,bs=/\r?\n/g,bq=/#.*$/,aD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,aZ=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,aM=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,aQ=/^(?:GET|HEAD)$/,c=/^\/\//,M=/\?/,a6=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,q=/^(?:select|textarea)/i,h=/\s+/,br=/([?&])_=[^&]*/,K=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,A=b.fn.load,aa={},r={},aE,s,aV=["*/"]+["*"];try{aE=bl.href}catch(aw){aE=av.createElement("a");aE.href="";aE=aE.href}s=K.exec(aE.toLowerCase())||[];function f(e){return function(by,bA){if(typeof by!=="string"){bA=by;by="*"}if(b.isFunction(bA)){var bx=by.toLowerCase().split(h),bw=0,bz=bx.length,bv,bB,bC;for(;bw<bz;bw++){bv=bx[bw];bC=/^\+/.test(bv);if(bC){bv=bv.substr(1)||"*"}bB=e[bv]=e[bv]||[];bB[bC?"unshift":"push"](bA)}}}}function aW(bv,bE,bz,bD,bB,bx){bB=bB||bE.dataTypes[0];bx=bx||{};bx[bB]=true;var bA=bv[bB],bw=0,e=bA?bA.length:0,by=(bv===aa),bC;for(;bw<e&&(by||!bC);bw++){bC=bA[bw](bE,bz,bD);if(typeof bC==="string"){if(!by||bx[bC]){bC=L}else{bE.dataTypes.unshift(bC);bC=aW(bv,bE,bz,bD,bC,bx)}}}if((by||!bC)&&!bx["*"]){bC=aW(bv,bE,bz,bD,"*",bx)}return bC}function am(bw,bx){var bv,e,by=b.ajaxSettings.flatOptions||{};for(bv in bx){if(bx[bv]!==L){(by[bv]?bw:(e||(e={})))[bv]=bx[bv]}}if(e){b.extend(true,bw,e)}}b.fn.extend({load:function(bw,bz,bA){if(typeof bw!=="string"&&A){return A.apply(this,arguments)}else{if(!this.length){return this}}var by=bw.indexOf(" ");if(by>=0){var e=bw.slice(by,bw.length);bw=bw.slice(0,by)}var bx="GET";if(bz){if(b.isFunction(bz)){bA=bz;bz=L}else{if(typeof bz==="object"){bz=b.param(bz,b.ajaxSettings.traditional);bx="POST"}}}var bv=this;b.ajax({url:bw,type:bx,dataType:"html",data:bz,complete:function(bC,bB,bD){bD=bC.responseText;if(bC.isResolved()){bC.done(function(bE){bD=bE});bv.html(e?b("<div>").append(bD.replace(a6,"")).find(e):bD)}if(bA){bv.each(bA,[bD,bB,bC])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||q.test(this.nodeName)||aZ.test(this.type))}).map(function(e,bv){var bw=b(this).val();return bw==null?null:b.isArray(bw)?b.map(bw,function(by,bx){return{name:bv.name,value:by.replace(bs,"\r\n")}}):{name:bv.name,value:bw.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bv){b.fn[bv]=function(bw){return this.on(bv,bw)}});b.each(["get","post"],function(e,bv){b[bv]=function(bw,by,bz,bx){if(b.isFunction(by)){bx=bx||bz;bz=by;by=L}return b.ajax({type:bv,url:bw,data:by,success:bz,dataType:bx})}});b.extend({getScript:function(e,bv){return b.get(e,L,bv,"script")},getJSON:function(e,bv,bw){return b.get(e,bv,bw,"json")},ajaxSetup:function(bv,e){if(e){am(bv,b.ajaxSettings)}else{e=bv;bv=b.ajaxSettings}am(bv,e);return bv},ajaxSettings:{url:aE,isLocal:aM.test(s[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aV},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":bb.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:f(aa),ajaxTransport:f(r),ajax:function(bz,bx){if(typeof bz==="object"){bx=bz;bz=L}bx=bx||{};var bD=b.ajaxSetup({},bx),bS=bD.context||bD,bG=bS!==bD&&(bS.nodeType||bS instanceof b)?b(bS):b.event,bR=b.Deferred(),bN=b.Callbacks("once memory"),bB=bD.statusCode||{},bC,bH={},bO={},bQ,by,bL,bE,bI,bA=0,bw,bK,bJ={readyState:0,setRequestHeader:function(bT,bU){if(!bA){var e=bT.toLowerCase();bT=bO[e]=bO[e]||bT;bH[bT]=bU}return this},getAllResponseHeaders:function(){return bA===2?bQ:null},getResponseHeader:function(bT){var e;if(bA===2){if(!by){by={};while((e=aD.exec(bQ))){by[e[1].toLowerCase()]=e[2]}}e=by[bT.toLowerCase()]}return e===L?null:e},overrideMimeType:function(e){if(!bA){bD.mimeType=e}return this},abort:function(e){e=e||"abort";if(bL){bL.abort(e)}bF(0,e);return this}};function bF(bZ,bU,b0,bW){if(bA===2){return}bA=2;if(bE){clearTimeout(bE)}bL=L;bQ=bW||"";bJ.readyState=bZ>0?4:0;var bT,b4,b3,bX=bU,bY=b0?bj(bD,bJ,b0):L,bV,b2;if(bZ>=200&&bZ<300||bZ===304){if(bD.ifModified){if((bV=bJ.getResponseHeader("Last-Modified"))){b.lastModified[bC]=bV}if((b2=bJ.getResponseHeader("Etag"))){b.etag[bC]=b2}}if(bZ===304){bX="notmodified";bT=true}else{try{b4=G(bD,bY);bX="success";bT=true}catch(b1){bX="parsererror";b3=b1}}}else{b3=bX;if(!bX||bZ){bX="error";if(bZ<0){bZ=0}}}bJ.status=bZ;bJ.statusText=""+(bU||bX);if(bT){bR.resolveWith(bS,[b4,bX,bJ])}else{bR.rejectWith(bS,[bJ,bX,b3])}bJ.statusCode(bB);bB=L;if(bw){bG.trigger("ajax"+(bT?"Success":"Error"),[bJ,bD,bT?b4:b3])}bN.fireWith(bS,[bJ,bX]);if(bw){bG.trigger("ajaxComplete",[bJ,bD]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bR.promise(bJ);bJ.success=bJ.done;bJ.error=bJ.fail;bJ.complete=bN.add;bJ.statusCode=function(bT){if(bT){var e;if(bA<2){for(e in bT){bB[e]=[bB[e],bT[e]]}}else{e=bT[bJ.status];bJ.then(e,e)}}return this};bD.url=((bz||bD.url)+"").replace(bq,"").replace(c,s[1]+"//");bD.dataTypes=b.trim(bD.dataType||"*").toLowerCase().split(h);if(bD.crossDomain==null){bI=K.exec(bD.url.toLowerCase());bD.crossDomain=!!(bI&&(bI[1]!=s[1]||bI[2]!=s[2]||(bI[3]||(bI[1]==="http:"?80:443))!=(s[3]||(s[1]==="http:"?80:443))))}if(bD.data&&bD.processData&&typeof bD.data!=="string"){bD.data=b.param(bD.data,bD.traditional)}aW(aa,bD,bx,bJ);if(bA===2){return false}bw=bD.global;bD.type=bD.type.toUpperCase();bD.hasContent=!aQ.test(bD.type);if(bw&&b.active++===0){b.event.trigger("ajaxStart")}if(!bD.hasContent){if(bD.data){bD.url+=(M.test(bD.url)?"&":"?")+bD.data;delete bD.data}bC=bD.url;if(bD.cache===false){var bv=b.now(),bP=bD.url.replace(br,"$1_="+bv);bD.url=bP+((bP===bD.url)?(M.test(bD.url)?"&":"?")+"_="+bv:"")}}if(bD.data&&bD.hasContent&&bD.contentType!==false||bx.contentType){bJ.setRequestHeader("Content-Type",bD.contentType)}if(bD.ifModified){bC=bC||bD.url;if(b.lastModified[bC]){bJ.setRequestHeader("If-Modified-Since",b.lastModified[bC])}if(b.etag[bC]){bJ.setRequestHeader("If-None-Match",b.etag[bC])}}bJ.setRequestHeader("Accept",bD.dataTypes[0]&&bD.accepts[bD.dataTypes[0]]?bD.accepts[bD.dataTypes[0]]+(bD.dataTypes[0]!=="*"?", "+aV+"; q=0.01":""):bD.accepts["*"]);for(bK in bD.headers){bJ.setRequestHeader(bK,bD.headers[bK])}if(bD.beforeSend&&(bD.beforeSend.call(bS,bJ,bD)===false||bA===2)){bJ.abort();return false}for(bK in {success:1,error:1,complete:1}){bJ[bK](bD[bK])}bL=aW(r,bD,bx,bJ);if(!bL){bF(-1,"No Transport")}else{bJ.readyState=1;if(bw){bG.trigger("ajaxSend",[bJ,bD])}if(bD.async&&bD.timeout>0){bE=setTimeout(function(){bJ.abort("timeout")},bD.timeout)}try{bA=1;bL.send(bH,bF)}catch(bM){if(bA<2){bF(-1,bM)}else{throw bM}}}return bJ},param:function(e,bw){var bv=[],by=function(bz,bA){bA=b.isFunction(bA)?bA():bA;bv[bv.length]=encodeURIComponent(bz)+"="+encodeURIComponent(bA)};if(bw===L){bw=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){by(this.name,this.value)})}else{for(var bx in e){v(bx,e[bx],bw,by)}}return bv.join("&").replace(k,"+")}});function v(bw,by,bv,bx){if(b.isArray(by)){b.each(by,function(bA,bz){if(bv||ap.test(bw)){bx(bw,bz)}else{v(bw+"["+(typeof bz==="object"||b.isArray(bz)?bA:"")+"]",bz,bv,bx)}})}else{if(!bv&&by!=null&&typeof by==="object"){for(var e in by){v(bw+"["+e+"]",by[e],bv,bx)}}else{bx(bw,by)}}}b.extend({active:0,lastModified:{},etag:{}});function bj(bD,bC,bz){var bv=bD.contents,bB=bD.dataTypes,bw=bD.responseFields,by,bA,bx,e;for(bA in bw){if(bA in bz){bC[bw[bA]]=bz[bA]}}while(bB[0]==="*"){bB.shift();if(by===L){by=bD.mimeType||bC.getResponseHeader("content-type")}}if(by){for(bA in bv){if(bv[bA]&&bv[bA].test(by)){bB.unshift(bA);break}}}if(bB[0] in bz){bx=bB[0]}else{for(bA in bz){if(!bB[0]||bD.converters[bA+" "+bB[0]]){bx=bA;break}if(!e){e=bA}}bx=bx||e}if(bx){if(bx!==bB[0]){bB.unshift(bx)}return bz[bx]}}function G(bH,bz){if(bH.dataFilter){bz=bH.dataFilter(bz,bH.dataType)}var bD=bH.dataTypes,bG={},bA,bE,bw=bD.length,bB,bC=bD[0],bx,by,bF,bv,e;for(bA=1;bA<bw;bA++){if(bA===1){for(bE in bH.converters){if(typeof bE==="string"){bG[bE.toLowerCase()]=bH.converters[bE]}}}bx=bC;bC=bD[bA];if(bC==="*"){bC=bx}else{if(bx!=="*"&&bx!==bC){by=bx+" "+bC;bF=bG[by]||bG["* "+bC];if(!bF){e=L;for(bv in bG){bB=bv.split(" ");if(bB[0]===bx||bB[0]==="*"){e=bG[bB[1]+" "+bC];if(e){bv=bG[bv];if(bv===true){bF=e}else{if(e===true){bF=bv}}break}}}}if(!(bF||e)){b.error("No conversion from "+by.replace(" "," to "))}if(bF!==true){bz=bF?bF(bz):e(bv(bz))}}}}return bz}var aC=b.now(),u=/(\=)\?(&|$)|\?\?/i;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return b.expando+"_"+(aC++)}});b.ajaxPrefilter("json jsonp",function(bD,bA,bC){var bx=bD.contentType==="application/x-www-form-urlencoded"&&(typeof bD.data==="string");if(bD.dataTypes[0]==="jsonp"||bD.jsonp!==false&&(u.test(bD.url)||bx&&u.test(bD.data))){var bB,bw=bD.jsonpCallback=b.isFunction(bD.jsonpCallback)?bD.jsonpCallback():bD.jsonpCallback,bz=bb[bw],e=bD.url,by=bD.data,bv="$1"+bw+"$2";if(bD.jsonp!==false){e=e.replace(u,bv);if(bD.url===e){if(bx){by=by.replace(u,bv)}if(bD.data===by){e+=(/\?/.test(e)?"&":"?")+bD.jsonp+"="+bw}}}bD.url=e;bD.data=by;bb[bw]=function(bE){bB=[bE]};bC.always(function(){bb[bw]=bz;if(bB&&b.isFunction(bz)){bb[bw](bB[0])}});bD.converters["script json"]=function(){if(!bB){b.error(bw+" was not called")}return bB[0]};bD.dataTypes[0]="json";return"script"}});b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){b.globalEval(e);return e}}});b.ajaxPrefilter("script",function(e){if(e.cache===L){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});b.ajaxTransport("script",function(bw){if(bw.crossDomain){var e,bv=av.head||av.getElementsByTagName("head")[0]||av.documentElement;return{send:function(bx,by){e=av.createElement("script");e.async="async";if(bw.scriptCharset){e.charset=bw.scriptCharset}e.src=bw.url;e.onload=e.onreadystatechange=function(bA,bz){if(bz||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(bv&&e.parentNode){bv.removeChild(e)}e=L;if(!bz){by(200,"success")}}};bv.insertBefore(e,bv.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var B=bb.ActiveXObject?function(){for(var e in N){N[e](0,1)}}:false,y=0,N;function aL(){try{return new bb.XMLHttpRequest()}catch(bv){}}function aj(){try{return new bb.ActiveXObject("Microsoft.XMLHTTP")}catch(bv){}}b.ajaxSettings.xhr=bb.ActiveXObject?function(){return !this.isLocal&&aL()||aj()}:aL;(function(e){b.extend(b.support,{ajax:!!e,cors:!!e&&("withCredentials" in e)})})(b.ajaxSettings.xhr());if(b.support.ajax){b.ajaxTransport(function(e){if(!e.crossDomain||b.support.cors){var bv;return{send:function(bB,bw){var bA=e.xhr(),bz,by;if(e.username){bA.open(e.type,e.url,e.async,e.username,e.password)}else{bA.open(e.type,e.url,e.async)}if(e.xhrFields){for(by in e.xhrFields){bA[by]=e.xhrFields[by]}}if(e.mimeType&&bA.overrideMimeType){bA.overrideMimeType(e.mimeType)}if(!e.crossDomain&&!bB["X-Requested-With"]){bB["X-Requested-With"]="XMLHttpRequest"}try{for(by in bB){bA.setRequestHeader(by,bB[by])}}catch(bx){}bA.send((e.hasContent&&e.data)||null);bv=function(bK,bE){var bF,bD,bC,bI,bH;try{if(bv&&(bE||bA.readyState===4)){bv=L;if(bz){bA.onreadystatechange=b.noop;if(B){delete N[bz]}}if(bE){if(bA.readyState!==4){bA.abort()}}else{bF=bA.status;bC=bA.getAllResponseHeaders();bI={};bH=bA.responseXML;if(bH&&bH.documentElement){bI.xml=bH}bI.text=bA.responseText;try{bD=bA.statusText}catch(bJ){bD=""}if(!bF&&e.isLocal&&!e.crossDomain){bF=bI.text?200:404}else{if(bF===1223){bF=204}}}}}catch(bG){if(!bE){bw(-1,bG)}}if(bI){bw(bF,bD,bI,bC)}};if(!e.async||bA.readyState===4){bv()}else{bz=++y;if(B){if(!N){N={};b(bb).unload(B)}N[bz]=bv}bA.onreadystatechange=bv}},abort:function(){if(bv){bv(0,1)}}}}})}var Q={},a8,m,aB=/^(?:toggle|show|hide)$/,aT=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,a3,aH=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],a4;b.fn.extend({show:function(bx,bA,bz){var bw,by;if(bx||bx===0){return this.animate(a0("show",3),bx,bA,bz)}else{for(var bv=0,e=this.length;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(!b._data(bw,"olddisplay")&&by==="none"){by=bw.style.display=""}if(by===""&&b.css(bw,"display")==="none"){b._data(bw,"olddisplay",x(bw.nodeName))}}}for(bv=0;bv<e;bv++){bw=this[bv];if(bw.style){by=bw.style.display;if(by===""||by==="none"){bw.style.display=b._data(bw,"olddisplay")||""}}}return this}},hide:function(bx,bA,bz){if(bx||bx===0){return this.animate(a0("hide",3),bx,bA,bz)}else{var bw,by,bv=0,e=this.length;for(;bv<e;bv++){bw=this[bv];if(bw.style){by=b.css(bw,"display");if(by!=="none"&&!b._data(bw,"olddisplay")){b._data(bw,"olddisplay",by)}}}for(bv=0;bv<e;bv++){if(this[bv].style){this[bv].style.display="none"}}return this}},_toggle:b.fn.toggle,toggle:function(bw,bv,bx){var e=typeof bw==="boolean";if(b.isFunction(bw)&&b.isFunction(bv)){this._toggle.apply(this,arguments)}else{if(bw==null||e){this.each(function(){var by=e?bw:b(this).is(":hidden");b(this)[by?"show":"hide"]()})}else{this.animate(a0("toggle",3),bw,bv,bx)}}return this},fadeTo:function(e,bx,bw,bv){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:bx},e,bw,bv)},animate:function(bz,bw,by,bx){var e=b.speed(bw,by,bx);if(b.isEmptyObject(bz)){return this.each(e.complete,[false])}bz=b.extend({},bz);function bv(){if(e.queue===false){b._mark(this)}var bE=b.extend({},e),bK=this.nodeType===1,bI=bK&&b(this).is(":hidden"),bB,bF,bD,bJ,bH,bC,bG,bL,bA;bE.animatedProperties={};for(bD in bz){bB=b.camelCase(bD);if(bD!==bB){bz[bB]=bz[bD];delete bz[bD]}bF=bz[bB];if(b.isArray(bF)){bE.animatedProperties[bB]=bF[1];bF=bz[bB]=bF[0]}else{bE.animatedProperties[bB]=bE.specialEasing&&bE.specialEasing[bB]||bE.easing||"swing"}if(bF==="hide"&&bI||bF==="show"&&!bI){return bE.complete.call(this)}if(bK&&(bB==="height"||bB==="width")){bE.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(b.css(this,"display")==="inline"&&b.css(this,"float")==="none"){if(!b.support.inlineBlockNeedsLayout||x(this.nodeName)==="inline"){this.style.display="inline-block"}else{this.style.zoom=1}}}}if(bE.overflow!=null){this.style.overflow="hidden"}for(bD in bz){bJ=new b.fx(this,bE,bD);bF=bz[bD];if(aB.test(bF)){bA=b._data(this,"toggle"+bD)||(bF==="toggle"?bI?"show":"hide":0);if(bA){b._data(this,"toggle"+bD,bA==="show"?"hide":"show");bJ[bA]()}else{bJ[bF]()}}else{bH=aT.exec(bF);bC=bJ.cur();if(bH){bG=parseFloat(bH[2]);bL=bH[3]||(b.cssNumber[bD]?"":"px");if(bL!=="px"){b.style(this,bD,(bG||1)+bL);bC=((bG||1)/bJ.cur())*bC;b.style(this,bD,bC+bL)}if(bH[1]){bG=((bH[1]==="-="?-1:1)*bG)+bC}bJ.custom(bC,bG,bL)}else{bJ.custom(bC,bF,"")}}}return true}return e.queue===false?this.each(bv):this.queue(e.queue,bv)},stop:function(bw,bv,e){if(typeof bw!=="string"){e=bv;bv=bw;bw=L}if(bv&&bw!==false){this.queue(bw||"fx",[])}return this.each(function(){var bx,by=false,bA=b.timers,bz=b._data(this);if(!e){b._unmark(true,this)}function bB(bE,bF,bD){var bC=bF[bD];b.removeData(bE,bD,true);bC.stop(e)}if(bw==null){for(bx in bz){if(bz[bx]&&bz[bx].stop&&bx.indexOf(".run")===bx.length-4){bB(this,bz,bx)}}}else{if(bz[bx=bw+".run"]&&bz[bx].stop){bB(this,bz,bx)}}for(bx=bA.length;bx--;){if(bA[bx].elem===this&&(bw==null||bA[bx].queue===bw)){if(e){bA[bx](true)}else{bA[bx].saveState()}by=true;bA.splice(bx,1)}}if(!(e&&by)){b.dequeue(this,bw)}})}});function bh(){setTimeout(at,0);return(a4=b.now())}function at(){a4=L}function a0(bv,e){var bw={};b.each(aH.concat.apply([],aH.slice(0,e)),function(){bw[this]=bv});return bw}b.each({slideDown:a0("show",1),slideUp:a0("hide",1),slideToggle:a0("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,bv){b.fn[e]=function(bw,by,bx){return this.animate(bv,bw,by,bx)}});b.extend({speed:function(bw,bx,bv){var e=bw&&typeof bw==="object"?b.extend({},bw):{complete:bv||!bv&&bx||b.isFunction(bw)&&bw,duration:bw,easing:bv&&bx||bx&&!b.isFunction(bx)&&bx};e.duration=b.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in b.fx.speeds?b.fx.speeds[e.duration]:b.fx.speeds._default;if(e.queue==null||e.queue===true){e.queue="fx"}e.old=e.complete;e.complete=function(by){if(b.isFunction(e.old)){e.old.call(this)}if(e.queue){b.dequeue(this,e.queue)}else{if(by!==false){b._unmark(this)}}};return e},easing:{linear:function(bw,bx,e,bv){return e+bv*bw},swing:function(bw,bx,e,bv){return((-Math.cos(bw*Math.PI)/2)+0.5)*bv+e}},timers:[],fx:function(bv,e,bw){this.options=e;this.elem=bv;this.prop=bw;e.orig=e.orig||{}}});b.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(b.fx.step[this.prop]||b.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var e,bv=b.css(this.elem,this.prop);return isNaN(e=parseFloat(bv))?!bv||bv==="auto"?0:bv:e},custom:function(bz,by,bx){var e=this,bw=b.fx;this.startTime=a4||bh();this.end=by;this.now=this.start=bz;this.pos=this.state=0;this.unit=bx||this.unit||(b.cssNumber[this.prop]?"":"px");function bv(bA){return e.step(bA)}bv.queue=this.options.queue;bv.elem=this.elem;bv.saveState=function(){if(e.options.hide&&b._data(e.elem,"fxshow"+e.prop)===L){b._data(e.elem,"fxshow"+e.prop,e.start)}};if(bv()&&b.timers.push(bv)&&!a3){a3=setInterval(bw.tick,bw.interval)}},show:function(){var e=b._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=e||b.style(this.elem,this.prop);this.options.show=true;if(e!==L){this.custom(this.cur(),e)}else{this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur())}b(this.elem).show()},hide:function(){this.options.orig[this.prop]=b._data(this.elem,"fxshow"+this.prop)||b.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(by){var bA,bB,bv,bx=a4||bh(),e=true,bz=this.elem,bw=this.options;if(by||bx>=bw.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bw.animatedProperties[this.prop]=true;for(bA in bw.animatedProperties){if(bw.animatedProperties[bA]!==true){e=false}}if(e){if(bw.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bC,bD){bz.style["overflow"+bD]=bw.overflow[bC]})}if(bw.hide){b(bz).hide()}if(bw.hide||bw.show){for(bA in bw.animatedProperties){b.style(bz,bA,bw.orig[bA]);b.removeData(bz,"fxshow"+bA,true);b.removeData(bz,"toggle"+bA,true)}}bv=bw.complete;if(bv){bw.complete=false;bv.call(bz)}}return false}else{if(bw.duration==Infinity){this.now=bx}else{bB=bx-this.startTime;this.state=bB/bw.duration;this.pos=b.easing[bw.animatedProperties[this.prop]](this.state,bB,0,1,bw.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){var bw,bv=b.timers,e=0;for(;e<bv.length;e++){bw=bv[e];if(!bw()&&bv[e]===bw){bv.splice(e--,1)}}if(!bv.length){b.fx.stop()}},interval:13,stop:function(){clearInterval(a3);a3=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){b.style(e.elem,"opacity",e.now)},_default:function(e){if(e.elem.style&&e.elem.style[e.prop]!=null){e.elem.style[e.prop]=e.now+e.unit}else{e.elem[e.prop]=e.now}}}});b.each(["width","height"],function(e,bv){b.fx.step[bv]=function(bw){b.style(bw.elem,bv,Math.max(0,bw.now)+bw.unit)}});if(b.expr&&b.expr.filters){b.expr.filters.animated=function(e){return b.grep(b.timers,function(bv){return e===bv.elem}).length}}function x(bx){if(!Q[bx]){var e=av.body,bv=b("<"+bx+">").appendTo(e),bw=bv.css("display");bv.remove();if(bw==="none"||bw===""){if(!a8){a8=av.createElement("iframe");a8.frameBorder=a8.width=a8.height=0}e.appendChild(a8);if(!m||!a8.createElement){m=(a8.contentWindow||a8.contentDocument).document;m.write((av.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>");m.close()}bv=m.createElement(bx);m.body.appendChild(bv);bw=b.css(bv,"display");e.removeChild(a8)}Q[bx]=bw}return Q[bx]}var V=/^t(?:able|d|h)$/i,ad=/^(?:body|html)$/i;if("getBoundingClientRect" in av.documentElement){b.fn.offset=function(bI){var by=this[0],bB;if(bI){return this.each(function(e){b.offset.setOffset(this,bI,e)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}try{bB=by.getBoundingClientRect()}catch(bF){}var bH=by.ownerDocument,bw=bH.documentElement;if(!bB||!b.contains(bw,by)){return bB?{top:bB.top,left:bB.left}:{top:0,left:0}}var bC=bH.body,bD=aK(bH),bA=bw.clientTop||bC.clientTop||0,bE=bw.clientLeft||bC.clientLeft||0,bv=bD.pageYOffset||b.support.boxModel&&bw.scrollTop||bC.scrollTop,bz=bD.pageXOffset||b.support.boxModel&&bw.scrollLeft||bC.scrollLeft,bG=bB.top+bv-bA,bx=bB.left+bz-bE;return{top:bG,left:bx}}}else{b.fn.offset=function(bF){var bz=this[0];if(bF){return this.each(function(bG){b.offset.setOffset(this,bF,bG)})}if(!bz||!bz.ownerDocument){return null}if(bz===bz.ownerDocument.body){return b.offset.bodyOffset(bz)}var bC,bw=bz.offsetParent,bv=bz,bE=bz.ownerDocument,bx=bE.documentElement,bA=bE.body,bB=bE.defaultView,e=bB?bB.getComputedStyle(bz,null):bz.currentStyle,bD=bz.offsetTop,by=bz.offsetLeft;while((bz=bz.parentNode)&&bz!==bA&&bz!==bx){if(b.support.fixedPosition&&e.position==="fixed"){break}bC=bB?bB.getComputedStyle(bz,null):bz.currentStyle;bD-=bz.scrollTop;by-=bz.scrollLeft;if(bz===bw){bD+=bz.offsetTop;by+=bz.offsetLeft;if(b.support.doesNotAddBorder&&!(b.support.doesAddBorderForTableAndCells&&V.test(bz.nodeName))){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}bv=bw;bw=bz.offsetParent}if(b.support.subtractsBorderForOverflowNotVisible&&bC.overflow!=="visible"){bD+=parseFloat(bC.borderTopWidth)||0;by+=parseFloat(bC.borderLeftWidth)||0}e=bC}if(e.position==="relative"||e.position==="static"){bD+=bA.offsetTop;by+=bA.offsetLeft}if(b.support.fixedPosition&&e.position==="fixed"){bD+=Math.max(bx.scrollTop,bA.scrollTop);by+=Math.max(bx.scrollLeft,bA.scrollLeft)}return{top:bD,left:by}}}b.offset={bodyOffset:function(e){var bw=e.offsetTop,bv=e.offsetLeft;if(b.support.doesNotIncludeMarginInBodyOffset){bw+=parseFloat(b.css(e,"marginTop"))||0;bv+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bw,left:bv}},setOffset:function(bx,bG,bA){var bB=b.css(bx,"position");if(bB==="static"){bx.style.position="relative"}var bz=b(bx),bv=bz.offset(),e=b.css(bx,"top"),bE=b.css(bx,"left"),bF=(bB==="absolute"||bB==="fixed")&&b.inArray("auto",[e,bE])>-1,bD={},bC={},bw,by;if(bF){bC=bz.position();bw=bC.top;by=bC.left}else{bw=parseFloat(e)||0;by=parseFloat(bE)||0}if(b.isFunction(bG)){bG=bG.call(bx,bA,bv)}if(bG.top!=null){bD.top=(bG.top-bv.top)+bw}if(bG.left!=null){bD.left=(bG.left-bv.left)+by}if("using" in bG){bG.using.call(bx,bD)}else{bz.css(bD)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bw=this[0],bv=this.offsetParent(),bx=this.offset(),e=ad.test(bv[0].nodeName)?{top:0,left:0}:bv.offset();bx.top-=parseFloat(b.css(bw,"marginTop"))||0;bx.left-=parseFloat(b.css(bw,"marginLeft"))||0;e.top+=parseFloat(b.css(bv[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bv[0],"borderLeftWidth"))||0;return{top:bx.top-e.top,left:bx.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||av.body;while(e&&(!ad.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bv,e){var bw="scroll"+e;b.fn[bw]=function(bz){var bx,by;if(bz===L){bx=this[0];if(!bx){return null}by=aK(bx);return by?("pageXOffset" in by)?by[bv?"pageYOffset":"pageXOffset"]:b.support.boxModel&&by.document.documentElement[bw]||by.document.body[bw]:bx[bw]}return this.each(function(){by=aK(this);if(by){by.scrollTo(!bv?bz:b(by).scrollLeft(),bv?bz:b(by).scrollTop())}else{this[bw]=bz}})}});function aK(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bv,e){var bw=e.toLowerCase();b.fn["inner"+e]=function(){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,"padding")):this[bw]():null};b.fn["outer"+e]=function(by){var bx=this[0];return bx?bx.style?parseFloat(b.css(bx,bw,by?"margin":"border")):this[bw]():null};b.fn[bw]=function(bz){var bA=this[0];if(!bA){return bz==null?null:this}if(b.isFunction(bz)){return this.each(function(bE){var bD=b(this);bD[bw](bz.call(this,bE,bD[bw]()))})}if(b.isWindow(bA)){var bB=bA.document.documentElement["client"+e],bx=bA.document.body;return bA.document.compatMode==="CSS1Compat"&&bB||bx&&bx["client"+e]||bB}else{if(bA.nodeType===9){return Math.max(bA.documentElement["client"+e],bA.body["scroll"+e],bA.documentElement["scroll"+e],bA.body["offset"+e],bA.documentElement["offset"+e])}else{if(bz===L){var bC=b.css(bA,bw),by=parseFloat(bC);return b.isNumeric(by)?by:bC}else{return this.css(bw,typeof bz==="string"?bz:bz+"px")}}}}});bb.jQuery=bb.$=b;if(typeof define==="function"&&define.amd&&define.amd.jQuery){define("jquery",[],function(){return b})}})(window);
\ No newline at end of file
###### CONFIGURATION ALLO AGENT ######
# Référence de l'instance sur ALLO
-instance_reference="AS/VILLESEL_67462_3003150952"
+instance_reference="IP/VILLELAG_77243_2004151140"
# Type d'usager (exploitant|client)
usager_type="client"
# Type d'instance (qualif|prod)
-instance_type="qualif"
+instance_canal="prod"
# Fqdn interne
instance_fqdn_interne="api_test"
# Fqdn externe
HTTP/1.1 200 OK\r
-Date: Mon, 30 Mar 2015 07:53:30 GMT\r
+Date: Mon, 27 Apr 2015 14:48:51 GMT\r
Server: Apache/2.2.22 (Ubuntu)\r
-X-Powered-By: PHP/5.3.10-1ubuntu3.16\r
+X-Powered-By: PHP/5.3.10-1ubuntu3.17\r
Access-Control-Allow-Origin: *\r
Vary: Accept-Encoding\r
Content-Length: 0\r
echo "------------------------------------------------------------------------"
validation=false
while [ "$validation" = false ] ; do
-read -p "FQDN (interne) de l'application [instance.mondomaine.local] : "
-if [ "$REPLY" == "" ]
-then
- fqdn_interne="instance.mondomaine.local"
-else
- fqdn_interne="$REPLY"
-fi
-read -p "FQDN (externe) de l'application [instance.mondomaine.fr] : "
-if [ "$REPLY" == "" ]
-then
- fqdn_externe="instance.mondomaine.fr"
-else
- fqdn_externe="$REPLY"
-fi
-read -p "Canal de mise à jour [QUALIF/prod] : "
-if [ "$REPLY" == "" ]
-then
- canal="qualif"
-else
- canal="$REPLY"
-fi
-read -p "Type d'usager [CLIENT/exploitant] : "
-if [ "$REPLY" == "" ]
-then
- usager="client"
-else
- usager="$REPLY"
-fi
-read -p "Reférence du client [] : "
-reference_client="$REPLY"
-echo "FQDN interne : "${fqdn_interne}
-echo "FQDN externe : "${fqdn_externe}
-echo "Canal de mise à jour : "${canal}
-echo "Type d'usager : "${usager}
-echo "Référence client : "${reference_client}
-read -p "Ces informations sont-elles correctes [O/n] ? "
-if [ "$REPLY" == "" ] || [ "$REPLY" == "o" ] || [ "$REPLY" == "O" ] || [ "$REPLY" == "oui" ] || [ "$REPLY" == "Oui" ] || [ "$REPLY" == "OUI" ]
-then
- validation=true
-fi
-done
-# TEST DE CONNEXION
-fqdn_interne="api_test"
-code=$(curl -s -w "%{http_code}" --max-time 5 --output /dev/null "http://${fqdn_interne}/api/rest/allo/version")
+ validation_fqdn_interne=false
+ while [ "$validation_fqdn_interne" = false ] ; do
+ read -p "FQDN (interne) de l'application [instance.mondomaine.local] : "
+ if [ "$REPLY" == "" ]
+ then
+ fqdn_interne="instance.mondomaine.local"
+ else
+ fqdn_interne="$REPLY"
+ fi
+ # TEST DE CONNEXION
+ code=$(curl -s -w "%{http_code}" --max-time 5 --output /dev/null "http://${fqdn_interne}/api/rest/allo/version")
-if [ "${code}" == 200 ] || [ "${code}" == 301 ]
-then
- # REQUETE (en insecure pour le moment)
- curl --max-time 10 -k -X GET -H "Accept: application/json" "http://${fqdn_interne}/api/rest/allo/version/" --output "response.json" 2> /dev/null
+ if [ "${code}" == 200 ] || [ "${code}" == 301 ]
+ then
+ # REQUETE (en insecure pour le moment)
+ curl --max-time 10 -k -X GET -H "Accept: application/json" "http://${fqdn_interne}/api/rest/allo/version/" --output "response.json" 2> /dev/null
- # LOG DE LA REPONSE
- #echo "$(cat response.json)" 2>&1 | tee -a $log_file
+ produit="$(jq -r '.produit' response.json)"
+ echo "Produit : "${produit}
+
+ case "${produit}" in
+ "i-Parapheur")
+ prefixe="IP"
+ ;;
+ "as@lae")
+ prefixe="AS"
+ ;;
+ *)
+ echo "Produit non reconnu" 2>&1 | tee -a $log_file
+ ;;
+ esac
+
+ read -p "S'agit-il du bon nom de produit pour l'instance [O/n] ? "
+ if [ "$REPLY" == "" ] || [ "$REPLY" == "o" ] || [ "$REPLY" == "O" ] || [ "$REPLY" == "oui" ] || [ "$REPLY" == "Oui" ] || [ "$REPLY" == "OUI" ]
+ then
+ validation_fqdn_interne=true
+ fi
+ else
+ echo "Le FQDN de l'application est incorrect ou cette dernière ne répond pas, merci de vérifier le paramétrage et de renseigner le bon FQDN."
+ fi
+ done
+
+ read -p "FQDN (externe) de l'application [instance.mondomaine.fr] : "
+ if [ "$REPLY" == "" ]
+ then
+ fqdn_externe="instance.mondomaine.fr"
+ else
+ fqdn_externe="$REPLY"
+ fi
- # VALIDATION DU JSON (nécessite outil de validation json)
- #isJSONCorrupted=$(cat response.json | module/json -nq)
+ read -p "Canal de mise à jour [PROD/qualif] : "
+ if [ "$REPLY" == "" ]
+ then
+ canal="prod"
+ else
+ canal="$REPLY"
+ fi
- # SI LA VARIABLE EST INITIALISEE MAIS VIDE => PAS D'ERREUR
- #if [[ -z $isJSONCorrupted && ${isJSONCorrupted+x} ]]
- #then
- produit="$(jq -r '.produit' response.json)"
- echo "Produit : "${produit}
+ validation_ref_client=false
+ while [ "$validation_ref_client" = false ] ; do
+ read -p "Référence client [] : "
+ if [ "$REPLY" == "" ]
+ then
+ echo "Erreur : merci de préciser une référence client valide."
+ else
+ reference_client="$REPLY"
+ validation_ref_client=true
+ fi
+ done
+ echo "FQDN interne : "${fqdn_interne}
+ echo "FQDN externe : "${fqdn_externe}
+ echo "Canal de mise à jour : "${canal}
+ echo "Référence client : "${reference_client}
- case "${produit}" in
- "i-Parapheur")
- prefixe="IP"
- ;;
- "as@lae")
- prefixe="AS"
- ;;
- *)
- echo "Produit non reconnu" 2>&1 | tee -a $log_file
- ;;
- esac
- #fi
-fi
+ read -p "Ces informations sont-elles correctes [O/n] ? "
+ if [ "$REPLY" == "" ] || [ "$REPLY" == "o" ] || [ "$REPLY" == "O" ] || [ "$REPLY" == "oui" ] || [ "$REPLY" == "Oui" ] || [ "$REPLY" == "OUI" ]
+ then
+ validation=true
+ fi
+done
# Création du allo_agent.conf
-# To-do : possibilité de mise à jour d'une conf existante
+# To-do : possibilité de choix de mise à jour d'une conf existante
configuration="allo_agent.conf"
now="$(date +'%d%m%y%H%M')"
if [ -e "${configuration}" ]
echo "# Référence de l'instance sur ALLO" >> $configuration
echo 'instance_reference="'${prefixe}'/'${reference_client}'_'${now}'"' >> $configuration
echo "# Type d'usager (exploitant|client)" >> $configuration
-echo 'usager_type="'${usager}'"' >> $configuration
+echo 'usager_type="client"' >> $configuration
echo "# Type d'instance (qualif|prod)" >> $configuration
-echo 'instance_type="'${canal}'"' >> $configuration
+echo 'instance_canal="'${canal}'"' >> $configuration
echo "# Fqdn interne" >> $configuration
echo 'instance_fqdn_interne="'${fqdn_interne}'"' >> $configuration
echo "# Fqdn externe" >> $configuration
--- /dev/null
+{
+ "produit":"i-Parapheur",
+ "version":"4.1.02",
+ "reference":"IP/CDG26_26362_0704151140",
+ "usager_type":"client",
+ "disques":"test",
+ "systeme":"Luna",
+ "fqdn_externe":"test.fr",
+ "fqdn_interne":"test.local",
+ "canal":"prod"
+}
\ No newline at end of file
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+'''
+uploadform.py - A simple/minimalist yet flexible helper module to construct a POSTable mime
+message that is similar to a message generated by a browser when you submit an html form.
+Supports file uploads and even "incremental uploads" (by yielding) if you don't
+want to read the whole uploadable file into memory before POSTing it to the HTTP server.
+Provided "as is" - use it at your own risk and don't complain if it cuts down your limbs...
+Run this module to execute the test/example code.
+'''
+import uuid, urllib, urllib2
+
+__author__ = 'István Pásztor'
+__all__ = ['UploadForm']
+
+
+class UploadForm:
+ def __init__(self, boundary=None):
+ self.set_boundary(boundary)
+ self.fields = []
+
+ def set_boundary(self, boundary):
+ self.boundary = urllib.quote(boundary) if boundary else '__--__{%s}__--__' % uuid.uuid4()
+
+ def add_field(self, name, value, **params):
+ # see _Field.__init__() for the description of the parameters.
+ field = _Field(name, value, **params)
+ self.fields.append(field)
+ return field
+
+ def get_request_headers(self, calculate_content_length=True):
+ assert self.fields
+ headers = {'Content-Type': 'multipart/form-data; boundary='+self.boundary}
+ if not calculate_content_length:
+ return headers
+ content_length = self.get_size()
+ headers['Content-Length'] = str(content_length)
+ return (headers, content_length)
+
+ def __iter__(self):
+ assert self.fields
+ boundary = '--' + self.boundary + '\r\n'
+ for field in self.fields:
+ yield boundary
+ for chunk in field:
+ yield chunk
+ yield '--'
+ yield self.boundary
+ yield '--\r\n'
+
+ def __str__(self):
+ return ''.join(s for s in self)
+
+ def dump(self, f):
+ for chunk in self:
+ f.write(chunk)
+
+ def get_size(self):
+ return (2+len(self.boundary)+2) * (len(self.fields)+1) + 2 + sum(field.get_size() for field in self.fields)
+
+
+class PingForm:
+ def __init__(self, boundary=None):
+ self.set_boundary(boundary)
+ self.fields = []
+
+ def set_boundary(self, boundary):
+ self.boundary = urllib.quote(boundary) if boundary else '__--__{%s}__--__' % uuid.uuid4()
+
+ def add_field(self, name, value, **params):
+ # see _Field.__init__() for the description of the parameters.
+ field = _Field(name, value, **params)
+ self.fields.append(field)
+ return field
+
+ def get_request_headers(self):
+ assert self.fields
+ headers = {'Content-Type': 'multipart/form-data; boundary='+self.boundary}
+ return (headers)
+
+ def __iter__(self):
+ assert self.fields
+ boundary = '--' + self.boundary + '\r\n'
+ for field in self.fields:
+ yield boundary
+ for chunk in field:
+ yield chunk
+ yield '--'
+ yield self.boundary
+ yield '--\r\n'
+
+ def __str__(self):
+ return ''.join(s for s in self)
+
+ def dump(self, f):
+ for chunk in self:
+ f.write(chunk)
+
+ def get_size(self):
+ return (2+len(self.boundary)+2) * (len(self.fields)+1) + 2 + sum(field.get_size() for field in self.fields)
+
+
+class _Header:
+ def __init__(self, _header_name, _header_value, **params):
+ self.name = _header_name
+ self.value = _header_value
+ self.params = params
+
+ def __iter__(self):
+ yield _stringify(self.name)
+ yield ': '
+ yield _stringify(self.value)
+ for name, value in self.params.iteritems():
+ yield '; '
+ yield _stringify(name)
+ yield '="'
+ yield _stringify(value).replace('\\', '\\\\').replace('"', '\\"')
+ yield '"'
+ yield '\r\n'
+
+ def get_size(self):
+ def _param_size(name, value):
+ value = _stringify(value)
+ return 5 + len(_stringify(name)) + len(value) + value.count('\\') + value.count('"')
+ return 4 + len(_stringify(self.name)) + len(_stringify(self.value)) + sum(_param_size(name, value) for name, value in self.params.iteritems())
+
+
+class _Field:
+ BUFSIZE = 16*1024 # BUFSIZE used when yielding data from file objects
+
+ def __init__(self, name, value, **params):
+ '''
+ @param params: Contains additional key-value pairs besides the "name" parameter for the Content-Disposition
+ header. Example: filename='x.zip'
+ @param value: This parameter can be a string, a unicode object, or a (file-object, size) tuple. In case of
+ unicode object the string is converted to utf-8 before converting to mime. In case of a file-object we read
+ the data starting from the current file pointer.
+ '''
+ params['name'] = name
+ self.headers = [_Header('Content-Disposition', 'form-data', **params)]
+ assert isinstance(value, (str, unicode, tuple))
+ self.value = value
+
+ def add_header(self, name, value, **params):
+ '''
+ You can add additional mime headers, for example a "Content-Type" header with "text/plain" value with optional
+ parameters like charset="UTF-8"
+ '''
+ self.headers.append(_Header(name, value, **params))
+
+ def __iter__(self):
+ for header in self.headers:
+ for chunk in header:
+ yield chunk
+ yield '\r\n'
+
+ if isinstance(self.value, str):
+ yield self.value
+ elif isinstance(self.value, unicode):
+ yield self.value.encode('utf-8')
+ else:
+ bytes_left = self.value[1]
+ while bytes_left > 0:
+ bytes_to_read = min(self.BUFSIZE, bytes_left)
+ data = self.value[0].read(bytes_to_read)
+ if not data:
+ raise Exception('The specified file object doesn\'t contain enough data!')
+ yield data
+ bytes_left -= len(data)
+ yield '\r\n'
+
+ def __str__(self):
+ return ''.join(s for s in self)
+
+ def get_size(self):
+ size = sum(header.get_size() for header in self.headers) + 2
+
+ if isinstance(self.value, str):
+ size += len(self.value)
+ elif isinstance(self.value, unicode):
+ size += len(self.value.encode('utf-8'))
+ else:
+ size += self.value[1]
+
+ size += 2 # newline
+ return size
+
+
+def _stringify(s):
+ return s.encode('utf-8') if isinstance(s, unicode) else s
+
+if __name__ == '__main__':
+ # SIMPLE REQUETE EN GET
+ '''
+ Test/example code.
+ print 'BOUH !'
+ url = 'http://allo_serveur/?action=get_instances'
+ opener = urllib2.build_opener()
+ response = opener.open(url).read()
+ print response
+ '''
+
+ # TEST UPLOAD AVEC REQUESTS (pip install requests)
+ import requests
+ url = 'http://allo_serveur/?action=upload_info'
+ # files = {'file': open('test.json', 'rb')}
+ with open("test.json", "r") as myfile:
+ data = myfile.read()
+ # r = requests.post(url, files=files)
+ r = requests.post(url, data=data)
+ print r.text
+
+ # TEST UPLOAD AVEC URLLIB2 (PUT REFUSE)
+ '''
+ import json
+ #import urllib2
+ url = 'http://allo_serveur/?action=upload_info'
+ with open("test.json", "r") as myfile:
+ data = myfile.read()
+ postdata = urllib.urlencode(data)
+ req = urllib2.Request(url, postdata, {'Content-Type': 'application/json'})
+ f = urllib2.urlopen(req)
+ response = f.read()
+ f.close()
+ '''
+
+ # TEST UPLOAD AVEC URLLIB (PUT REFUSE)
+ '''
+ import os
+ filename = 'test.json'
+ # AJOUT DU PATH USELESS ?
+ #filepath = os.path.join('j:\\', filename)
+ with open(filename, 'rb') as f:
+ form = UploadForm()
+ # Adding a field by setting its value by reading from file like object...
+ form.add_field('file', (f, os.path.getsize(filename)), filename=filename)
+ #field = form.add_field('file_from_mem', u'This is the content of Pistike\'s text file.\n', filename='memfile.txt')
+ # Adding headers is optional but we do it this time just to demonstrate it...
+ #field.add_header('Content-Type', 'text/plain', charset='UTF-8')
+ #field.add_header('MyHeader', 'my_header_value', quote_test_param='m\\y"param"2')
+ # simulating a type="text" input field on the form with name="comment"
+ #form.add_field('comment', u'Árvíztűrő tükörfúrógép')
+ # simulating a type="checkbox" input field on the form with name="my_checkbox"
+ #form.add_field('my_checkbox', 'on')
+ headers, content_length = form.get_request_headers()
+ content = str(form)
+
+ print 'Headers: %s' % (headers,)
+ print 'Content-Length: %s' % len(content)
+ print content
+
+ assert len(content) == content_length
+
+ import httplib
+
+ conn = httplib.HTTPConnection('allo_serveur')
+ try:
+ conn.request('POST', '/?action=upload_info', content, headers=headers)
+ resp = conn.getresponse()
+ print resp.status
+ print resp.read()
+ finally:
+ conn.close()
+ '''
\ No newline at end of file
disques=$(blkid /dev/sd* | sed 's/\"//g')
# SYSTEME D'EXPLOITATION
- systeme=$(cat /etc/issue | sed 's/\\n\ \\l//g')
+ systeme=$(cat /etc/issue | sed 's/\\n\ \\l//g')
# AJOUT DE LA REFERENCE PRODUIT (nécessite package jq)
jq '. + { "reference": "'"${instance_reference}"'" }' response.json > tmp1.json
# AJOUT DU FQDN INTERNE
jq '. + { "fqdn_interne": "'"${instance_fqdn_interne}"'" }' tmp5.json > tmp6.json
- # AJOUT DU TYPE DE PRODUIT
- jq '. + { "instance_type": "'"${instance_type}"'" }' tmp6.json > request.json
+ # AJOUT DU TYPE DE L'INSTANCE
+ jq '. + { "canal": "'"${instance_canal}"'" }' tmp6.json > request.json
# ENVOI DE L'UPDATE AU SERVEUR
curl --cert bma.pem --key bma.key -X POST -H "${request_type}" --data-binary "@request.json" -i "https://${allo_serveur_url}/?action=upload_info" --output "response_server" 2> /dev/null
protected $url, $sessionId;
- /// CONSTRUCTEUR
+ /// CONSTRUCTOR
function __construct($url = 'http://sugar/service/v4_1/rest.php', $sessionId = null) {
//define('sugarEntry', TRUE);
$this -> url = $url;
$parameters = array(
'user_auth' => array(
'user_name' => $login,
- 'password' => md5($pass),
+ 'password' => $pass //md5($pass),
),
);
//The name of the module from which to retrieve records
'module_name' => $moduleName,
//The SQL WHERE clause without the word "where".
- 'query' => $sqlWhereClause,//"accounts.name = 'SDIS 40'",
+ 'query' => $sqlWhereClause,
//The SQL ORDER BY clause without the phrase "order by".
'order_by' => $sqlOrderByClause,
//The record offset from which to start.
//A list of fields to include in the results.
'select_fields' => $requestedInfos,
//The maximum number of results to return.
- 'max_results' => 1,
- 'wl_list_max_entries_per_page' => 2,
+ 'max_results' => 100000,
+ 'wl_list_max_entries_per_page' => 100000,
//If deleted records should be included in results.
'deleted' => 0,
//If only records marked as favorites should be returned.
return $response;
}
-}
+ public function updateOrCreateEntryModule($moduleName, $parameters) {
+ $set_entry_parameters = array(
+ //session id
+ "session" => $this -> sessionId,
+
+ //The name of the module from which to retrieve records.
+ "module_name" => $moduleName,
+
+ //Record attributes
+ "name_value_list" => /*array(
+ //to update a record, you will nee to pass in a record id as commented below
+ //array("name" => "id", "value" => "9b170af9-3080-e22b-fbc1-4fea74def88f"),
+ array("name" => "name", "value" => $parameters['name']),
+ ),*/$parameters
+ );
+ $json = json_encode($set_entry_parameters);
-/*
+ $postArgs = array(
+ 'method' => 'set_entry',
+ 'input_type' => 'JSON',
+ 'response_type' => 'JSON',
+ 'rest_data' => $json,
+ );
+ $postArgs = http_build_query($postArgs);
-echo "Liste des clients :";
+ // Make the REST call, returning the result
+ $response = $this -> callRest($this -> url, $postArgs);
-?>
-<table>
- <tr>
- <th>Nom</th>
- <th>Adresse</th>
- <th>Tel</th>
- </tr>
- <?php foreach($result->entry_list as $account) { ?>
- <tr>
- <?php echo "<td>".$account->name_value_list->name->value."</td>"; ?>
- <?php echo "<td>".$account->name_value_list->billing_address_street->value."</td>"; ?>
- <?php echo "<td>".$account->name_value_list->phone_office->value."</td>"; ?>
- </tr>
- <?php } ?>
-</table>
-<?php
-*/
-
-/*
-$get_entry_list_parameters = array(
- //session id
- 'session' => $sessionId,
- //The name of the module from which to retrieve records
- 'module_name' => 'Opportunities',
- //The SQL WHERE clause without the word "where".
- 'query' => "",//"accounts.name = 'SDIS 40'",
- //The SQL ORDER BY clause without the phrase "order by".
- 'order_by' => "",
- //The record offset from which to start.
- 'offset' => 0,
- //A list of fields to include in the results.
- 'select_fields' => array(
- //'id',
- 'name',
- 'date_closed',
- 'account_name'
- ),*/
- //A list of link names and the fields to be returned for each link name.
- /*'link_name_to_fields_array' => array(
- array(
- 'name' => 'email_addresses',
- 'value' => array(
- 'email_address',
- 'opt_out',
- 'primary_address'
- ),
- ),
- ),*/
- //The maximum number of results to return.
- /*'max_results' => 1,
- 'wl_list_max_entries_per_page' => 1,
- //If deleted records should be included in results.
- 'deleted' => 0,
- //If only records marked as favorites should be returned.
- 'favorites' => false,
-);
-
-$json = json_encode($get_entry_list_parameters);
-
-$postArgs = array(
- 'method' => 'get_entry_list',
- 'input_type' => 'JSON',
- 'response_type' => 'JSON',
- 'rest_data' => $json,
-);
-
-$postArgs = http_build_query($postArgs);
-
-// Make the REST call, returning the result
-$response = $client->callRest($url, $postArgs);
-
-// Convert the result from JSON format to a PHP array
-$result = json_decode($response);
-
-echo "Liste des fiches d'installation :";
-
-?>
-<table>
- <tr>
- <th>Nom</th>
- <th>Date de fin</th>
- <th>Nom du compte</th>
- </tr>
- <?php foreach($result->entry_list as $opportunity) { ?>
- <tr>
- <?php echo "<td>".$opportunity->name_value_list->name->value."</td>"; ?>
- <?php echo "<td>".$opportunity->name_value_list->date_closed->value."</td>"; ?>
- <?php echo "<td>".$opportunity->name_value_list->account_name->value."</td>"; ?>
- </tr>
- <?php } ?>
-</table>
-}*/
\ No newline at end of file
+ return $response;
+ }
+
+ public function createRelationship($moduleName, $parameters) {
+ $set_relationship_parameters = array(
+ //session id
+ "session" => $this -> sessionId,
+
+ //The name of the primary module
+ "module_name" => $moduleName,
+
+ //The ID of the specified primary module bean.
+ 'module_id' => $parameters['primary_module_id'],
+
+ //The relationship name of the linked field from which to relate records.
+ 'link_field_name' => $parameters['link_name'],
+ //The list of record ids to relate
+ 'related_ids' => array($parameters['related_module_id']),
+ //Sets the value for relationship based fields
+ /*'name_value_list' => array(
+ array(
+ 'name' => 'contact_role',
+ 'value' => 'Other'
+ ),
+ ),*/
+ //Whether or not to delete the relationship. 0:create, 1:delete
+ 'delete'=> 0,
+
+ );
+
+ $json = json_encode($set_relationship_parameters);
+
+ $postArgs = array(
+ 'method' => 'set_relationship',
+ 'input_type' => 'JSON',
+ 'response_type' => 'JSON',
+ 'rest_data' => $json,
+ );
+
+ $postArgs = http_build_query($postArgs);
+
+ // Make the REST call, returning the result
+ $response = $this -> callRest($this -> url, $postArgs);
+
+ return $response;
+ }
+
+ public function getRelationships($moduleName, $parameters, $requestedInfos, $sqlWhereClause = '') {
+ $get_relationships_parameters = array(
+ //session id
+ "session" => $this -> sessionId,
+
+ //The name of the primary module
+ "module_name" => $moduleName,
+
+ //The ID of the specified primary module bean.
+ 'module_id' => $parameters['primary_module_id'],
+
+ //The relationship name of the linked field from which to relate records.
+ 'link_field_name' => $parameters['link_name'],
+
+ 'related_module_query' => $sqlWhereClause,
+
+ //Sets the value for relationship based fields
+ 'related_fields' => $requestedInfos,
+ //Whether or not to delete the relationship. 0:create, 1:delete
+ 'delete'=> 0,
+
+ //order by
+ //'order_by' => ' opportunities.name ',
+
+ //offset
+ //'offset' => 0,
+
+ //limit
+ //'limit' => 200,
+ );
+
+ $json = json_encode($get_relationships_parameters);
+
+ $postArgs = array(
+ 'method' => 'get_relationships',
+ 'input_type' => 'JSON',
+ 'response_type' => 'JSON',
+ 'rest_data' => $json,
+ );
+
+ $postArgs = http_build_query($postArgs);
+
+ // Make the REST call, returning the result
+ $response = $this -> callRest($this -> url, $postArgs);
+
+ return $response;
+ }
+
+}
require_once('protected/required.php');
- class PdoAlerteManager extends AbstractPdoManager implements AlerteManager {
+ class PdoAlerteManager extends AbstractPdoManager {
public function createAlerte($alerte) {
--- /dev/null
+<?php
+
+ require_once('protected/required.php');
+
+ class PdoClientManager extends AbstractPdoManager {
+
+ public function createClient($client) {
+
+ $query = $this -> pdo -> prepare(
+ 'INSERT INTO clients (
+ identifiant_AP,
+ nom
+ ) VALUES (
+ :identifiant_AP,
+ :nom
+ );'
+ );
+ $query -> bindValue(':identifiant_AP', $client -> getIdentifiantAP());
+ $query -> bindValue(':nom', $client -> getNom());
+ $query -> execute();
+ }
+
+ public function updateClient($client) {
+
+ $query = $this -> pdo -> prepare(
+ 'UPDATE clients
+ SET identifiant_AP = :identifiant_AP,
+ nom = :nom
+ WHERE id = :id'
+ );
+ $query -> bindValue(':id', $client -> getId());
+ $query -> bindValue(':identifiant_AP', $client -> getIdentifiantAP());
+ $query -> bindValue(':nom', $client -> getNom());
+ $query -> execute();
+ }
+
+ public function getClient($id) {
+
+ $query = $this -> pdo -> prepare('SELECT * FROM clients WHERE id = :id');
+ $query -> bindValue(':id', $id);
+ $query -> execute();
+
+ $result = $query -> fetch(PDO::FETCH_ASSOC);
+ $client = new Client($result['id'], $result['identifiant_AP'], $result['nom']);
+
+ $query->closeCursor();
+
+ return $client;
+ }
+
+ public function getClientByIdentifiantAP($identifiantAP) {
+
+ $query = $this -> pdo -> prepare('SELECT * FROM clients WHERE identifiant_AP = :identifiant_AP');
+ $query -> bindValue(':identifiant_AP', $identifiantAP);
+ $query -> execute();
+
+ $result = $query -> fetch(PDO::FETCH_ASSOC);
+ $client = new Client($result['id'], $result['identifiant_AP'], $result['nom']);
+
+ $query->closeCursor();
+
+ return $client;
+ }
+
+ public function getClients() {
+
+ $query = $this -> pdo -> prepare('SELECT * FROM clients');
+ $query -> execute();
+
+ $results = $query -> fetchAll(PDO::FETCH_ASSOC);
+ $clients = array();
+ foreach ($results as $result) {
+ $clients[] = new Client($result['id'], $result['identifiant_AP'], $result['nom']);
+ }
+
+ $query->closeCursor();
+
+ return $clients;
+ }
+
+ public function removeClient($client) {
+
+ $query = $this -> pdo -> prepare('DELETE FROM clients WHERE id = :id');
+ $query -> bindValue('id', $client -> getId());
+ $query -> execute();
+ }
+
+ }
+
+?>
require_once('protected/required.php');
- class PdoExploitantManager extends AbstractPdoManager implements ExploitantManager {
+ class PdoExploitantManager extends AbstractPdoManager {
public function createExploitant($exploitant) {
require_once('protected/required.php');
- class PdoHistoriqueManager extends AbstractPdoManager implements HistoriqueManager {
+ class PdoHistoriqueManager extends AbstractPdoManager {
public function createHistorique($historique) {
require_once('protected/required.php');
- class PdoInstanceManager extends AbstractPdoManager implements InstanceManager {
+ class PdoInstanceManager extends AbstractPdoManager {
public function createInstance($instance) {
fqdn_interne,
fqdn_externe,
systeme,
- disques
+ disques,
+ canal
) VALUES (
:nom,
:exploitant,
:fqdn_interne,
:fqdn_externe,
:systeme,
- :disques
+ :disques,
+ :canal
)'
);
$query -> bindValue(':nom', $instance -> getNom());
$query -> bindValue(':fqdn_externe', $instance -> getFqdnExterne());
$query -> bindValue(':systeme', $instance -> getSysteme());
$query -> bindValue(':disques', $instance -> getDisques());
+ $query -> bindValue(':canal', $instance -> getCanal());
$query -> execute();
$query -> closeCursor();
fqdn_interne = :fqdn_interne,
fqdn_externe = :fqdn_externe,
systeme = :systeme,
- disques = :disques
+ disques = :disques,
+ canal = :canal
WHERE id = :id'
);
$query -> bindValue(':id', $instance -> getId());
$query -> bindValue(':fqdn_externe', $instance -> getFqdnExterne());
$query -> bindValue(':systeme', $instance -> getSysteme());
$query -> bindValue(':disques', $instance -> getDisques());
+ $query -> bindValue(':canal', $instance -> getCanal());
$query -> execute();
$query -> closeCursor();
}
public function updateInstanceInfos($array) {
$instance = $this -> getInstanceByReference($array['reference']);
- // L'INSTANCE EXISTE
+
+ // IF APPLIANCE EXISTS
if($instance -> getId() > 0) {
- // INSTANCE MAINTENUE ?
+
+ // IF APPLIANCE IS MAINTAINED
if(!$instance -> estMaintenu()) {
echo "Votre application n'est plus maintenue par nos services, merci de vous renseigner auprès de votre contact ADULLACT Projet pour plus d'informations.";
} else {
- // CAS EXPLOITANT
+
+ // IN CASE OF MANAGER
if($array['usager_type'] === "exploitant") {
- // RECUPERATION DE L'EXPLOITANT DU INSTANCE
+
+ // GETTING MANAGER OF APPLIANCE
$exploitantManager = new PdoExploitantManager();
$exploitant = $exploitantManager -> getExploitantByReference($instance -> getExploitant());
- // MISE À JOUR DE TOUS LES INSTANCES EN CHARGE DE L'EXPLOITANT
+
+ // UPDATING ALL APPLIANCES OF THIS MANAGER
$array['usager_type'] = "client";
$instances_id = $exploitant -> getInstances();
foreach ($instances_id as $instance_id) {
$array['reference'] = $this -> getInstance($instance_id) -> getReference();
$this -> updateInstanceInfos($array);
}
- // CAS CLIENT
+
+ // IN CASE OF CLIENT
} else if($array['usager_type'] === "client") {
- // VERIFICATION DU NOM DE L'INSTANCE
+
+ // CHECKING APPLIANCE NAME
if ($array['produit'] === $instance -> getNom()) {
- // LA VERSION DIFFÈRE DE LA DB ?
+
+ // IF VERSION DIFFERS FROM DB
if($array['version'] != $instance -> getVersion()) {
- // MANAGERS
+
+ // GETTING PDO MANAGERS
$versionManager = new PdoVersionManager();
$produitManager = new PdoProduitManager();
$alerteManager = new PdoAlerteManager();
- // RECUPÉRATION DE L'ID DE LA VERSION
+
+ // GETTING VERSION ID
$version_id = $versionManager->getIdByValeurAndProduitId($array['version'], $produitManager->getProduitByNom($array['produit'])->getId());
- // CREATION D'UNE NOUVELLE ALERTE DE TYPE VERSION
+
+ // NEW WARNING CREATION, VERSION TYPE
$alerte = new Alerte(null, null, "version",
"Version declaree ".$array['version']." differente de l'actuelle : ".$instance -> getVersion(), $version_id);
$alerteManager -> createAlerte($alerte);
- // RECUPERATION DE L'HISTORIQUE DE L'INSTANCE
+
+ // GETTING CHANGELOG OF APPLIANCE
$historiqueManager = new PdoHistoriqueManager();
$historique = $historiqueManager -> getHistorique($instance -> getHistorique());
- // AJOUT DANS UN HISTORIQUE DEJÀ EXISTANT
+
+ // IF CHANGELOG EXISTS, ADDING NEW WARNING TO IT
if($historique -> getId() > 0) {
$alertes = $historique -> getAlertes();
if((array_search("", $alertes)) !== false) {
}
$historique -> setAlertes($alertes);
$historiqueManager -> updateHistorique($historique);
- // CREATION D'UN NOUVEL HISTORIQUE
+
+ // IF CHANGELOG DOES NOT EXIST, CREATING NEW ONE
} else {
$historique = new Historique(null, null, array($alerteManager -> getLastAlerte() -> getId()), array($alerte -> getVersion()));
$historiqueManager -> createHistorique($historique);
$this -> updateInstance($instance);
}
}
- // MISE À JOUR DES INFOS DE L'INSTANCE
+
+ // UPDATING APPLIANCE INFORMATION
$query = $this -> pdo -> prepare(
'UPDATE instances SET version = :version WHERE reference = :reference'
);
echo "Le type d'usager est inconnu, merci de corriger la configuration.";
}
}
- // INSTANCE INEXISTANTE
+
+ // IF APPLIANCE DOES NOT EXISTS
} else {
- // MANAGERS
+
+ // GETTING PDO MANAGERS
$versionManager = new PdoVersionManager();
$produitManager = new PdoProduitManager();
$alerteManager = new PdoAlerteManager();
- // RECUPÉRATION DE L'ID DE LA VERSION
+
+ // GETTING VERSION ID
$version_id = $versionManager->getIdByValeurAndProduitId($array['version'], $produitManager->getProduitByNom($array['produit'])->getId());
- // CREATION D'UNE NOUVELLE ALERTE DE TYPE CRÉATION
+
+ // NEW WARNING CREATION, CREATION TYPE
$alerteManager = new PdoAlerteManager();
$alerte = new Alerte(null, null, "creation",
"Nouvelle instance declaree : ".$array['produit']." ; version : ".$array['version'], $version_id);
$alerteManager -> createAlerte($alerte);
- // CREATION D'UN NOUVEL HISTORIQUE
+
+ // NEW CHANGELOG CREATION
$historiqueManager = new PdoHistoriqueManager();
$historique = new Historique(null, null, array($alerteManager -> getLastAlerte() -> getId()), array($alerte -> getVersion()));
$historiqueManager -> createHistorique($historique);
- // CRÉATION D'UNE NOUVELLE INSTANCE
- // To-do : gestion des comptes exploitants
+
+ // NEW APPLIANCE CREATION
+ // TO-DO : MANAGE APPLIANCE CREATION WITH MANAGER TYPE
$instance = new Instance(
// ID
null,
- // PRODUIT
+ // PRODUCT
$array['produit'],
- // EXPLOITANT
+ // MANAGER
null,
// REFERENCE
$array['reference'],
- // VERSION ACTUELLE
+ // VERSION
$array['version'],
- // HISTORIQUE
+ // CHANGELOG
$historiqueManager -> getLastHistorique() -> getId(),
- // MAINTIEN
+ // IS MAINTAINED
true,
// FQDNs
$array['fqdn_interne'],
// OS
$array['systeme'],
// UUIDs
- $array['disques']
+ $array['disques'],
+ // CHANNEL
+ $array['canal']
);
$this->createInstance($instance);
}
$result['fqdn_interne'],
$result['fqdn_externe'],
$result['systeme'],
- $result['disques']
+ $result['disques'],
+ $result['canal']
);
$query->closeCursor();
$result['fqdn_interne'],
$result['fqdn_externe'],
$result['systeme'],
- $result['disques']
+ $result['disques'],
+ $result['canal']
);
$query->closeCursor();
$result['fqdn_interne'],
$result['fqdn_externe'],
$result['systeme'],
- $result['disques']
+ $result['disques'],
+ $result['canal']
);
}
}
- // FONCTIONS SUPPLÉMENTAIRES - HORS INTERFACE
-
public function testInformationsAvantUpload($array) {
- // TEST D'EXISTENCE DU PRODUIT
- $produitManager = new PdoProduitManager();
- $produits = $produitManager -> getNomsOfProduits();
- if(in_array($array['produit'], $produits)) {
- // TEST DE VALIDITÉ DE LA VERSION
- $versionManager = new PdoVersionManager();
- $versions = $versionManager->findValeursOfVersionsByProduitId($produitManager->getProduitByNom($array['produit'])->getId());
- if(in_array($array['version'], $versions)) {
- $retour = "ok";
+
+ // CHECKING REFERENCE FORMAT
+ $regex = '#^[A-Z]{2}/[A-Z0-9]+_[0-9]{5}_[0-9]{10}$#';
+ if (preg_match($regex, $array['reference'])) {
+
+ // CHECKING PRODUCT EXISTENCE
+ $produitManager = new PdoProduitManager();
+ $produits = $produitManager -> getNomsOfProduits();
+ if(in_array($array['produit'], $produits)) {
+
+ // CHECKING VERSION VALIDITY
+ $versionManager = new PdoVersionManager();
+ $versions = $versionManager->findValeursOfVersionsByProduitId($produitManager->getProduitByNom($array['produit'])->getId());
+ if(in_array($array['version'], $versions)) {
+ $retour = "ok";
+ } else {
+ $retour = "Cette version n'est pas disponible pour ce produit";
+ }
} else {
- $retour = "Cette version n'est pas disponible pour ce produit";
+ $retour = "Le produit n'est pas valide";
}
} else {
- $retour = "Le produit n'est pas valide";
+ $retour = 'Le format de la référence est incorrect.';
}
return $retour;
}
require_once('protected/required.php');
- class PdoProduitManager extends AbstractPdoManager implements ProduitManager {
+ class PdoProduitManager extends AbstractPdoManager {
public function createProduit($produit) {
require_once('protected/required.php');
- class PdoTemplateManager extends AbstractPdoManager implements TemplateManager {
+ class PdoTemplateManager extends AbstractPdoManager {
public function createTemplate($template) {
require_once('protected/required.php');
- class PdoVersionManager extends AbstractPdoManager implements VersionManager {
+ class PdoVersionManager extends AbstractPdoManager {
public function createVersion($version) {
protected $id, $creation, $nature, $message, $version;
- /// CONSTRUCTEUR
+ /// CONSTRUCTOR
function __construct($id = null, $creation = null, $nature = null, $message = null, $version = null) {
$this -> id = $id;
--- /dev/null
+<?php
+
+ require_once('protected/required.php');
+
+ class Client {
+
+ protected $id, $identifiantAP, $nom;
+
+ /// CONSTRUCTOR
+ function __construct($id = null, $identifiantAP = null, $nom = null) {
+
+ $this -> id = $id;
+ $this -> identifiantAP = $identifiantAP;
+ $this -> nom = $nom;
+
+ }
+
+ public function getJSON() {
+ return json_encode(get_object_vars($this));
+ }
+
+ public function getJSONP() {
+ $array["id"] = $this -> id;
+ $array["identifiantAP"] = $this -> identifiantAP;
+ $array["nom"] = $this -> nom;
+
+ return json_encode($array);
+ }
+
+ /// GETTERS
+ public function getId() { return $this -> id; }
+ public function getIdentifiantAP() { return $this->identifiantAP; }
+ public function getNom() { return $this->nom; }
+
+ /// SETTERS
+ public function setId($id) { $this -> id = $id; }
+ public function setIdentifiantAP($identifiantAP) { $this->identifiantAP = $identifiantAP; }
+ public function setNom($nom) { $this->nom = $nom; }
+
+ }
+
+?>
\ No newline at end of file
\r
protected $id, $nom, $reference, $instances;\r
\r
- /// CONSTRUCTEUR\r
+ /// CONSTRUCTOR\r
function __construct($id = null, $nom = null, $reference = null, $instances = null) {\r
\r
$this -> id = $id;\r
protected $id, $installation, $alertes, $versions;
- /// CONSTRUCTEUR
+ /// CONSTRUCTOR
function __construct($id = null, $installation = null, $alertes = null, $versions = null) {
$this -> id = $id;
class Instance {
- protected $id, $nom, $exploitant, $reference, $version, $historique, $maintenu, $fqdnInterne, $fqdnExterne, $systeme, $disques;
+ protected $id, $nom, $exploitant, $reference, $version, $historique, $maintenu, $fqdnInterne, $fqdnExterne, $systeme, $disques, $canal;
- /// CONSTRUCTEUR
+ /// CONSTRUCTOR
function __construct($id = null, $nom = null, $exploitant = null, $reference = null, $version = null, $historique = null,
- $maintenu = null, $fqdnInterne = null, $fqdnExterne = null, $systeme = null, $disques = null) {
+ $maintenu = null, $fqdnInterne = null, $fqdnExterne = null, $systeme = null, $disques = null, $canal = null) {
$this -> id = $id;
$this -> nom = $nom;
- // Référence client de l'exploitant
+ // MANAGER REFERENCE
$this -> exploitant = $exploitant;
- // Référence / identifiant de l'instance
+ // APPLIANCE REFERENCE
$this -> reference = $reference;
- // Version actuelle
+ // VERSION
$this -> version = $version;
- // Id de l'historique de màj / patchs
+ // CHANGELOG ID
$this -> historique = $historique;
- // Pseudo-booleen : vaut 1 si le instance est encore maintenu, 0 sinon
+ // APPLIANCE MAINTENANCE STATE
$this -> maintenu = $maintenu;
- // FQDNs de l'instance
+ // FQDNs
$this -> fqdnInterne = $fqdnInterne;
$this -> fqdnExterne = $fqdnExterne;
// OS
$this -> systeme = $systeme;
- // UUIDS etc
+ // UUIDS
$this -> disques = $disques;
+ // CHANNEL
+ $this -> canal = $canal;
}
public function getJSON() {
$array["fqdnExterne"] = $this -> fqdnExterne;
$array["systeme"] = $this -> systeme;
$array["disques"] = $this -> disques;
+ $array["canal"] = $this -> canal;
return json_encode($array);
}
public function getFqdnExterne() { return $this->fqdnExterne; }
public function getSysteme() { return $this->systeme; }
public function getDisques() { return $this->disques; }
+ public function getCanal() { return $this->canal; }
/// SETTERS
public function setId($id) { $this -> id = $id; }
public function setFqdnExterne($fqdnExterne) { $this->fqdnExterne = $fqdnExterne; }
public function setSysteme($systeme) { $this->systeme = $systeme; }
public function setDisques($disques) { $this->disques = $disques; }
+ public function setCanal($canal) { $this->canal = $canal; }
}
protected $id, $nom;
- /// CONSTRUCTEUR
+ /// CONSTRUCTOR
function __construct($id = null, $nom = null) {
$this -> id = $id;
protected $id, $valeur1, $valeur2, $valeur3, $valeur4, $valeur5;
- /// CONSTRUCTEUR
+ /// CONSTRUCTOR
function __construct($id = null, $valeur1 = null, $valeur2 = null, $valeur3 = null, $valeur4 = null, $valeur5 = null) {
$this -> id = $id;
protected $id, $valeur, $produit, $nature;
- /// CONSTRUCTEUR
+ /// CONSTRUCTOR
function __construct($id = null, $valeur = null, $produit = null, $nature = null) {
$this -> id = $id;
$instanceManager = new PdoInstanceManager();\r
$historiqueManager = new PdoAlerteManager();\r
\r
- // OPERATION DE SUPPRESSION UNIQUEMENT VIA INTERFACE WEBADMIN :\r
- // -> Pour le moment AW a accès à la db directement, donc pas besoin de WS\r
-\r
+ // DELETING OBJECTS IS MADE VIA ADMINSTRATION INTERFACE\r
/*switch ($_GET['method']) {\r
case 'remove_exploitant' :\r
$exploitant = new Exploitant(\r
\r
function api_get() {\r
$exploitantManager = new PdoExploitantManager();\r
+ $clientManager = new PdoClientManager();\r
$instanceManager = new PdoInstanceManager();\r
$historiqueManager = new PdoHistoriqueManager();\r
$alerteManager = new PdoAlerteManager();\r
+ $versionManager = new PdoVersionManager();\r
\r
if($_GET['action']) {\r
switch ($_GET['action']) {\r
}\r
break;\r
\r
- case 'test_sugar' :\r
+ case 'synchroniser_infos_clients' :\r
+\r
+ // LOGIN\r
+ $sugarConnector = new SugarConnector();\r
+ $sugarConnector -> login('test', 'test');\r
+\r
+ // GETTING CUSTOMERS ON SUGAR\r
$moduleName = 'Accounts';\r
$requestedInfos = array(\r
'name',\r
'phone_office',\r
'officenumber_c'\r
);\r
+ $client_infos = json_decode($sugarConnector -> getInfosModule($moduleName, $requestedInfos));\r
+\r
+ foreach($client_infos->entry_list as $client_info) {\r
+\r
+ // CHECKING RESULTS\r
+ if(isset($client_info)) {\r
+ $identifiantAP = $client_info->name_value_list->officenumber_c->value;\r
+ $nom = $client_info->name_value_list->name->value;\r
+\r
+ // IF AP ID IS NOT EMPTY\r
+ if(isset($identifiantAP) && $identifiantAP != "") {\r
+\r
+ // GETTING CUSTOMER IN DB\r
+ $client = $clientManager -> getClientByIdentifiantAP($identifiantAP);\r
+\r
+ // IF CUSTOMER EXISTS, UPDATING INFORMATION\r
+ if(isset($client) && $client->getId() > 0) {\r
+ $client -> setIdentifiantAP($identifiantAP);\r
+ $client -> setNom($nom);\r
+ $clientManager -> updateClient($client);\r
+\r
+ // IF CUSTOMER DOES NOT EXIST, CREATING A NEW ONE\r
+ } else {\r
+ $client = new Client(null, $identifiantAP, $nom);\r
+ $clientManager -> createClient($client);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ break;\r
+\r
+ case 'check_synchro_info_version' :\r
+\r
+ // LOGIN\r
$sugarConnector = new SugarConnector();\r
$sugarConnector -> login('admin', 'admin');\r
- echo $sugarConnector -> getInfosModule($moduleName, $requestedInfos);\r
+\r
+ // GETTING APPLIANCES\r
+ $moduleName = 'allo_Instances';\r
+ $requestedInfos = array(\r
+ 'id',\r
+ 'name'\r
+ );\r
+ $instances_infos = json_decode($sugarConnector -> getInfosModule($moduleName, $requestedInfos));\r
+\r
+ foreach($instances_infos->entry_list as $instance_infos) {\r
+\r
+ // IF APPLIANCE EXISTS IN SUGAR\r
+ if(isset($instance_infos)) {\r
+ $refInstance = $instance_infos->name_value_list->name->value;\r
+ $refInstanceArray = explode("/",$refInstance);\r
+ $refClient = substr($refInstanceArray[1],0,-11);\r
+ $refInstall = $refInstanceArray[0]."/".substr($refClient,0,-6);\r
+\r
+ // GETTING APPLIANCE IN DB\r
+ $instance = $instanceManager -> getInstanceByReference($refInstance);\r
+\r
+ // IF APPLIANCE EXISTS ON BOTH SIDES, COMPARING INFORMATIONS\r
+ if(isset($instance) && $instance->getId() > 0) {\r
+\r
+ // GETTING CHANGELOG OF APPLIANCE\r
+ $historique = $historiqueManager -> getHistorique($instance -> getHistorique());\r
+ $versions = $historique -> getVersions();\r
+\r
+ // CHECKING OPPORTUNITY EXISTENCE FOR EACH VERSION OF CHANGELOG\r
+ foreach($versions as $version) {\r
+\r
+ // GETTING VALUE OF EACH VERSION OF CHANGELOG, AND ITS DECLARATION DATE\r
+ $versionArray = explode(';',$version);\r
+ if(isset($versionArray[1])) {\r
+ $versionId = $versionArray[0];\r
+ $declaration = $versionArray[1];\r
+ } else {\r
+ $versionId = $version;\r
+ $declaration = $historique -> getInstallation();\r
+ }\r
+ $versionValeur = $versionManager -> getVersion($versionId) -> getValeur();\r
+ $refVersion = $refInstanceArray[0].' '.$versionValeur;\r
+\r
+ // GETTING VERSION ID ON SUGAR\r
+ $moduleName = 'adul__Produits';\r
+ $requestedInfos = array(\r
+ 'id',\r
+ 'name'\r
+ );\r
+ $sqlWhereClause = "adul__produits.name = '".$refVersion."'";\r
+ $version_infos = json_decode($sugarConnector -> getInfosModule($moduleName, $requestedInfos, $sqlWhereClause));\r
+ if(isset($version_infos->entry_list[0])) {\r
+ $idVersion = $version_infos->entry_list[0]->id;\r
+ }\r
+\r
+ // GETTING OPPORTUNITIES LINKED TO THE VERSION IN SUGAR\r
+ if(isset($idVersion)) {\r
+ $moduleName = 'adul__Produits';\r
+ $parameters = array(\r
+ "link_name" => "adul__prits_opportunities",\r
+ "primary_module_id" => $idVersion,\r
+ );\r
+ $requestedInfos = array(\r
+ 'id',\r
+ 'name',\r
+ 'date_opened_c'\r
+ );\r
+ $sqlWhereClause = "opportunities.name = '".$refInstall."'";\r
+ $result = json_decode($sugarConnector -> getRelationships($moduleName, $parameters, $requestedInfos, $sqlWhereClause));\r
+\r
+ // COMPARING INFORMATIONS IN ORDER TO FIND A CONCORDANCE : DATES, CHANNEL, et cetera\r
+ $testRecherche = false;\r
+ foreach($result->entry_list as $fiche_install_info) {\r
+\r
+ // IF OPPORTUNITY EXISTS IN SUGAR\r
+ if(isset($fiche_install_info->id)) {\r
+ if($fiche_install_info->name_value_list->date_opened_c->value == $declaration) {\r
+ $testRecherche = true;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+\r
+ // IF NO OPPORTUNITY IS FOUND FOR THE VERSION\r
+ if(!$testRecherche) {\r
+\r
+ // CREATING NEW WARNING, VERSION TYPE\r
+ $alerte = new Alerte(null, $declaration, "version",\r
+ "Version declaree ".$versionValeur." n'a pas de fiche d'installation sur Sugar pour cette instance.", $versionId);\r
+ $alerteManager -> createAlerte($alerte);\r
+\r
+ // GETTING APPLIANCE CHANGELOG\r
+ $historiqueManager = new PdoHistoriqueManager();\r
+ $historique = $historiqueManager -> getHistorique($instance -> getHistorique());\r
+\r
+ // ADDING WARNING TO CHANGELOG\r
+ $alertes = $historique -> getAlertes();\r
+ if((array_search("", $alertes)) !== false) {\r
+ $alertes = array($alerteManager -> getLastAlerte() -> getId());\r
+ } else {\r
+ $alertes[] = $alerteManager -> getLastAlerte() -> getId();\r
+ }\r
+ $historique -> setAlertes($alertes);\r
+ $historiqueManager -> updateHistorique($historique);\r
+ }\r
+ }\r
+ }\r
+ } else {\r
+ echo "Instance d'application existante sur Sugar introuvable sur ALLO Serveur.";\r
+ }\r
+ }\r
+ }\r
break;\r
\r
- case 'get_client' :\r
+ case 'create_fiche_installation' :\r
+\r
+ // GETTING REFERENCES\r
+ $refInstance = str_replace("\\", "", $_GET['nom']);\r
+ $instance = $instanceManager -> getInstanceByReference($refInstance);\r
+ $historique = $historiqueManager -> getHistorique($instance -> getHistorique());\r
+ $refInstanceArray = explode("/",$refInstance);\r
+ $refClient = substr($refInstanceArray[1],0,-11);\r
+ $refContrat = $refInstanceArray[0]."/".$refClient."/20".substr($refInstanceArray[1],19,-4);\r
+ $refInstall = $refInstanceArray[0]."/".substr($refClient,0,-6);\r
+ $refVersion = $refInstanceArray[0].' '.$instance -> getVersion();\r
+\r
+ /*\r
+ echo "REF INSTANCE = ".$refInstance."<br/>";\r
+ echo "REF CLIENT = ".$refClient."<br/>";\r
+ echo "REF CONTRAT = ".$refContrat."<br/>";\r
+ echo "REF INSTALL = ".$refInstall."<br/>";\r
+ echo "REF VERSION = ".$refVersion."<br/>";\r
+ */\r
+\r
// LOGIN\r
$sugarConnector = new SugarConnector();\r
$sugarConnector -> login('admin', 'admin');\r
\r
- // RECUPÉRATION DE LA FICHE D'INSTALL DE L'INSTANCE VIA SA RÉFERENCE\r
- $moduleName = 'Opportunities';\r
- $requestedInfos = array('account_id');\r
- $sqlWhereClause = "opportunities.name = '".$_GET['reference']."'";\r
- $sqlOrderByClause = "opportunities.date_opened_c DESC";\r
- $fiche_install_infos = json_decode($sugarConnector -> getInfosModule($moduleName, $requestedInfos, $sqlWhereClause, $sqlOrderByClause));\r
+ // GETTING APPLIANCE IN SUGAR\r
+ $moduleName = 'allo_Instances';\r
+ $requestedInfos = array('name');\r
+ $sqlWhereClause = "allo_instances.name = '".$refInstance."'";\r
+ $instance_infos = json_decode($sugarConnector -> getInfosModule($moduleName, $requestedInfos, $sqlWhereClause));\r
+ if(isset($instance_infos->entry_list[0])) {\r
+ $idInstance = $instance_infos->entry_list[0]->id;\r
+ }\r
\r
- // RÉCUPÉRATION DU COMPTE ASSOCIÉ VIA L'ID CLIENT DE LA FICHE D'INSTALL\r
- $moduleName = 'Accounts';\r
+ // GETTING THE MAINTENANCE CONTRACT\r
+ $moduleName = 'maint_contrat_maintenance';\r
$requestedInfos = array(\r
'name',\r
- 'billing_address_street',\r
- 'phone_office',\r
- 'officenumber_c'\r
+ 'etat_contrat_c'\r
);\r
- $sqlWhereClause = "accounts.id = '".$fiche_install_infos->entry_list[0]->name_value_list->account_id->value."'";\r
- $client_infos = json_decode($sugarConnector -> getInfosModule($moduleName, $requestedInfos, $sqlWhereClause));\r
- echo $client_infos->entry_list[0]->name_value_list->name->value;\r
+ $sqlWhereClause = "maint_contrat_maintenance.name = '".$refContrat."'";\r
+ $contrat_infos = json_decode($sugarConnector -> getInfosModule($moduleName, $requestedInfos, $sqlWhereClause));\r
+ if(isset($contrat_infos->entry_list[0])) {\r
+ $idContrat = $contrat_infos->entry_list[0]->id;\r
+ }\r
+\r
+ // QUESTIONING ITS VALIDITY STATE\r
+ $etatContrat = $contrat_infos->entry_list[0]->name_value_list->etat_contrat_c->value;\r
+\r
+ // IF NOT VALID OR DOES NOT EXIST, ERROR\r
+ if(!isset($idContrat) || $etatContrat != "^encours^") {\r
+ echo "Erreur : Contrat de maintenance inexistant ou invalide pour cette instance<br/>";\r
+ } else {\r
+\r
+ // IF APPLIANCE DOES NOT EXIST, CREATING NEW ONE\r
+ if(!isset($idInstance)) {\r
+ // CRÉATION D'INSTANCE\r
+ $moduleName = 'allo_Instances';\r
+ $parameters = array(\r
+ 'name' => $refInstance\r
+ );\r
+ $instance_infos = json_decode($sugarConnector -> updateOrCreateEntryModule($moduleName, $parameters));\r
+ $idInstance = $instance_infos->id;\r
+\r
+ // LINKING IT TO MAINTENANCE CONTRACT\r
+ if(isset($idInstance) && isset($idContrat)) {\r
+ $moduleName = 'maint_contrat_maintenance';\r
+ $parameters = array(\r
+ 'link_name' => 'maint_contrat_maintenance_allo_instances_1',\r
+ 'primary_module_id' => $idContrat,\r
+ 'related_module_id' => $idInstance\r
+ );\r
+ $sugarConnector -> createRelationship($moduleName, $parameters);\r
+ }\r
+ }\r
+\r
+ // GETTING OPPORTUNITIES OF APPLIANCE\r
+ $moduleName = 'Opportunities';\r
+ $requestedInfos = array('id');\r
+ $sqlWhereClause = "opportunities.name = '".$refInstall."'";\r
+ $fiche_install_infos = json_decode($sugarConnector -> getInfosModule($moduleName, $requestedInfos, $sqlWhereClause));\r
+ $idInstall = $fiche_install_infos->entry_list[0]->id;\r
+ if(isset($idInstall)) {\r
+\r
+ // GETTING MOST RECENT OPPORTUNITY\r
+ $lastFI = $fiche_install_infos->entry_list[0];\r
+ foreach($fiche_install_infos->entry_list as $fiche_install_info) {\r
+\r
+ // RESEARCH CRITERION : NO CLOSING DATE AND LAST ADDED\r
+ if(!isset($fiche_install_info->name_value_list->date_closed->value) &&\r
+ $fiche_install_info->name_value_list->date_entered->value > $lastFI->name_value_list->date_entered->value) {\r
+ $lastFI = $fiche_install_info;\r
+ }\r
+ }\r
+ $versions = $historique -> getVersions();\r
+ $lastDeclaration = $historique -> getInstallation();\r
+ $lastVersion = $instance -> getVersion();\r
+\r
+ // GETTING DATE OF THE LAST VERSION DECLARATION\r
+ foreach($versions as $version) {\r
+ $versionArray = explode(';',$version);\r
+ if(isset($versionArray[1])) {\r
+ $declaration = $versionArray[1];\r
+ if($declaration > $lastDeclaration) {\r
+ $lastDeclaration = $declaration;\r
+ $lastVersionId = $versionArray[0];\r
+ }\r
+ }\r
+ }\r
+\r
+ // LAST VERSION DECLARED\r
+ if(isset($lastVersionId)) {\r
+ $lastVersion = $versionManager -> getVersion($lastVersionId) -> getValeur();\r
+ }\r
+\r
+ // UPDATING LAST OPPORTUNITY IN SUGAR : ADDING CLOSING DATE\r
+ $idLastFi = $lastFI->id;\r
+ $moduleName = 'Opportunities';\r
+ $parameters = array(\r
+ 'id' => $idLastFi,\r
+ 'date_closed' => $lastDeclaration\r
+ );\r
+ $sugarConnector -> updateOrCreateEntryModule($moduleName, $parameters);\r
+\r
+ // CREATING NEW OPPORTUNITY\r
+ $moduleName = 'Opportunities';\r
+ $parameters = array(\r
+ 'name' => $refInstall,\r
+ 'type_exploitation_c' => $instance->getCanal(),\r
+ 'date_opened_c' => $lastDeclaration,\r
+ 'systeme_d_exploitation_c' => $instance->getSysteme(),\r
+ 'liste_hebergement_c' => 'CLIENT',\r
+ 'description' => 'Création par ALLO'\r
+ );\r
+ $fiche_install_infos = json_decode($sugarConnector -> updateOrCreateEntryModule($moduleName, $parameters));\r
+ $idInstall = $fiche_install_infos->id;\r
+\r
+ // CHANGING VERSION REFERENCE TO LINK TO THE OPPORTUNITY\r
+ $refVersion = $refInstanceArray[0].' '.$lastVersion;\r
+\r
+ // IF NO OPPORTUNITY IS FOUND ON SUGAR FOR THIS APPLIANCE, CREATING NEW ONE\r
+ } else {\r
+ $moduleName = 'Opportunities';\r
+ $parameters = array(\r
+ 'name' => $refInstall,\r
+ 'type_exploitation_c' => $instance->getCanal(),\r
+ 'date_opened_c' => $historique->getInstallation(),\r
+ 'systeme_d_exploitation_c' => $instance->getSysteme(),\r
+ 'liste_hebergement_c' => 'CLIENT',\r
+ 'description' => 'Création par ALLO'\r
+ );\r
+ $fiche_install_infos = json_decode($sugarConnector -> updateOrCreateEntryModule($moduleName, $parameters));\r
+ $idInstall = $fiche_install_infos->id;\r
+ }\r
+\r
+ // LINKING OPPORTUNITY TO APPLIANCE\r
+ if(isset($idInstance) && isset($idInstall)) {\r
+ $moduleName = 'allo_Instances';\r
+ $parameters = array(\r
+ 'link_name' => 'allo_instances_opportunities_1',\r
+ 'primary_module_id' => $idInstance,\r
+ 'related_module_id' => $idInstall\r
+ );\r
+ $sugarConnector -> createRelationship($moduleName, $parameters);\r
+ }\r
+\r
+ // GETTING VERSION ID IN SUGAR\r
+ $moduleName = 'adul__Produits';\r
+ $requestedInfos = array('name');\r
+ $sqlWhereClause = "adul__produits.name = '".$refVersion."'";\r
+ $version_infos = json_decode($sugarConnector -> getInfosModule($moduleName, $requestedInfos, $sqlWhereClause));\r
+ if(isset($version_infos->entry_list[0])) {\r
+ $idVersion = $version_infos->entry_list[0]->id;\r
+ }\r
+\r
+ // LINKING OPPORTUNITY TO VERSION\r
+ if(isset($idVersion) && isset($idInstall)) {\r
+ $moduleName = 'adul__Produits';\r
+ $parameters = array(\r
+ 'link_name' => 'adul__prits_opportunities',\r
+ 'primary_module_id' => $idVersion,\r
+ 'related_module_id' => $idInstall\r
+ );\r
+ $sugarConnector -> createRelationship($moduleName, $parameters);\r
+ }\r
+\r
+ // GETTING CUSTOMER ID\r
+ $moduleName = 'Accounts';\r
+ $requestedInfos = array(\r
+ 'id',\r
+ 'officenumber_c'\r
+ );\r
+ $sqlWhereClause = "accounts_cstm.officenumber_c = '".$refClient."'";\r
+ $client_infos = json_decode($sugarConnector -> getInfosModule($moduleName, $requestedInfos, $sqlWhereClause));\r
+ if(isset($client_infos->entry_list[0])) {\r
+ $idClient = $client_infos->entry_list[0]->id;\r
+ }\r
+\r
+ // LINKING OPPORTUNITY TO CUSTOMER\r
+ if(isset($idClient) && isset($idInstall)) {\r
+ $moduleName = 'Accounts';\r
+ $parameters = array(\r
+ 'link_name' => 'opportunities',\r
+ 'primary_module_id' => $idClient,\r
+ 'related_module_id' => $idInstall\r
+ );\r
+ $sugarConnector -> createRelationship($moduleName, $parameters);\r
+ $moduleName = 'Opportunities';\r
+ $parameters = array(\r
+ 'link_name' => 'accounts',\r
+ 'primary_module_id' => $idInstall,\r
+ 'related_module_id' => $idClient\r
+ );\r
+ $sugarConnector -> createRelationship($moduleName, $parameters);\r
+ }\r
+ }\r
break;\r
}\r
} else { echo "Welcome sur ALLO Serveur !"; }\r
break;\r
*/\r
case 'upload_info' :\r
- // RÉCUPÉRATION DES DONNÉES\r
+\r
+ // GETTING REQUEST DATA\r
$data = file_get_contents("php://input");\r
- // DECODE DU JSON\r
+\r
+ // DECODING JSON\r
$array = json_decode($data, true);\r
- // TEST DE CHAINE VIDE / CORROMPUE\r
+\r
+ // CHECKING IF ARRAY IS VALID\r
if (!is_null($array) && assert($array)) {\r
$instanceManager = new PdoInstanceManager();\r
- // TEST DES INFORMATIONS ENVOYEES\r
+\r
+ // CHEKING INFORMATION\r
$retour = $instanceManager->testInformationsAvantUpload($array);\r
if($retour === 'ok') {\r
- // MISE A JOUR DES INFORMATIONS DE L'INSTANCE\r
+\r
+ // UPADATING APPLIANCE INFORMATION\r
$instanceManager -> updateInstanceInfos($array);\r
} else {\r
echo $retour;\r
}\r
+ } else {\r
+ var_dump($data);\r
}\r
break;\r
\r
\r
header('Content-Type: text/html; charset=utf-8');\r
\r
+ // MODELS\r
require_once('classes/models/Exploitant.class.php');\r
require_once('classes/models/Instance.class.php');\r
require_once('classes/models/Historique.class.php');\r
require_once('classes/models/Alerte.class.php');\r
require_once('classes/models/Produit.class.php');\r
require_once('classes/models/Version.class.php');\r
+ require_once('classes/models/Client.class.php');\r
\r
- require_once('classes/manager/ExploitantManager.class.php');\r
- require_once('classes/manager/InstanceManager.class.php');\r
- require_once('classes/manager/HistoriqueManager.class.php');\r
- require_once('classes/manager/AlerteManager.class.php');\r
- require_once('classes/manager/ProduitManager.class.php');\r
- require_once('classes/manager/VersionManager.class.php');\r
-\r
+ // MANAGERS\r
require_once('classes/manager/pdo/AbstractPdoManager.php');\r
-\r
require_once('classes/manager/pdo/PdoExploitantManager.php');\r
require_once('classes/manager/pdo/PdoInstanceManager.php');\r
require_once('classes/manager/pdo/PdoHistoriqueManager.php');\r
require_once('classes/manager/pdo/PdoAlerteManager.php');\r
require_once('classes/manager/pdo/PdoProduitManager.php');\r
require_once('classes/manager/pdo/PdoVersionManager.php');\r
+ require_once('classes/manager/pdo/PdoClientManager.php');\r
\r
+ // SUGAR CONNECTOR\r
require_once('classes/SugarHttpClient.php');\r
require_once('classes/SugarConnector.class.php');\r
?>
\ No newline at end of file