Ajout des modules initiaux

darcs-hash:20070124114812-f46e9-171ef12f1e1b89ae005adf4aab6f6535fb9289e6.gz
This commit is contained in:
gdetrez 2007-01-24 12:48:12 +01:00
parent 8713311bc1
commit ed3ab40ccd
80 changed files with 4852 additions and 5 deletions

View file

@ -0,0 +1,237 @@
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
# #############################################################
# ..
# .... ............ ........
# . ....... . .... ..
# . ... .. .. .. .. ..... . ..
# .. .. ....@@@. .. . ........ .
# .. . .. ..@.@@..@@. .@@@@@@@ @@@@@@. ....
# .@@@@. .@@@@. .@@@@..@@.@@..@@@..@@@..@@@@.... ....
# @@@@... .@@@.. @@ @@ .@..@@..@@...@@@. .@@@@@. ..
# .@@@.. . @@@. @@.@@..@@.@@..@@@ @@ .@@@@@@.. .....
# ...@@@.... @@@ .@@.......... ........ ..... ..
# . ..@@@@.. . .@@@@. .. ....... . .............
# . .. .... .. .. . ... ....
# . . .... ............. .. ...
# .. .. ... ........ ... ...
# ................................
#
# #############################################################
#
# interface d'impression
#
# Copyright (c) 2006 by www.crans.org
# #############################################################
import cherrypy, tempfile, shutil, os
import crans.impression
import crans.impression.digicode
import crans.impression.etat_imprimante
import crans.cp
FILE_UPLOAD_BASE_FOLDER = cherrypy.config.get('fileUpload.folder', "/var/impression/fichiers/")
class FileError(Exception):
pass
from ClassesIntranet.ModuleBase import ModuleBase
class main(ModuleBase):
def category(self):
return "Services"
def title(self):
return "Impression"
def icon(self):
return "icon.png"
##########################
# affichage
##########################
#
# template principale
#
def index(self, submit = None, fileList = None, newFile = None ):
data = {}
# on efface un eventuel objet impression existant
cherrypy.session['impression'] = None
if submit == "Envoyer":
try:
self.savePDF(newFile)
data['fileName'] = newFile.filename
except FileError, e:
data['openError'] = e.args[0]
elif submit == "Choisir":
if (fileList):
data['fileName'] = fileList
else:
data['openError'] = "Choisissez un fichier"
data['fileList'] = self.getUploadedFileListFor(cherrypy.session['uid'])
try:
crans.impression.etat_imprimante.etat()
except Exception, e:
data['Erreur_imprimante'] = str(e).replace("\"", "\\\"")
data['errorMsg'] = u"Imprimante injoignable"
if not cherrypy.config.get('crans.activate', True):
data['Erreur_imprimante'] = "Config impression"
data['errorMsg'] = cherrypy.config.get('crans.activate.errorMsg', u"Imprimante HS")
return {'template':'impression',
'values':data,
'stylesheets':['impression.css'],
'scripts':['impression.js', 'popup.js'],
}
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:
crans.cp.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):
try:
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'])
return {'nbPages': cherrypy.session['impression'].pages()}
except crans.impression.FichierInvalide, e:
crans.cp.log("useFile : %s (%s)" % (str(e), e.file()), 'IMPRESSION', 1)
return {'erreur':str(e) }
except Exception, e:
crans.cp.log("useFile : %s" % str(e), 'IMPRESSION', 1)
return {'erreur':str(e) }
useFile.exposed= True
#
# methode pour changer les parametres
#
def changeSettings(self, copies=None, couleurs=None, recto_verso=None, agrafes=None, papier=None):
try:
nouvPrix = cherrypy.session['impression'].changeSettings(papier=papier, couleurs=couleurs, agraphes=agrafes, recto_verso=recto_verso, copies=int(copies))
except Exception, e:
crans.cp.log("changeSettings : %s" % str(e), 'IMPRESSION', 1)
return {"erreur":str(e)}
return {'nouvPrix':nouvPrix}
changeSettings.exposed = True
#
# methode pour lancer l'impression
#
def lancerImpression(self):
try:
cherrypy.session['impression'].imprime()
except crans.impression.SoldeInsuffisant:
return {"SoldeInsuffisant":1}
except Exception, e:
crans.cp.log("lancerImpression : %s" % str(e), 'IMPRESSION', 1)
return {"erreur":str(e)}
crans.cp.log("impression", 'IMPRESSION')
return {'code':str(crans.impression.digicode.gen_code(cherrypy.session['uid'])) + "#"}
lancerImpression.exposed = True
#
# methode pour recuperer l'etat de l'imprimante
#
def etatImprimante(self):
if not cherrypy.config.get('crans.activate', True):
return {"printer_state" : u"Système down"}
try:
return {"printer_state" : u"\\n".join(crans.impression.etat_imprimante.etat())}
except Exception, e:
return {"printer_state" : 'Imprimante hors ligne'}
etatImprimante.exposed = True
#
# methode pour le solde
#
def AJAXGetSolde(self):
try:
adh = cherrypy.session['LDAP'].search('uid=' + cherrypy.session['uid'])['adherent'][0]
return {"solde" : adh.solde() }
except Exception, e:
return {"erreur" : str(e)}
AJAXGetSolde.exposed = True
##########################
# privees
##########################
#
# methode pour obtenir la liste des fichiers uploadés
#
def getUploadedFileListFor(self, adh):
file_folder = os.path.join(FILE_UPLOAD_BASE_FOLDER, cherrypy.session['uid']+"/")
if not os.path.isdir(file_folder):
return []
return os.listdir(file_folder)
#
# methode pour enregistrer un fichier
#
def savePDF(self, aFile):
_, tempFileName = tempfile.mkstemp()
f = open(tempFileName, 'w+b')
size=0
while True:
data = aFile.file.read(1024 * 8) # Read blocks of 8KB at a time
if not data:
break
f.write(data)
size += len(data)
f.close()
if size == 0:
raise FileError("Fichier vide")
file_folder = os.path.join(FILE_UPLOAD_BASE_FOLDER, cherrypy.session['uid']+"/")
if not os.path.isdir(file_folder):
os.makedirs(file_folder)
newFilePath = os.path.join(file_folder, aFile.filename)
shutil.move(tempFileName, newFilePath)
crans.cp.log("New file uploaded at : %s" % newFilePath, "IMPRESSION")
return newFilePath

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -0,0 +1,162 @@
/* ****************************************** *
* <!-- disposition générale -->
* ****************************************** */
#globalDiv {
padding-left:200px;
position: relative;
}
ul#actionMenu {
list-style-type:none;
position:absolute;
width:150px;
top:0;
left:0;
margin:20px;
padding:0;
}
ul#actionMenu li {
clear:both;
}
/* ****************************************** *
* <!-- file name, menu de gauche -->
* ****************************************** */
#fileName {
display: block;
width:150px;
text-align:center;
padding:50px 5px 5px 5px;
background: url(../images/pdf-icon.png) center top no-repeat;
margin:0 0 10px 0;
overflow:auto;
}
#actionMenu li {
margin: .8em 0;
}
#actionEtatImprimante {
padding:0.4em;
border: thin black solid;
}
/* ******************************************* *
* <!-- formulaire reglages impression -->
* ******************************************* */
form#form_impression {
margin: 0px;
font-size: 100%;
min-width:600px;
}
form#form_impression #preview {
border:1px black solid;
width:150px;
height:150px;
padding:10px;
background-color:#C0C0C0;
}
form#form_impression #rightColumn {
margin:10px 10px 10px 240px;
}
form#form_impression #leftColumn {
float:left;
width:170px;
margin:10px;
padding:0;
}
div#prix_placeholder {
margin:6px 0;
width:170px;
min-height:16px;
padding:0;
color:gray;
}
div#prix_placeholder img {
margin-right:2px;
float:right;
}
form#form_impression fieldset fieldset {
margin:10px;
}
form#form_impression>fieldset {
position:relative;
padding:20px;
}
.clear {
clear:both;
}
form#form_impression .bouttons {
text-align:right;
}
form#form_impression label.labelInput {
display:block;
width:4em;
margin-right:4px;
float:left;
text-align:right;
}
/* ****************************************** *
* <!-- popup choix fichier -->
* ****************************************** */
#popupFichiers {
background:#AE0F3E;
z-index:500;
float:left;
position:fixed;
min-width:450px;
top:110px;
left:20%;
right:20%;
padding:0;
}
#popupFichiers #insideDiv {
background:white;
margin:2px 5px;
}
#popupFichiers #insideDiv form {
margin:2px 5px;
}
#popupFichiers h1 {
font-size:1em;
margin:0;
text-align:center;
color:white;
}
#popupFichiers h1:before {
content:url("../images/WindowTitleLogo.png");
margin-right:5px;
}
#popupFichiers h2 {
font-size:1.1em;
border-bottom:thin black solid;
}
#popupFichiers select,
#popupFichiers input.file {
width:100%;
}
.button {
float:right;
}
/* ****************************************** *
* <!-- popup impression en cours -->
* ****************************************** */
div#printingPopupContent {
background: white url("../images/printer.png") left center no-repeat;;
padding:10px 10px 10px 115px;
min-height:100px;
}
#printingPopupContent a,
#printingPopupContent span {
display:block;
font-weight: bold;
margin:5px 0;
}

View file

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

View file

@ -0,0 +1,67 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" HTTP-EQUIV="Content-Type">
<title>Cr@ns Intranet</title>
<style type="text/css">
table.factureDetails {
padding:1%;
width:96%;
margin:0 1% 10px 1%;
}
.tdTotalDetail,
.tdTotalDetailIntitule {
border-top:thin black solid;
}
.tdTotalDetailIntitule {
text-align:right;
font-weight:bold;
}
table.factureDetails th {
border-bottom:thin black solid;
}
table.factureDetails th,
table.factureDetails td {
border-right:thin black solid;
margin:0;
padding:5px 20px;
}
</style>
</head>
<body>
<div style="background:white url(/static/images/petitCr@ns.png) top left no-repeat; padding:2em;width:21cm;border:thin black solid;">
<h1 style="margin:1em 1em 1em 50px;">Devis pour impression</h1>
<span style="font-weight:bold;">Fichier : </span> $nomFichier
<div id="facture" style="margin:2em 1em 1em 1em;">
<table cellspacing="0" border="0" class="factureDetails">
<tr>
<th width="80%">Description</th>
<th>Prix unitaire</th>
<th>Quantit&eacute;</th>
<th>total</th>
</tr>
#for anItem in $devis
<tr>
<td>$anItem[0]</td>
<td>$anItem[1]&nbsp;&euro;</td>
<td>$anItem[2]</td>
<td>
#echo str($anItem[1] * $anItem[2]) + '&nbsp;&euro;'
</td>
</tr>
#end for
<tr>
<td colspan="3" class="tdTotalDetailIntitule">
Total
</td>
<td class="tdTotalDetail">$total&nbsp;&euro;</td>
</table>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,170 @@
#import crans.impression
#if $getVar('errorMsg',False)
<script type="text/javascript">
<!--
Crans.messages.setMessage('$errorMsg.replace("\'","\\\'")', 'errorMessage')
//-->
</script>
#end if
<div id="globalDiv">
<form id="form_impression" name="form_impression" onsubmit="Impression.popup();return false;" action="index">
<fieldset><legend>Options d'impression</legend>
<div id="leftColumn">
<div id="preview" onclick="Impression.settings.init();"></div>
<div class="clear prix_impression" id="prix_placeholder"></div>
</div>
<div id="rightColumn">
<fieldset><legend>Type d'impression</legend>
<label for="type_impression_couleur" class="labelRadio compact">
<input type="radio" name="type_impression" id="type_impression_couleur" class="inputRadio" value="$crans.impression.IMPRESSION_COULEUR" checked="checked" onclick="Impression.settings.update(this);" />
Couleurs
</label>
<label for="type_impression_nb" class="labelRadio compact"><input type="radio" name="type_impression" id="type_impression_nb" class="inputRadio" value="$crans.impression.IMPRESSION_NB" onclick="Impression.settings.update(this);" />
Noir et blanc
</label>
</fieldset>
<fieldset><legend>Copies et papier</legend>
<label for="papier" class="labelInput">Papier:</label>
<select name="papier" id="papier" class="selectOne" onchange="Impression.settings.update(this);">
#for type_papier in $crans.impression.PAPIER_VALEURS_POSSIBLES
<option value="$type_papier">$crans.impression.LABELS[type_papier]</option>
#end for
</select>
<br />
<label for="agrafes" class="labelInput">Agrafes:</label>
<select name="agrafes" id="agrafes" class="selectOne" onchange="Impression.settings.update(this);">
#for type_agrafes in $crans.impression.AGRAPHES_VALEURS_POSSIBLES
<option value="$type_agrafes">$crans.impression.LABELS[type_agrafes]</option>
#end for
</select>
<br />
<label for="nb_copies" class="labelInput">Copies:</label>
<input onkeyup="Impression.settings.update(this);" type="text" name="nb_copies" id="nb_copies" class="inputText" size="10" maxlength="50" value="1" />
</fieldset>
<fieldset><legend>Disposition</legend>
<label for="disposition_recto" class="labelRadio compact">
<input type="radio" name="disposition" id="disposition_recto" class="inputRadio" value="$crans.impression.IMPRESSION_RECTO" onclick="Impression.settings.update(this);" />
Recto
</label>
<label for="disposition_recto_verso" class="labelRadio compact">
<input type="radio" name="disposition" id="disposition_recto_verso" class="inputRadio" value="$crans.impression.IMPRESSION_RECTO_VERSO" checked="checked" onclick="Impression.settings.update(this);" />
Recto-verso
</label>
</fieldset>
</div>
<div class="clear bouttons">
<input type="reset" value="Reset" onclick="Impression.settings.reset();return false;" />
<input type="button" value="Devis" onclick="window.open('devis')" />
<input type="button" value="Imprimer" onclick="Impression.AJAX.lancerImpression();"/>
</div>
</fieldset>
</form>
<ul id="actionMenu">
#if $getVar('fileName',False)
<li id="fileName"><span>$fileName</span></li>
<li><span style="font-weight:bold;">pages: </span><span id="fileNbPages"></span></li>
<hr />
#end if
<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 id="actionMesCodes" onclick="Impression.AJAX.updateSolde(); return false;">
<span style="font-weight:bold;">Solde: </span>
<span id="soldePlaceHolder">-</span> &euro;
</li>
<script type="text/javascript">
<!--
Impression.AJAX.updateSolde();
//-->
</script>
<li id="actionEtatImprimante" onclick="Impression.AJAX.getPrinterState();">
<span style="font-weight:bold;">&Eacute;tat imprimante:</span><br />
<span id="etatImprimanteIci"> - </span>
</li>
<script type="text/javascript">
<!--
Impression.AJAX.getPrinterState();
//-->
</script>
</ul>
#if not $getVar('Erreur_imprimante',False)
#if not $getVar('fileName',False)
<div id="popupFichiers">
<h1>Impression - Choix fichier</h1>
<div id="insideDiv">
#if $getVar('openError',False)
<div style="text-align:center;width:40%;border:2px solid red;margin:5px auto;padding:5px 10px;">$openError</div>
#end if
<p class="crans_warning">Il semblerait que l'interface d'impression ne soit
pas compatible avec internet explorer. Nous esp&eacute;rons pouvoir
r&eacute;gler ce probl&egrave;me au plus vite. Nous vous conseillons en attendant
d'utiliser <a href="http://www.mozilla-europe.org/fr/products/firefox/">Firefox</a>. <span class="crans_signature">Les
nounous</span> </p>
<form method="post" action="./" enctype="multipart/form-data">
<h2>Mes fichiers</h2>
<div>
<select name="fileList" id="fileList" size="5">
#for $file in $fileList
<option>$file</option>
#end for
</select>
</div>
<div class="buttons">
<input type="submit" name="submit" class="button" value="Choisir" />
</div>
<h2>Envoyer un fichier</h2>
<div>
<input type="file" name="newFile" class="file" />
<input type="submit" name="submit" value="Envoyer" class="button">
</div>
</form>
<div class="clear"></div>
</div>
</div>
<script type="text/javascript">
roundElement("popupFichiers");
roundElement("insideDiv");
</script>
#end if
</div>
#if $getVar('fileName',False)
<script type="text/javascript">
<!--
Impression.settings.init();
//Impression..AJAX.updateSolde();
Impression.AJAX.usefile('$fileName');
Impression.settings.preloadAllImages();
//-->
</script>
#else
<script type="text/javascript">
<!--
Impression.settings.init();
//Impression..AJAX.updateSolde();
Impression.settings.disableForm(true);
//-->
</script>
#end if
#else
## desactivation de l'interface si l'imprimant a un probleme
<script type="text/javascript">
<!--
Impression.settings.init();
//Impression.AJAX.updateSolde();
Impression.settings.disableForm(true);
logError("$Erreur_imprimante");
//-->
</script>
#end if