librairie du client virtuel
This commit is contained in:
parent
c5da74971b
commit
0170415103
|
@ -1,6 +1,4 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
|
|
||||||
<svg
|
<svg
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
@ -9,59 +7,42 @@
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
width="32.000046"
|
enable-background="new 0 0 24 24"
|
||||||
height="32"
|
id="Layer_1"
|
||||||
viewBox="0 0 32.000047 32.000001"
|
version="1.0"
|
||||||
id="svg2"
|
viewBox="0 0 32 32"
|
||||||
version="1.1"
|
xml:space="preserve"
|
||||||
inkscape:version="0.91 r13725"
|
inkscape:version="0.91 r13725"
|
||||||
sodipodi:docname="permission.svg">
|
sodipodi:docname="permission.svg"
|
||||||
<defs
|
width="32"
|
||||||
id="defs4" />
|
height="32"><metadata
|
||||||
<sodipodi:namedview
|
id="metadata4243"><rdf:RDF><cc:Work
|
||||||
id="base"
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs4241" /><sodipodi:namedview
|
||||||
pagecolor="#ffffff"
|
pagecolor="#ffffff"
|
||||||
bordercolor="#666666"
|
bordercolor="#666666"
|
||||||
borderopacity="1.0"
|
borderopacity="1"
|
||||||
inkscape:pageopacity="0.0"
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
inkscape:pageshadow="2"
|
inkscape:pageshadow="2"
|
||||||
inkscape:zoom="31.678384"
|
inkscape:window-width="1920"
|
||||||
inkscape:cx="17.400943"
|
inkscape:window-height="1056"
|
||||||
inkscape:cy="13.084972"
|
id="namedview4239"
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
showgrid="false"
|
||||||
fit-margin-top="0"
|
fit-margin-top="0"
|
||||||
fit-margin-left="0"
|
fit-margin-left="0"
|
||||||
fit-margin-right="0"
|
fit-margin-right="0"
|
||||||
fit-margin-bottom="0"
|
fit-margin-bottom="0"
|
||||||
units="px"
|
inkscape:zoom="4.8385417"
|
||||||
inkscape:window-width="1920"
|
inkscape:cx="-0.61365268"
|
||||||
inkscape:window-height="1056"
|
inkscape:cy="-40.057419"
|
||||||
inkscape:window-x="0"
|
inkscape:window-x="0"
|
||||||
inkscape:window-y="24"
|
inkscape:window-y="24"
|
||||||
inkscape:window-maximized="1" />
|
inkscape:window-maximized="1"
|
||||||
<metadata
|
inkscape:current-layer="Layer_1" /><path
|
||||||
id="metadata7">
|
d="M 11.2,0 C 4.96,0 0,4.96 0,11.2 c 0,6.24 4.96,11.2 11.2,11.2 1.433766,0 2.792902,-0.274046 4.046875,-0.753125 L 17.6,24 l 3.2,0 0,3.2 3.2,0 0,3.2 1.11875,1.11875 C 25.43875,31.83875 25.760626,32 26.240626,32 L 30.4,32 c 0.96,0 1.6,-0.64 1.6,-1.6 l 0,-4.159374 c 0,-0.48 -0.16125,-0.801876 -0.48125,-1.121876 L 21.646875,15.246875 C 22.125954,13.992902 22.4,12.633766 22.4,11.2 22.4,4.96 17.44,0 11.2,0 Z M 8.8,4.8 c 2.24,0 4,1.76 4,4 0,2.24 -1.76,4 -4,4 -2.24,0 -4,-1.76 -4,-4 0,-2.24 1.76,-4 4,-4 z"
|
||||||
<rdf:RDF>
|
id="path4235"
|
||||||
<cc:Work
|
inkscape:connector-curvature="0" /></svg>
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title></dc:title>
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1"
|
|
||||||
transform="translate(333.94131,-91.61319)">
|
|
||||||
<path
|
|
||||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#333f4f;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
|
||||||
d="m -317.89552,91.613047 a 1.4645832,1.4645832 0 0 0 -0.6979,0.211657 l -2.98417,1.805757 -3.48757,-0.123943 a 1.4645832,1.4645832 0 0 0 -1.33478,0.758913 l -1.68181,3.056631 -3.08142,1.637957 a 1.4645832,1.4645832 0 0 0 -0.77798,1.323331 l 0.0724,3.48757 -1.84961,2.95938 a 1.4645832,1.4645832 0 0 0 -0.0114,1.535 l 1.80766,2.98417 -0.12394,3.48756 a 1.4645832,1.4645832 0 0 0 0.75701,1.33478 l 3.05854,1.68182 1.63604,3.08142 a 1.4645832,1.4645832 0 0 0 1.32334,0.77797 l 3.48948,-0.0724 2.95748,1.84962 a 1.4645832,1.4645832 0 0 0 1.53498,0.0114 l 2.98608,-1.80766 3.48567,0.12395 a 1.4645832,1.4645832 0 0 0 1.33668,-0.75702 l 1.6799,-3.05663 3.08142,-1.63795 a 1.4645832,1.4645832 0 0 0 0.77799,-1.32334 l -0.0724,-3.48948 1.84961,-2.95747 a 1.4645832,1.4645832 0 0 0 0.0114,-1.53499 l -1.80766,-2.98607 0.12394,-3.48567 a 1.4645832,1.4645832 0 0 0 -0.75701,-1.336682 l -3.05853,-1.679907 -1.63605,-3.083326 a 1.4645832,1.4645832 0 0 0 -1.32333,-0.776075 l -3.48948,0.07246 -2.95748,-1.85152 a 1.4645832,1.4645832 0 0 0 -0.83709,-0.221191 z m 0.0476,3.18248 2.56467,1.605541 a 1.4645832,1.4645832 0 0 0 0.80658,0.221192 l 3.02422,-0.06292 1.41868,2.671453 a 1.4645832,1.4645832 0 0 0 0.58729,0.596834 l 2.65238,1.458713 -0.10868,3.02231 a 1.4645832,1.4645832 0 0 0 0.21165,0.81039 l 1.56741,2.58756 -1.60554,2.56468 a 1.4645832,1.4645832 0 0 0 -0.22311,0.80658 l 0.0648,3.02421 -2.67336,1.41867 a 1.4645832,1.4645832 0 0 0 -0.59492,0.5873 l -1.45873,2.65048 -3.0223,-0.10678 a 1.4645832,1.4645832 0 0 0 -0.8104,0.21166 l -2.58755,1.56549 -2.56467,-1.60363 a 1.4645832,1.4645832 0 0 0 -0.80658,-0.2231 l -3.02422,0.063 -1.41867,-2.67145 a 1.4645832,1.4645832 0 0 0 -0.58731,-0.59683 l -2.65047,-1.45681 0.10677,-3.0223 a 1.4645832,1.4645832 0 0 0 -0.21165,-0.8104 l -1.5655,-2.58756 1.60364,-2.56467 a 1.4645832,1.4645832 0 0 0 0.2231,-0.80659 l -0.063,-3.02421 2.67145,-1.418671 a 1.4645832,1.4645832 0 0 0 0.59684,-0.589207 l 1.45681,-2.650477 3.02231,0.108688 a 1.4645832,1.4645832 0 0 0 0.8104,-0.211657 l 2.58755,-1.567405 z"
|
|
||||||
id="stylisable"
|
|
||||||
inkscape:connector-curvature="0" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 2.1 KiB |
|
@ -31,6 +31,7 @@
|
||||||
<script type='text/javascript' src='/js/lib/page-manager.js' ></script> <!-- Gestion réseau/chargement/liens/URL -->
|
<script type='text/javascript' src='/js/lib/page-manager.js' ></script> <!-- Gestion réseau/chargement/liens/URL -->
|
||||||
<script type='text/javascript' src='/js/lib/form-deflater.js' ></script> <!-- Gestion des formulaires (Object) -->
|
<script type='text/javascript' src='/js/lib/form-deflater.js' ></script> <!-- Gestion des formulaires (Object) -->
|
||||||
<script type='text/javascript' src='/js/lib/local-storage-interface.js' ></script> <!-- Interface pour le 'localStorage' -->
|
<script type='text/javascript' src='/js/lib/local-storage-interface.js' ></script> <!-- Interface pour le 'localStorage' -->
|
||||||
|
<script type='text/javascript' src='/test/client/lib.js' ></script> <!-- Dépendance Directe -->
|
||||||
<style type='text/css'>
|
<style type='text/css'>
|
||||||
body{
|
body{
|
||||||
background: #1c384b;
|
background: #1c384b;
|
||||||
|
@ -249,6 +250,13 @@
|
||||||
lsi.import('STATES.CNF', response.states);
|
lsi.import('STATES.CNF', response.states);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* (5) On initialise les puces */
|
||||||
|
var chip = {
|
||||||
|
led: new LedInterface( new Chip(1, 2, 3), led ),
|
||||||
|
r1: new RelayInterface( new Chip(4), r1 ),
|
||||||
|
r2: new RelayInterface( new Chip(5), r2 )
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* [1] Fonctions
|
/* [1] Fonctions
|
||||||
=========================================================*/
|
=========================================================*/
|
||||||
|
@ -320,7 +328,7 @@
|
||||||
COUNT++;
|
COUNT++;
|
||||||
|
|
||||||
if( COUNT == 1 ) STATE[0] = !STATE[0];
|
if( COUNT == 1 ) STATE[0] = !STATE[0];
|
||||||
if( COUNT == 2 ) STATE[1] = true;
|
if( COUNT == 2 ) STATE[0] = STATE[1] = true;
|
||||||
if( COUNT == 3 ) STATE[2] = true;
|
if( COUNT == 3 ) STATE[2] = true;
|
||||||
|
|
||||||
updateChips();
|
updateChips();
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
var Chip;
|
||||||
|
(function(){Chip=function(){this.pins=[];this.pin={};for(var a=0;a<arguments.length;a++)parseInt(arguments[a])==arguments[a]&&(this.pins.push(parseInt(arguments[a])),this.pin[parseInt(arguments[a])]=0)};Chip.prototype={pin:this.pin,pins:this.pins};Chip.prototype.setPin=function(a,b){if(parseInt(a)==a&&this.pin.hasOwnProperty(a)){if("boolean"==typeof b)b=b?255:0;else if(b!=parseInt(b)||0>b||255<b)return;b=parseInt(b);this.pin[a]=b}};Chip.prototype.setPins=function(a){for(var b=0;b<this.pins.length;b++)this.setPin(this.pin[this.pins[b]],a[b])};
|
||||||
|
Chip.prototype.getPin=function(a){if(parseInt(a)==a&&this.pin.hasOwnProperty(a))return this.pin[a]};Chip.prototype.getPins=function(){for(var a=[],b=0;b<this.pins.length;b++)a.push(this.getPin(this.pins[b]));return a}})();var LedInterface;
|
||||||
|
(function(){LedInterface=function(a,b){a instanceof Chip&&b instanceof Element&&(this.chip=a,this.container=b)};LedInterface.prototype={chip:this.chip,container:this.container};LedInterface.prototype.apply=function(){this.container.style.background="rgb("+this.chip.pin[0]+","+this.chip.pin[1]+","+this.chip.pin[2]+")"}})();var RelayInterface;
|
||||||
|
(function(){RelayInterface=function(a,b){a instanceof Chip&&b instanceof Element&&(this.chip=a,this.container=b)};RelayInterface.prototype={chip:this.chip,container:this.container};RelayInterface.prototype.apply=function(){this.chip.pin[0]?this.container.addClass("active"):this.container.remClass("active")}})();var previous,action;
|
||||||
|
(function(){previous=function(a,b){a=a.toLowerCase();for(var c=0;c<a.length;c++)if("x"!=a[c]&&a[c]!=b[c])return!1;return!0};action=function(a,b){a=a.toLowerCase();for(var c=0;c<a.length;c++)"x"!=a[c]&&(isNaN(a[c])||(b[c]=parseInt(a[c])))}})();
|
|
@ -0,0 +1,251 @@
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// _ ____ _ _
|
||||||
|
// ___| | __ _ ___ ___ / ___| |__ (_)_ __
|
||||||
|
// / __| |/ _` / __/ __| | | | '_ \| | '_ \
|
||||||
|
// | (__| | (_| \__ \__ \ | |___| | | | | |_) |
|
||||||
|
// \___|_|\__,_|___/___/ \____|_| |_|_| .__/
|
||||||
|
// |_|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
var Chip;
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/* CLASSE 'Chip' Correspond à un périphérique processeur
|
||||||
|
*
|
||||||
|
* @Pin1<int> Numéro de la première PIN
|
||||||
|
* @Pin2<int> Numéro de la seconde PIN
|
||||||
|
* @Pin...<int> Numéro de la ... PIN
|
||||||
|
*
|
||||||
|
* @return Chip<Chip> Retourne une instance de 'Chip'
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Chip = function(){
|
||||||
|
/* On initialise les attributs */
|
||||||
|
this.pins = [];
|
||||||
|
this.pin = {};
|
||||||
|
|
||||||
|
/* On vérifie qu'on a que des nombres entiers */
|
||||||
|
for( var i = 0 ; i < arguments.length ; i++ )
|
||||||
|
if( parseInt(arguments[i]) == arguments[i] ){
|
||||||
|
this.pins.push( parseInt(arguments[i]) );
|
||||||
|
this.pin[ parseInt(arguments[i]) ] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Chip.prototype = {
|
||||||
|
pin: this.pin, // Liste des numéros des Pin's et leurs valeur
|
||||||
|
pins: this.pins // Liste des numéros des Pin's (ordonnée)
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ATTRIBUE UNE VALEUR A UNE PIN DONNEE
|
||||||
|
*
|
||||||
|
* @pin<int> Numéro de la pin
|
||||||
|
* @value<int/Boolean> Valeur dans 0-255 (ou booléen) à attribuer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Chip.prototype.setPin = function(pin, value){
|
||||||
|
/* [0] Vérification des paramètres
|
||||||
|
=========================================================*/
|
||||||
|
/* (1) On vérifie que @pin est un entier et qu'elle existe */
|
||||||
|
if( parseInt(pin) != pin || !this.pin.hasOwnProperty(pin) ) return;
|
||||||
|
|
||||||
|
/* (2) On vérifie que @value est un booléen, si oui : true=>255, false=>0 */
|
||||||
|
if( typeof value == 'boolean' )
|
||||||
|
value = value ? 255 : 0;
|
||||||
|
|
||||||
|
/* (3) On vérifie que @value est dans 0-255 */
|
||||||
|
else if( value != parseInt(value) || value < 0 || value > 255 ) return;
|
||||||
|
|
||||||
|
// On met @value en entier
|
||||||
|
value = parseInt(value);
|
||||||
|
|
||||||
|
|
||||||
|
/* [1] On attribue la valeur
|
||||||
|
=========================================================*/
|
||||||
|
this.pin[pin] = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* ATTRIBUE LES VALEUR DES PIN
|
||||||
|
*
|
||||||
|
* @values<Array> Valeurs
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Chip.prototype.setPins = function(values){
|
||||||
|
for( var i = 0 ; i < this.pins.length ; i++ )
|
||||||
|
this.setPin( this.pin[this.pins[i]], values[i] );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* RECUPERE LA VALEUR D'UNE PIN DONNEE
|
||||||
|
*
|
||||||
|
* @pin<int> Numéro de la pin à lire
|
||||||
|
*
|
||||||
|
* @return value<int> Valeur entière dans 0-255
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Chip.prototype.getPin = function(pin){
|
||||||
|
/* [0] Vérification des paramètres
|
||||||
|
=========================================================*/
|
||||||
|
/* (1) On vérifie que @pin est un entier et qu'elle existe */
|
||||||
|
if( parseInt(pin) != pin || !this.pin.hasOwnProperty(pin) ) return;
|
||||||
|
|
||||||
|
|
||||||
|
/* [1] On retourne la valeur
|
||||||
|
=========================================================*/
|
||||||
|
return this.pin[pin];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* RECUPERE LES VALEUR DES PIN
|
||||||
|
*
|
||||||
|
* @return values<Array> Valeurs
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Chip.prototype.getPins = function(){
|
||||||
|
var values = [];
|
||||||
|
|
||||||
|
for( var i = 0 ; i < this.pins.length ; i++ )
|
||||||
|
values.push( this.getPin( this.pins[i] ) );
|
||||||
|
|
||||||
|
return values;
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var LedInterface;
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
|
||||||
|
/* CONSTRUCTEUR D'INTERFACE DE LED
|
||||||
|
*
|
||||||
|
* @chip<Chip> Puce associée à la LED
|
||||||
|
* @container<Element> Conteneur de couleur
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
LedInterface = function(chip, container){
|
||||||
|
/* [0] Vérification des paramètres
|
||||||
|
=========================================================*/
|
||||||
|
if( !(chip instanceof Chip) || !(container instanceof Element) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* [1] On enregistre les valeurs
|
||||||
|
=========================================================*/
|
||||||
|
this.chip = chip;
|
||||||
|
this.container = container;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
LedInterface.prototype = {
|
||||||
|
chip: this.chip, // Puce associée à la LED
|
||||||
|
container: this.container // Conteneur de couleur
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* APPLIQUE LA COULEUR EN FONCTION DES VALEURS DE LA 'CHIP'
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
LedInterface.prototype.apply = function(){
|
||||||
|
this.container.style.background = 'rgb('+this.chip.pin[0]+','+this.chip.pin[1]+','+this.chip.pin[2]+')';
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var RelayInterface;
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
|
||||||
|
/* CONSTRUCTEUR D'INTERFACE DU RELAI
|
||||||
|
*
|
||||||
|
* @chip<Chip> Puce associée au relai
|
||||||
|
* @container<Element> Conteneur du relai
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
RelayInterface = function(chip, container){
|
||||||
|
/* [0] Vérification des paramètres
|
||||||
|
=========================================================*/
|
||||||
|
if( !(chip instanceof Chip) || !(container instanceof Element) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* [1] On enregistre les valeurs
|
||||||
|
=========================================================*/
|
||||||
|
this.chip = chip;
|
||||||
|
this.container = container;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
RelayInterface.prototype = {
|
||||||
|
chip: this.chip, // Puce associée au relai
|
||||||
|
container: this.container // Conteneur du relai
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* APPLIQUE L'ACTIVATION EN FONCTION DES VALEURS DE LA 'CHIP'
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
RelayInterface.prototype.apply = function(){
|
||||||
|
if( this.chip.pin[0] )
|
||||||
|
this.container.addClass('active');
|
||||||
|
else
|
||||||
|
this.container.remClass('active');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var previous;
|
||||||
|
var action;
|
||||||
|
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/* RETOURNE SI UN ETAT EST CORRECT
|
||||||
|
*
|
||||||
|
* @previous<String> Condition d'état
|
||||||
|
* @state<Array> Liste des états du système
|
||||||
|
*
|
||||||
|
* @return state<Boolean> Retourne si OUI ou NON l'état répond à la condition
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
previous = function(previous, state){
|
||||||
|
previous = previous.toLowerCase();
|
||||||
|
|
||||||
|
for( var i = 0 ; i < previous.length ; i++ )
|
||||||
|
if( previous[i] == 'x' ) continue;
|
||||||
|
else if( previous[i] != state[i] ) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* MODIFIE LES ETATS EN FONCTION D'UNE ACTION
|
||||||
|
*
|
||||||
|
* @action<String> Action sur les états
|
||||||
|
* @state<Array> Liste des états du système
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
action = function(action, state){
|
||||||
|
action = action.toLowerCase();
|
||||||
|
|
||||||
|
for( var i = 0 ; i < action.length ; i++ )
|
||||||
|
if( action[i] == 'x' ) continue;
|
||||||
|
else if( !isNaN(action[i]) ) state[i] = parseInt(action[i]);
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
|
@ -62,6 +62,7 @@
|
||||||
echo "<section data-sublink='view' class='list'>";
|
echo "<section data-sublink='view' class='list'>";
|
||||||
|
|
||||||
$clusterView = new View('group.view', []);
|
$clusterView = new View('group.view', []);
|
||||||
|
echo "<input type='text' class='searchbar' placeholder='Recherche'>";
|
||||||
$clusterView->view();
|
$clusterView->view();
|
||||||
|
|
||||||
echo '</section>';
|
echo '</section>';
|
||||||
|
|
|
@ -6,13 +6,13 @@ if(null!=section.view.element){1<pageManager.vars.length&&!isNaN(pageManager.var
|
||||||
function(a){pageManager.vars[1]=a.target.getData("cluster");autofill_edit(pageManager.vars[1]);navSubMenu("edit")},!1);for(i=0;i<section.view.link.remove.length;i++)section.view.link.remove[i].addEventListener("click",function(a){pageManager.vars[1]=a.target.getData("cluster");autofill_remove(pageManager.vars[1]);navSubMenu("remove")},!1);for(i=0;i<section.view.group.rem.length;i++)section.view.group.rem[i].addEventListener("click",function(a){var c=a.target.parentNode.parentNode.parentNode.children[0].value,
|
function(a){pageManager.vars[1]=a.target.getData("cluster");autofill_edit(pageManager.vars[1]);navSubMenu("edit")},!1);for(i=0;i<section.view.link.remove.length;i++)section.view.link.remove[i].addEventListener("click",function(a){pageManager.vars[1]=a.target.getData("cluster");autofill_remove(pageManager.vars[1]);navSubMenu("remove")},!1);for(i=0;i<section.view.group.rem.length;i++)section.view.group.rem[i].addEventListener("click",function(a){var c=a.target.parentNode.parentNode.parentNode.children[0].value,
|
||||||
d={};d.path=0==c?"userDefault/unlink":"machineDefault/unlink";d.id_cluster=a.target.getData("cluster");0==c?d.id_user=a.target.getData("member"):d.id_machine=a.target.getData("member");api.send(d,function(c){if(0!=c.ModuleError)return!1;a.target.parentNode.parentNode.removeChild(a.target.parentNode)})},!1);for(i=0;i<section.view.group.add.length;i++)section.view.group.add[i].addEventListener("click",function(a){pageManager.vars[1]=a.target.getData("cluster");navSubMenu("filter");document.location=
|
d={};d.path=0==c?"userDefault/unlink":"machineDefault/unlink";d.id_cluster=a.target.getData("cluster");0==c?d.id_user=a.target.getData("member"):d.id_machine=a.target.getData("member");api.send(d,function(c){if(0!=c.ModuleError)return!1;a.target.parentNode.parentNode.removeChild(a.target.parentNode)})},!1);for(i=0;i<section.view.group.add.length;i++)section.view.group.add[i].addEventListener("click",function(a){pageManager.vars[1]=a.target.getData("cluster");navSubMenu("filter");document.location=
|
||||||
""},!1)}
|
""},!1)}
|
||||||
null!=section.create.element&&(section.create.input={name:document.querySelector(section.create.text+"#create_name"),"class":document.querySelector(section.create.text+"#create_class"),submit:document.querySelector(section.create.text+"#create_submit")},section.create.input.submit.addEventListener("click",function(a){a.preventDefault();api.send({path:"clusterDefault/create",name:section.create.input.name.value,"class":section.create.input["class"].value},function(a){0==a.ModuleError&&(console.log("Groupe cree!"),pageManager.vars[1]=
|
null!=section.create.element&&(section.create.input={name:document.querySelector(section.create.text+"#create_name"),"class":document.querySelector(section.create.text+"#create_class"),submit:document.querySelector(section.create.text+"#create_submit")},section.create.input.submit.addEventListener("click",function(a){a.preventDefault();api.send({path:"clusterDefault/create",name:section.create.input.name.value,"class":section.create.input["class"].value},function(a){0==a.ModuleError&&(console.log("Groupe cree!"),section.create.input.submit.anim("active",
|
||||||
a.id_cluster,navSubMenu("view"),document.location="",section.create.input.submit.anim("active",1500))})},!1));
|
1500))})},!1));
|
||||||
if(null!=section.remove.element){var autofill_remove=function(){var a="",c="",d=!0;null==found_remove[searchindex_remove]?searchindex_remove=section.remove.input.search.num.innerHTML=0:(a=found_remove[searchindex_remove].id_cluster,c=found_remove[searchindex_remove].name,d=!1,section.remove.input.search.num.innerHTML=searchindex_remove+1);section.remove.input.search.id.value=a;section.remove.input.name.value=c;section.remove.input.submit.disabled=d};section.remove.input={search:{view:document.querySelector(section.remove.text+
|
if(null!=section.remove.element){var autofill_remove=function(){var a="",c="",d=!0;null==found_remove[searchindex_remove]?searchindex_remove=section.remove.input.search.num.innerHTML=0:(a=found_remove[searchindex_remove].id_cluster,c=found_remove[searchindex_remove].name,d=!1,section.remove.input.search.num.innerHTML=searchindex_remove+1);section.remove.input.search.id.value=a;section.remove.input.name.value=c;section.remove.input.submit.disabled=d};section.remove.input={search:{view:document.querySelector(section.remove.text+".remove_search_view"),
|
||||||
".remove_search_view"),num:document.querySelector(section.remove.text+".remove_search_num"),sum:document.querySelector(section.remove.text+".remove_search_sum"),keyword:document.querySelector(section.remove.text+"#remove_search_keyword"),id:document.querySelector(section.remove.text+"#remove_search_id"),submit:document.querySelector(section.remove.text+"#remove_search_submit")},name:document.querySelector(section.remove.text+"#remove_name"),submit:document.querySelector(section.remove.text+"#remove_submit")};
|
num:document.querySelector(section.remove.text+".remove_search_num"),sum:document.querySelector(section.remove.text+".remove_search_sum"),keyword:document.querySelector(section.remove.text+"#remove_search_keyword"),id:document.querySelector(section.remove.text+"#remove_search_id"),submit:document.querySelector(section.remove.text+"#remove_search_submit")},name:document.querySelector(section.remove.text+"#remove_name"),submit:document.querySelector(section.remove.text+"#remove_submit")};var lastkeywords_remove=
|
||||||
var lastkeywords_remove="",found_remove=[],searchindex_remove=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&api.send({path:"clusterDefault/getById",id_cluster:pageManager.vars[1]},function(a){0==a.ModuleError&&(found_remove=[a.cluster],searchindex_remove=0,autofill_remove())});section.remove.input.search.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.remove.input.search.keyword.value)if(section.remove.input.search.keyword.value==lastkeywords_remove)searchindex_remove=
|
"",found_remove=[],searchindex_remove=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&api.send({path:"clusterDefault/getById",id_cluster:pageManager.vars[1]},function(a){0==a.ModuleError&&(found_remove=[a.cluster],searchindex_remove=0,autofill_remove())});section.remove.input.search.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.remove.input.search.keyword.value)if(section.remove.input.search.keyword.value==lastkeywords_remove)searchindex_remove=(searchindex_remove+
|
||||||
(searchindex_remove+1)%found_remove.length,autofill_remove();else{var c={path:"clusterDefault/search",keywords:section.remove.input.search.keyword.value};api.send(c,function(a){0==a.ModuleError&&(section.remove.input.search.submit.anim("active",1E3),searchindex_remove=0,found_remove=a.clusters,section.remove.input.search.sum.innerHTML=found_remove.length,autofill_remove());lastkeywords_remove=c.keywords})}},!1);section.remove.input.submit.addEventListener("click",function(a){a.preventDefault();""!=
|
1)%found_remove.length,autofill_remove();else{var c={path:"clusterDefault/search",keywords:section.remove.input.search.keyword.value};api.send(c,function(a){0==a.ModuleError&&(section.remove.input.search.submit.anim("active",1E3),searchindex_remove=0,found_remove=a.clusters,section.remove.input.search.sum.innerHTML=found_remove.length,autofill_remove());lastkeywords_remove=c.keywords})}},!1);section.remove.input.submit.addEventListener("click",function(a){a.preventDefault();""!=section.remove.input.search.id.value&&
|
||||||
section.remove.input.search.id.value&&api.send({path:"clusterDefault/delete",id_cluster:section.remove.input.search.id.value},function(a){0==a.ModuleError&&1==a.status?(console.log("Groupe supprimee!"),section.remove.input.submit.anim("active",1500),autofill_remove(null)):console.error("ModuleError::"+a.ModuleError)})},!1)}
|
api.send({path:"clusterDefault/delete",id_cluster:section.remove.input.search.id.value},function(a){0==a.ModuleError&&1==a.status?(console.log("Groupe supprimee!"),section.remove.input.submit.anim("active",1500),autofill_remove(null)):console.error("ModuleError::"+a.ModuleError)})},!1)}
|
||||||
if(null!=section.edit.element){var autofill_edit=function(){var a="",c="",d=!0;null==found_edit[searchindex_edit]?searchindex_edit=section.edit.input.search.num.innerHTML=0:(a=found_edit[searchindex_edit].id_cluster,c=found_edit[searchindex_edit].name,d=!1,section.edit.input.search.num.innerHTML=searchindex_edit+1);section.edit.input.search.id.value=a;section.edit.input.name.value=c;section.edit.input.submit.disabled=d};section.edit.input={search:{view:document.querySelector(section.edit.text+".edit_search_view"),
|
if(null!=section.edit.element){var autofill_edit=function(){var a="",c="",d=!0;null==found_edit[searchindex_edit]?searchindex_edit=section.edit.input.search.num.innerHTML=0:(a=found_edit[searchindex_edit].id_cluster,c=found_edit[searchindex_edit].name,d=!1,section.edit.input.search.num.innerHTML=searchindex_edit+1);section.edit.input.search.id.value=a;section.edit.input.name.value=c;section.edit.input.submit.disabled=d};section.edit.input={search:{view:document.querySelector(section.edit.text+".edit_search_view"),
|
||||||
num:document.querySelector(section.edit.text+".edit_search_num"),sum:document.querySelector(section.edit.text+".edit_search_sum"),keyword:document.querySelector(section.edit.text+"#edit_search_keyword"),id:document.querySelector(section.edit.text+"#edit_search_id"),submit:document.querySelector(section.edit.text+"#edit_search_submit")},name:document.querySelector(section.edit.text+"#edit_name"),submit:document.querySelector(section.edit.text+"#edit_submit")};var lastkeywords_edit="",found_edit=[],
|
num:document.querySelector(section.edit.text+".edit_search_num"),sum:document.querySelector(section.edit.text+".edit_search_sum"),keyword:document.querySelector(section.edit.text+"#edit_search_keyword"),id:document.querySelector(section.edit.text+"#edit_search_id"),submit:document.querySelector(section.edit.text+"#edit_search_submit")},name:document.querySelector(section.edit.text+"#edit_name"),submit:document.querySelector(section.edit.text+"#edit_submit")};var lastkeywords_edit="",found_edit=[],
|
||||||
searchindex_edit=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&api.send({path:"clusterDefault/getById",id_cluster:pageManager.vars[1]},function(a){0==a.ModuleError&&(found_edit=[a.cluster],searchindex_edit=0,autofill_edit())});section.edit.input.search.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.edit.input.search.keyword.value)if(section.edit.input.search.keyword.value==lastkeywords_edit)searchindex_edit=(searchindex_edit+1)%found_edit.length,autofill_edit();
|
searchindex_edit=0;2<=pageManager.vars.length&&!isNaN(pageManager.vars[1])&&api.send({path:"clusterDefault/getById",id_cluster:pageManager.vars[1]},function(a){0==a.ModuleError&&(found_edit=[a.cluster],searchindex_edit=0,autofill_edit())});section.edit.input.search.submit.addEventListener("click",function(a){a.preventDefault();if(""!=section.edit.input.search.keyword.value)if(section.edit.input.search.keyword.value==lastkeywords_edit)searchindex_edit=(searchindex_edit+1)%found_edit.length,autofill_edit();
|
||||||
|
|
|
@ -207,10 +207,10 @@ if( section.create.element != null ){
|
||||||
if( answer.ModuleError == 0 ){ // Tout s'est bien deroule
|
if( answer.ModuleError == 0 ){ // Tout s'est bien deroule
|
||||||
console.log('Groupe cree!');
|
console.log('Groupe cree!');
|
||||||
|
|
||||||
// On redirige sur la cluster
|
// On redirige sur le cluster
|
||||||
pageManager.vars[1] = answer.id_cluster;
|
// pageManager.vars[1] = answer.id_cluster;
|
||||||
navSubMenu('view');
|
// navSubMenu('view');
|
||||||
document.location = '';
|
// document.location = '';
|
||||||
|
|
||||||
section.create.input.submit.anim('active', 1500);
|
section.create.input.submit.anim('active', 1500);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue