etat de l'imprimante actualis + liste des codes dispos pour l'adherent

darcs-hash:20061110133521-f46e9-24bce8f22f9b7a14cba214e664084b3103e848d9.gz
This commit is contained in:
gdetrez 2006-11-10 14:35:21 +01:00
parent 20f3593951
commit e8391dfd40
3 changed files with 459 additions and 356 deletions

View file

@ -44,20 +44,63 @@ class root:
'scripts':['impression.js', 'popup.js'], 'scripts':['impression.js', 'popup.js'],
} }
index.exposed = True index.exposed = True
##########################
# devis
##########################
#
# methode qui affiche la template du devis
#
def devis(self):
return {
'template':'impression-devis',
'values':
{
'devis':cherrypy.session['impression'].devisDetaille(),
'total':cherrypy.session['impression'].prix(),
'nomFichier':cherrypy.session['impression'].fileName(),
},
'standalone':True,
}
devis.exposed=True
##########################
# AJAX
##########################
#
# methode qui renvoie la liste des codes de l'adherent
#
def codeList(self):
try:
listeBrute = crans.impression.digicode.list_code()
# liste de la forme :
# [(code, age, description),...]
listeBrute = [item[0] for item in listeBrute if item[2] == cherrypy.session['uid']]
return {'codes': listeBrute}
except Exception, e:
cherrypy.log('erreur lors de la creation de la liste de codes :' + str(e), 'IMPRESSION', 1)
return {'erreur':str(e)}
codeList.exposed= True
#
# methode qui indique quel fichier utiliser
#
def useFile(self, fileName): def useFile(self, fileName):
try: try:
filepath = os.path.join(os.path.join(FILE_UPLOAD_BASE_FOLDER, cherrypy.session['uid']+"/"), fileName) filepath = os.path.join(os.path.join(FILE_UPLOAD_BASE_FOLDER, cherrypy.session['uid']+"/"), fileName)
cherrypy.session['impression'] = crans.impression.impression(filepath, cherrypy.session['uid']) cherrypy.session['impression'] = crans.impression.impression(filepath, cherrypy.session['uid'])
return {'nbPages': cherrypy.session['impression'].pages()} return {'nbPages': cherrypy.session['impression'].pages()}
except Exception, e: except Exception, e:
cherrypy.log("useFile: %s" % str(e), 'IMPRESSION', 1) cherrypy.log("useFile (erreur): %s" % str(e), 'IMPRESSION', 1)
return {'erreur':str(e) } return {'erreur':str(e) }
useFile.exposed= True useFile.exposed= True
#
# methode pour changer les parametres
#
def changeSettings(self, copies=None, couleurs=None, recto_verso=None, agrafes=None, papier=None): def changeSettings(self, copies=None, couleurs=None, recto_verso=None, agrafes=None, papier=None):
try: try:
nouvPrix = cherrypy.session['impression'].changeSettings(papier=papier, couleurs=couleurs, agraphes=agrafes, recto_verso=recto_verso, copies=int(copies)) nouvPrix = cherrypy.session['impression'].changeSettings(papier=papier, couleurs=couleurs, agraphes=agrafes, recto_verso=recto_verso, copies=int(copies))
@ -68,6 +111,9 @@ class root:
changeSettings.exposed = True changeSettings.exposed = True
#
# methode pour lancer l'impression
#
def lancerImpression(self): def lancerImpression(self):
try: try:
cherrypy.session['impression'].imprime() cherrypy.session['impression'].imprime()
@ -76,16 +122,39 @@ class root:
except Exception, e: except Exception, e:
cherrypy.log("lancerImpression (erreur): %s" % str(e), 'IMPRESSION', 1) cherrypy.log("lancerImpression (erreur): %s" % str(e), 'IMPRESSION', 1)
return {"erreur":str(e)} return {"erreur":str(e)}
cherrypy.log("impression demandee " , 'IMPRESSION') return {'code':str(crans.impression.digicode.gen_code(cherrypy.session['uid'])) + "#"}
return {'code':str(crans.impression.digicode.gen_code("Impression intranet : " + cherrypy.session['uid'])) + "#"}
lancerImpression.exposed = True lancerImpression.exposed = True
#
# methode pour récupérer l'état de l'imprimante
#
def etatImprimante(self):
try:
try:
return {"printer_state" : "<br />".join(crans.impression.etat_imprimante.etat())
except Exception, e:
return {"printer_state" : 'Imprimante hors ligne'}
etatImprimante.exposed = True
##########################
# privees
##########################
#
# methode pour obtenir la liste des fichiers uploadés
#
def getUploadedFileListFor(self, adh): def getUploadedFileListFor(self, adh):
file_folder = os.path.join(FILE_UPLOAD_BASE_FOLDER, cherrypy.session['uid']+"/") file_folder = os.path.join(FILE_UPLOAD_BASE_FOLDER, cherrypy.session['uid']+"/")
if not os.path.isdir(file_folder): if not os.path.isdir(file_folder):
return [] return []
return os.listdir(file_folder) return os.listdir(file_folder)
#
# methode pour enregistrer un fichier
#
def savePDF(self, aFile): def savePDF(self, aFile):
_, tempFileName = tempfile.mkstemp() _, tempFileName = tempfile.mkstemp()
@ -110,22 +179,6 @@ class root:
return newFilePath return newFilePath
##########################
# devis
##########################
#
# methode qui affiche la template du devis
#
def devis(self):
return {
'template':'impression-devis',
'values':
{
'devis':cherrypy.session['impression'].devisDetaille(),
'total':cherrypy.session['impression'].prix(),
'nomFichier':cherrypy.session['impression'].fileName(),
},
'standalone':True,
}
devis.exposed=True

View file

@ -1,332 +1,381 @@
/* ************************************************************ /* ************************************************************
* Impression * Impression
************************************************************ ************************************************************
* Impression.settings : panneau de configuration * Impression.settings : panneau de configuration
* Impression.popup : popup * Impression.popup : popup
* Impression.AJAX : ajax * Impression.AJAX : ajax
*/ */
Impression = {}; Impression = {};
/***************************** /*****************************
Impression.settings Impression.settings
*****************************/ *****************************/
Impression.settings = {}; Impression.settings = {};
// //
//// images : images used for previewing //// images : images used for previewing
// //
Impression.settings.images = [ Impression.settings.images = [
"portrait_couleurs_agraphediagonale.png", "portrait_couleurs_agraphediagonale.png",
"portrait_couleurs_pasdagraphes.png", "portrait_couleurs_pasdagraphes.png",
"portrait_couleurs_uneagraphe.png", "portrait_couleurs_uneagraphe.png",
"portrait_couleurs_Deuxagraphes.png", "portrait_couleurs_Deuxagraphes.png",
"portrait_couleurs_troisAgraphes.png", "portrait_couleurs_troisAgraphes.png",
"portrait_couleurs_stitching.png", "portrait_couleurs_stitching.png",
"portrait_nb_agraphediagonale.png", "portrait_nb_agraphediagonale.png",
"portrait_nb_pasdagraphes.png", "portrait_nb_pasdagraphes.png",
"portrait_nb_uneagraphe.png", "portrait_nb_uneagraphe.png",
"portrait_nb_Deuxagraphes.png", "portrait_nb_Deuxagraphes.png",
"portrait_nb_troisAgraphes.png", "portrait_nb_troisAgraphes.png",
"portrait_nb_stitching.png", "portrait_nb_stitching.png",
"portrait_transparent_couleurs.png", "portrait_transparent_couleurs.png",
"portrait_transparent_nb.png", "portrait_transparent_nb.png",
]; ];
Impression.settings.preloadImage = function(imageName) { Impression.settings.preloadImage = function(imageName) {
var image = new Image(); var image = new Image();
image.src = "/static/images/"+imageName; image.src = "/static/images/"+imageName;
} }
Impression.settings.preloadAllImages = function() { Impression.settings.preloadAllImages = function() {
log("Preloading images..."); log("Preloading images...");
map(this.preloadImage,this.images); map(this.preloadImage,this.images);
} }
// //
//// init : parse every field and display preview //// init : parse every field and display preview
// //
Impression.settings.init = function () { Impression.settings.init = function () {
log("Init settings..."); log("Init settings...");
this.theform = document.form_impression; this.theform = document.form_impression;
this.disableForm(false); this.disableForm(false);
} }
// //
//// reset : reset form and then re-init settings //// reset : reset form and then re-init settings
// //
Impression.settings.reset = function () { Impression.settings.reset = function () {
log("Reset form"); log("Reset form");
this.theform.reset(); this.theform.reset();
this.init(); this.init();
} }
Impression.settings.disableForm = function(bool) Impression.settings.disableForm = function(bool)
{ {
log("Set Disable Form : " + bool); log("Set Disable Form : " + bool);
var fields = this.theform.elements; for( var i=0; i< fields.length; i++) var fields = this.theform.elements;
{ for( var i=0; i< fields.length; i++)
this.setDisableField( fields[i], bool ); {
} this.setDisableField( fields[i], bool );
} }
}
//
//// getValue : parse a field and store value in fielld.name //
// //// getValue : parse a field and store value in fielld.name
Impression.settings.getValue = function(field) //
{ Impression.settings.getValue = function(field)
if (field.value) {
{ if (field.value)
this[field.name] = field.value; {
log( field.name + " is now " + this[field.name]); this[field.name] = field.value;
} log( field.name + " is now " + this[field.name]);
else }
{ else
logError("Can't get fieldValue"); {
} logError("Can't get fieldValue");
} }
// }
//// getCopies : parse copies field //
// //// getCopies : parse copies field
Impression.settings.getCopies = function(field) { //
if ( (!field.value) || (parseInt(field.value)!=field.value-0) || (parseInt(field.value) < 1) ) Impression.settings.getCopies = function(field) {
{ if ( (!field.value) || (parseInt(field.value)!=field.value-0) || (parseInt(field.value) < 1) )
this.copies = 1; {
logError("Can't get copies"); this.copies = 1;
} logError("Can't get copies");
else }
{ else
this.copies = parseInt(field.value); {
} this.copies = parseInt(field.value);
log("copies is now " + this.copies); }
} log("copies is now " + this.copies);
}
//
//// setValue : set field value //
// //// setValue : set field value
Impression.settings.setValue = function(afield, avalue) { //
afield.value = avalue; Impression.settings.setValue = function(afield, avalue) {
this.getValue(afield) afield.value = avalue;
} this.getValue(afield);
}
//
//// setDisableField : set field disabled on/off //
// //// setDisableField : set field disabled on/off
Impression.settings.setDisableField = function( afield, isdisabled ) { //
afield.disabled = isdisabled ; Impression.settings.setDisableField = function( afield, isdisabled ) {
} afield.disabled = isdisabled ;
}
//
//// disableField : set field disabled on //
// //// disableField : set field disabled on
Impression.settings.disableField = function(afield) { //
this.setDisableField(afield, true); Impression.settings.disableField = function(afield) {
} this.setDisableField(afield, true);
}
//
//// fieldChanges : when a field is changed //
// //// fieldChanges : when a field is changed
Impression.settings.update = function (field) { //
var orientation = "portrait"; Impression.settings.update = function (field) {
if (this.theform.type_impression_couleur.checked) var orientation = "portrait";
this.getValue(this.theform.type_impression_couleur); if (this.theform.type_impression_couleur.checked)
else this.getValue(this.theform.type_impression_couleur);
this.getValue(this.theform.type_impression_nb); else
this.getValue(this.theform.type_impression_nb);
if (this.theform.disposition_recto.checked)
this.getValue(this.theform.disposition_recto); if (this.theform.disposition_recto.checked)
else this.getValue(this.theform.disposition_recto);
this.getValue(this.theform.disposition_recto_verso); else
this.getValue(this.theform.papier); this.getValue(this.theform.disposition_recto_verso);
this.getCopies(this.theform.nb_copies); this.getValue(this.theform.papier);
this.getValue(this.theform.agrafes); this.getCopies(this.theform.nb_copies);
// Contraintes this.getValue(this.theform.agrafes);
if ( // Contraintes
( this.papier != "A4" ) || if (
( (this.disposition == "recto") && (this.nb_pages>50) ) || ( this.papier != "A4" ) ||
( (this.disposition == "rectoverso") && (this.nb_pages>100) ) ) { ( (this.disposition == "recto") && (this.nb_pages>50) ) ||
this.setValue(this.theform.agrafes, "pasdagraphes"); ( (this.disposition == "rectoverso") && (this.nb_pages>100) ) )
this.disableField(this.theform.agrafes); {
this.getValue(this.theform.agrafes); this.setValue(this.theform.agrafes, "pasdagraphes");
} else { this.disableField(this.theform.agrafes);
this.setDisableField(this.theform.agrafes, false); this.getValue(this.theform.agrafes);
} } else {
if (this.papier == "A4tr") this.setDisableField(this.theform.agrafes, false);
{ }
this.theform.disposition_recto.checked = true; if (this.papier == "A4tr")
this.disableField(this.theform.disposition_recto); {
this.disableField(this.theform.disposition_recto_verso); this.theform.disposition_recto.checked = true;
this.getValue(this.theform.disposition_recto); this.disableField(this.theform.disposition_recto);
} this.disableField(this.theform.disposition_recto_verso);
else this.getValue(this.theform.disposition_recto);
{ }
this.setDisableField(this.theform.disposition_recto, false); else
this.setDisableField(this.theform.disposition_recto_verso, false); {
} this.setDisableField(this.theform.disposition_recto, false);
this.setDisableField(this.theform.disposition_recto_verso, false);
this.updatePreview(); }
Impression.AJAX.recalcPrix();
this.updatePreview();
} Impression.AJAX.recalcPrix();
// }
//// updatePreview : update preview with new value
// //
Impression.settings.updatePreview = function() //// updatePreview : update preview with new value
{ //
var image_name = ""; Impression.settings.updatePreview = function()
if (this.papier == "A4tr") {
image_name = "portrait_transparent_" + this.type_impression + ".png"; var image_name = "";
else if (this.papier == "A4tr")
image_name = "portrait_" + this.type_impression + '_' + this.agrafes + ".png"; image_name = "portrait_transparent_" + this.type_impression + ".png";
var image = createDOM("IMG",{'src':'/static/images/'+image_name}); else
log("Updating preview (new image : " + image_name + ")"); image_name = "portrait_" + this.type_impression + '_' + this.agrafes + ".png";
replaceChildNodes("preview",image) var image = createDOM("IMG",{'src':'/static/images/'+image_name});
} log("Updating preview (new image : " + image_name + ")");
replaceChildNodes("preview",image)
}
/*****************************
Impression.popup
*****************************/ /*****************************
Impression.popup = {}; Impression.popup
*****************************/
Impression.popup.popupImpression = function(code) { Impression.popup = {};
Popup.hide();
Popup.create({}, "Impression en cours...", Impression.popup.popupImpression = function(code) {
DIV( Popup.hide();
{"id":"printingPopupContent", "style":"background-image:url(/static/images/dialog-printer.png)"}, Popup.create({}, "Impression en cours...",
SPAN("code: "+code), DIV(
A({"href":"https://wiki.crans.org/VieCrans/ImpressionReseau", "class":"aide", "target":"_blank"}, "Comment récupérer mon impression ? "))); {"id":"printingPopupContent", "style":"background-image:url(/static/images/dialog-printer.png)"},
Popup.display(); SPAN("code: "+code),
} A({"href":"https://wiki.crans.org/VieCrans/ImpressionReseau", "class":"aide", "target":"_blank"}, "Comment récupérer mon impression ? ")));
Popup.display();
Impression.popup.popupError = function(erreur) { }
Popup.hide();
Popup.create({}, "Erreur", Impression.popup.popupError = function(erreur) {
DIV({"id":"printingPopupContent", "style":"background-image:url(/static/images/dialog-warning.png)"}, Popup.hide();
SPAN(erreur), Popup.create({}, "Erreur",
A({"href":"#", "class":"aide", "target":"_blank"}, "Envoyer un rapport aux nounous"), DIV({"id":"printingPopupContent", "style":"background-image:url(/static/images/dialog-warning.png)"},
Popup.closeLink({"class":"aide", "style":"text-align:right;"}, "Fermer"))); SPAN(erreur),
Popup.display(); A({"href":"#", "class":"aide", "target":"_blank"}, "Envoyer un rapport aux nounous"),
} Popup.closeLink({"class":"aide", "style":"text-align:right;"}, "Fermer")));
Popup.display();
Impression.popup.popupSolde = function(code) { }
Popup.hide();
Popup.create({}, "Solde insuffisant", Impression.popup.popupSolde = function(code) {
DIV( Popup.hide();
{"id":"printingPopupContent", "style":"background-image:url(/static/images/dialog-solde.png)"}, Popup.create({}, "Solde insuffisant",
SPAN("pas assez de sous"), DIV(
A({"href":"https://wiki.crans.org/CransPratique/SoldeImpression", "class":"aide", "target":"_blank"}, "Comment recharger mon compte ? "), {"id":"printingPopupContent", "style":"background-image:url(/static/images/dialog-solde.png)"},
Popup.closeLink({"class":"aide", "style":"text-align:right;"}, "Fermer"))); SPAN("pas assez de sous"),
Popup.display(); A({"href":"https://wiki.crans.org/CransPratique/SoldeImpression", "class":"aide", "target":"_blank"}, "Comment recharger mon compte ? "),
} Popup.closeLink({"class":"aide", "style":"text-align:right;"}, "Fermer")));
Popup.display();
}
/***************************** Impression.popup.popupCodes = function(codeList) {
Impression.AJAX Popup.hide();
*****************************/ Popup.create({}, "Codes de mes impressions",
DIV(
Impression.AJAX = {}; {"id":"printingPopupContent", "style":"background-image:url(/static/images/dialog-printer.png)"},
SPAN("Mes codes"),
//UL({"size":"4", "style":"width:6em;; height:4em;padding:0;margin:0;list-style-type:none;overflow:auto;"}, map(function (code) {return LI({}, code);}, codeList)),
Impression.AJAX.modifPrix = function( text, wheel ) SELECT({"size":"4", "style":"width:100%;"}, map(function (code) {return LI({}, code);}, codeList)),
{ Popup.closeLink({"class":"aide", "style":"text-align:right;"}, "Fermer")));
if (wheel) Popup.display();
{ }
var image = createDOM("IMG",{'src':'/static/images/indicator.gif'});
}
else
{ /*****************************
var image = new DIV({}); Impression.mesCodes
} *****************************/
var item = new DIV({'onclick':'Impression.AJAX.recalcPrix();'}, image, text); Impression.mesCodes = {};
replaceChildNodes("prix_placeholder",item); Impression.mesCodes.getCodes = function ()
} {
Impression.AJAX.call('codeList', this.displayCodes );
Impression.AJAX.modifNbPages = function( nbpages ) }
{
Impression.settings.nb_pages = nbpages; Impression.mesCodes.displayCodes = function (result) {
replaceChildNodes("fileNbPages",nbpages); if (result.codes)
} Impression.popup.popupCodes(result.codes);
else if (result.erreur)
Impression.AJAX.call = function(page, callBack) { logError('erreur distante (codeLlist) : ' + result.erreur);
logDebug("calling AJAX : " + page) else
var e = loadJSONDoc(page); logError('erreur bizarre (codeLlist) : ');
e.addCallback(callBack); }
e.addErrback(this.errorHandler);
} /*****************************
Impression.AJAX
Impression.AJAX.errorHandler = function(d) { *****************************/
//Impression.AJAX..modifPrix("Erreur", false); Impression.AJAX = {};
logError("AJAX Error: " + d);
Impression.AJAX.modifPrix("Erreur...", false);
} Impression.AJAX.modifPrix = function( text, wheel )
{
if (wheel)
Impression.AJAX.usefile = function(filename) { {
var item = new DIV({}, "Calculs en cours..."); var image = createDOM("IMG",{'src':'/static/images/indicator.gif'});
this.modifPrix("Analyse du fichier...", true); }
this.call('useFile?fileName=' + filename,this.analysefini ); else
} {
var image = new DIV({});
Impression.AJAX.analysefini = function(AJAXResp) }
{ var item = new DIV({'onclick':'Impression.AJAX.recalcPrix();'}, image, text);
logDebug('AJAX terminated (usefile)'); replaceChildNodes("prix_placeholder",item);
if (AJAXResp.erreur) { }
Impression.AJAX.modifPrix(AJAXResp.erreur, false);
Impression.popup.popupError(AJAXResp.erreur); Impression.AJAX.modifNbPages = function( nbpages )
Impression.settings.disableForm(true); {
logWarning('Erreur distante : ' + AJAXResp.erreur); Impression.settings.nb_pages = nbpages;
} else { replaceChildNodes("fileNbPages",nbpages);
Impression.AJAX.modifPrix("Analyse terminée", true); }
Impression.settings.update();
Impression.AJAX.modifNbPages(AJAXResp.nbPages); Impression.AJAX.call = function(page, callBack) {
} logDebug("calling AJAX : " + page);
} var e = loadJSONDoc(page);
e.addCallback(callBack);
Impression.AJAX.recalcPrix = function() e.addErrback(this.errorHandler);
{ }
settings = Impression.settings;
var url = "changeSettings?copies=" + settings.copies Impression.AJAX.errorHandler = function(d) {
+"&couleurs="+ settings.type_impression //Impression.AJAX..modifPrix("Erreur", false);
+"&papier="+ settings.papier logError("AJAX Error: " + d);
+"&recto_verso="+ settings.disposition Impression.AJAX.modifPrix("Erreur...", false);
+"&agrafes="+ settings.agrafes; }
this.modifPrix("Calcul en cours", true);
this.call(url, this.changePrix);
} Impression.AJAX.usefile = function(filename) {
var item = new DIV({}, "Calculs en cours...");
Impression.AJAX.changePrix = function(AJAXResp) this.modifPrix("Analyse du fichier...", true);
{ this.call('useFile?fileName=' + filename,this.analysefini );
logDebug('AJAX terminated (recalcPrix)'); }
if (AJAXResp.erreur) {
Impression.AJAX.modifPrix(AJAXResp.erreur, false); Impression.AJAX.analysefini = function(AJAXResp)
Impression.popup.popupError(AJAXResp.erreur); {
Impression.settings.disableForm(true); logDebug('AJAX terminated (usefile)');
logWarning('Erreur distante : ' + AJAXResp.erreur); if (AJAXResp.erreur) {
} else { Impression.AJAX.modifPrix(AJAXResp.erreur, false);
Impression.AJAX.modifPrix("Coût : " + AJAXResp.nouvPrix + "€", false); Impression.popup.popupError(AJAXResp.erreur);
} Impression.settings.disableForm(true);
} logWarning('Erreur distante : ' + AJAXResp.erreur);
} else {
Impression.AJAX.lancerImpression = function(AJAXResp) Impression.AJAX.modifPrix("Analyse terminée", true);
{ Impression.settings.update();
var url = "lancerImpression"; Impression.AJAX.modifNbPages(AJAXResp.nbPages);
Impression.settings.disableForm(true); }
this.call(url, this.etatImpression); }
}
Impression.AJAX.recalcPrix = function()
Impression.AJAX.etatImpression = function(AJAXResp) {
{ settings = Impression.settings;
logDebug('AJAX terminated (lancerImpression)'); var url = "changeSettings?copies=" + settings.copies
if (AJAXResp.erreur) { +"&couleurs="+ settings.type_impression
Impression.popup.popupError(AJAXResp.erreur); +"&papier="+ settings.papier
logWarning('Erreur distante : ' + AJAXResp.erreur); +"&recto_verso="+ settings.disposition
} else if (AJAXResp.SoldeInsuffisant) { +"&agrafes="+ settings.agrafes;
Impression.popup.popupSolde(); this.modifPrix("Calcul en cours", true);
Impression.settings.disableForm(false); this.call(url, this.changePrix);
Impression.settings.update(); }
} else {
Impression.popup.popupImpression(AJAXResp.code); Impression.AJAX.changePrix = function(AJAXResp)
} {
} logDebug('AJAX terminated (recalcPrix)');
if (AJAXResp.erreur) {
Impression.AJAX.modifPrix(AJAXResp.erreur, false);
Impression.popup.popupError(AJAXResp.erreur);
Impression.settings.disableForm(true);
logWarning('Erreur distante : ' + AJAXResp.erreur);
} else {
Impression.AJAX.modifPrix("Coût : " + AJAXResp.nouvPrix + "€", false);
}
}
Impression.AJAX.lancerImpression = function(AJAXResp)
{
var url = "lancerImpression";
Impression.settings.disableForm(true);
this.call(url, this.finImpression);
}
Impression.AJAX.finImpression = function(AJAXResp)
{
logDebug('AJAX terminated (lancerImpression)');
if (AJAXResp.erreur) {
Impression.popup.popupError(AJAXResp.erreur);
logWarning('Erreur distante : ' + AJAXResp.erreur);
} else if (AJAXResp.SoldeInsuffisant) {
Impression.popup.popupSolde();
Impression.settings.disableForm(false);
Impression.settings.update();
} else {
Impression.popup.popupImpression(AJAXResp.code);
}
}
Impression.AJAX.getPrinterState = function()
{
var url = "etatImprimante";
Impression.AJAX.call(url, Impression.AJAX.displayPrinterState);
}
Impression.AJAX.displayPrinterState = function(AJAXResp)
{
logDebug('AJAX terminated (getPrinterState)');
if (AJAXResp.erreur) {
logWarning('Erreur distante (etatImprimante) : ' + AJAXResp.erreur);
} else {
replaceChildNodes("etatImprimanteIci", AJAXResp.printer_state)
}
}
setInterval(Impression.AJAX.getPrinterState, 30000);

View file

@ -57,9 +57,10 @@
<li><span style="font-weight:bold;">pages: </span><span id="fileNbPages"></span></li> <li><span style="font-weight:bold;">pages: </span><span id="fileNbPages"></span></li>
#end if #end if
<li id="actionEtatImprimante"><span style="font-weight:bold;">&Eacute;tat <li id="actionEtatImprimante" onclick="Impression.AJAX.getPrinterState();"><span style="font-weight:bold;">&Eacute;tat
imprimante:</span><br /><span> $etatImprimante </span></li> imprimante:</span><br /><span id="etatImprimanteIci"> $etatImprimante </span></li>
<li id="actionNouvelleImpression"><a href="index">Nouvelle impression</a></li> <li id="actionNouvelleImpression"><a href="index">Nouvelle impression</a></li>
<li id="actionMesCodes"><a href="#" onclick="Impression.mesCodes.getCodes(); return false;">Mes codes</a></li>
<!-- <li><a href="historique">Historique</a></li> --> <!-- <li><a href="historique">Historique</a></li> -->
</ul> </ul>