From fdfd2254d3bf86dfb5e531f6772f11a07c96c9e7 Mon Sep 17 00:00:00 2001
From: Antoine Durand-Gasselin
Date: Sat, 16 May 2009 03:31:03 +0200
Subject: [PATCH] [lib/impression, intranet/impression] stripping trailing
whitespaces
Ignore-this: a462d23b95fcfc99372f15a2dc645851
darcs-hash:20090516013103-bd074-7538108fca4203285f67d9f4adff82ade6c33f62.gz
---
intranet/ClassesIntranet/AJAXManager.py | 12 ++--
intranet/ClassesIntranet/TemplatesManager.py | 32 ++++-----
.../modules/impression/static/impression.js | 68 +++++++++----------
intranet/modules/impression/static/popup.js | 8 +--
.../impression/templates/impression.tmpl | 22 +++---
lib/impression/impression_canon.py | 1 -
6 files changed, 71 insertions(+), 72 deletions(-)
diff --git a/intranet/ClassesIntranet/AJAXManager.py b/intranet/ClassesIntranet/AJAXManager.py
index 54cbc557..70fe2618 100644
--- a/intranet/ClassesIntranet/AJAXManager.py
+++ b/intranet/ClassesIntranet/AJAXManager.py
@@ -4,7 +4,7 @@ import cherrypy._cputil
##########################
# DomFilter
##########################
-#
+#
# transforme des objets python
# en chainses de caracteres qui peuvent
# etre parsees avec JSON/javascript
@@ -15,24 +15,24 @@ class DOMFilter(BaseFilter):
if isinstance(body, dict):
body = self.printAsDom(body)
cherrypy.response.body = body
-
+
def printAsDom(self, chose):
if isinstance(chose, dict):
stringList = []
for a_key in chose.keys():
stringList.append('%s:%s' % (self.printAsDom(a_key), self.printAsDom(chose[a_key])))
return "{%s}" % ','.join(stringList)
-
+
if isinstance(chose, list):
stringList = []
for an_item in chose:
stringList.append('%s' % (self.printAsDom(an_item)))
return "[%s]" % ','.join(stringList)
-
+
if isinstance(chose, str):
return '"%s"' % chose
-
+
if isinstance(chose, unicode):
return '"%s"' % chose.encode('utf8')
-
+
return str(chose)
diff --git a/intranet/ClassesIntranet/TemplatesManager.py b/intranet/ClassesIntranet/TemplatesManager.py
index 6f5393ac..e0733912 100644
--- a/intranet/ClassesIntranet/TemplatesManager.py
+++ b/intranet/ClassesIntranet/TemplatesManager.py
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
from cherrypy.filters.basefilter import BaseFilter
import cherrypy, os
from Cheetah.Template import Template
@@ -21,16 +21,16 @@ def serverSidePath(self, path):
except:
pass
return root_dir + '/templates/' + path
-
+
# on surcharge cette fonction dans la classe Template
Template.serverSidePath = serverSidePath
-
+
##########################
# templatesEngine
##########################
-#
-# Application des templates,
+#
+# Application des templates,
# avec plein de test chians
#
class TemplatesFilter(BaseFilter):
@@ -46,8 +46,8 @@ class TemplatesFilter(BaseFilter):
def static(truc):
return "/static/" + truc
return static
-
-
+
+
def _getBodyTemplate(self, body):
if isinstance(body, dict):
if body.has_key('template'):
@@ -58,7 +58,7 @@ class TemplatesFilter(BaseFilter):
else:
return body['template'] + ".tmpl"
return False
-
+
def _isStandaloneBody(self, body):
if isinstance(body, dict):
if body.has_key('standalone'):
@@ -68,14 +68,14 @@ class TemplatesFilter(BaseFilter):
else:
return True
return True
-
+
def _getBodyNameSpace(self, body):
if isinstance(body, dict):
if body.has_key('values'):
return body['values']
return {}
-
+
def _useMainTemplate(self, body):
values = {'environment':cherrypy.config.configMap["global"]["server.environment"],
'static':self._getCorrectStaticMethod(),
@@ -84,9 +84,9 @@ class TemplatesFilter(BaseFilter):
t = Template(file='main.tmpl', searchList= [body,{'login':cherrypy.session['uid']}, values])
except:
t = Template(file='main.tmpl', searchList=[body,{'login':''},values])
-
+
return t.__str__()
-
+
def goWithThisDict(self, aDict):
body = aDict
bodyTemplate = self._getBodyTemplate(body)
@@ -95,17 +95,17 @@ class TemplatesFilter(BaseFilter):
defaultvalues = {'static':self._getCorrectStaticMethod()}
t = Template(file=bodyTemplate, searchList=[templatevalues, defaultvalues])
body['page'] = t.__str__()
-
+
if not self._isStandaloneBody(body):
body = self._useMainTemplate(body)
else:
body = body["page"]
body.encode("utf8")
cherrypy.response.body = body
-
-
+
+
def beforeFinalize(self):
-
+
body = cherrypy.response.body
if isinstance(body, dict):
self.goWithThisDict(body)
diff --git a/intranet/modules/impression/static/impression.js b/intranet/modules/impression/static/impression.js
index af80c542..bf2d283c 100644
--- a/intranet/modules/impression/static/impression.js
+++ b/intranet/modules/impression/static/impression.js
@@ -2,8 +2,8 @@
* Impression
************************************************************
* Impression.settings : panneau de configuration
- * Impression.popup : popup
- * Impression.AJAX : ajax
+ * Impression.popup : popup
+ * Impression.AJAX : ajax
*/
Impression = {};
@@ -17,7 +17,7 @@ Impression.settings = {};
//// images : images used for previewing
//
Impression.settings.images = [
- "portrait_couleurs_agraphediagonale.png",
+ "portrait_couleurs_agraphediagonale.png",
"portrait_couleurs_pasdagraphes.png",
"portrait_couleurs_uneagraphe.png",
"portrait_couleurs_Deuxagraphes.png",
@@ -61,7 +61,7 @@ Impression.settings.reset = function () {
Impression.settings.update();
}
-Impression.settings.disableForm = function(bool)
+Impression.settings.disableForm = function(bool)
{
log("Set Disable Form : " + bool);
var fields = this.theform.elements;
@@ -74,9 +74,9 @@ Impression.settings.disableForm = function(bool)
//
//// 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]);
@@ -95,7 +95,7 @@ Impression.settings.getCopies = function(field) {
this.copies = 1;
logError("Can't get copies");
}
- else
+ else
{
this.copies = parseInt(field.value);
}
@@ -114,7 +114,7 @@ Impression.settings.setValue = function(afield, avalue) {
//// setDisableField : set field disabled on/off
//
Impression.settings.setDisableField = function( afield, isdisabled ) {
- afield.disabled = isdisabled ;
+ afield.disabled = isdisabled ;
}
//
@@ -133,7 +133,7 @@ Impression.settings.update = function () {
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 if (this.theform.disposition_recto_verso.checked)
@@ -156,28 +156,28 @@ Impression.settings.update = function () {
} else {
this.setDisableField(this.theform.agrafes, false);
}
- if (this.papier == "A4tr")
+ 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
+ else
{
- this.setDisableField(this.theform.disposition_recto, false);
- 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();
-
+
}
//
//// updatePreview : update preview with new value
//
-Impression.settings.updatePreview = function()
+Impression.settings.updatePreview = function()
{
var image_name = "";
if (this.papier == "A4tr")
@@ -197,23 +197,23 @@ Impression.popup = {};
Impression.popup.popupImpression = function(code, codeJ) {
Popup.hide();
- Popup.create({}, "Impression en cours...",
+ Popup.create({}, "Impression en cours...",
DIV(
- {"id":"printingPopupContent", "style":"background-image:url(./static/dialog-printer.png)"},
+ {"id":"printingPopupContent", "style":"background-image:url(./static/dialog-printer.png)"},
SPAN("code: "+code),
SPAN("Batiment J: "+codeJ),
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/dialog-warning.png)"},
+ Popup.create({}, "Erreur",
+ DIV({"id":"printingPopupContent", "style":"background-image:url(./static/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")));
@@ -222,9 +222,9 @@ Impression.popup.popupError = function(erreur) {
Impression.popup.popupSolde = function(code) {
Popup.hide();
- Popup.create({}, "Solde insuffisant",
+ Popup.create({}, "Solde insuffisant",
DIV(
- {"id":"printingPopupContent", "style":"background-image:url(./static/dialog-solde.png)"},
+ {"id":"printingPopupContent", "style":"background-image:url(./static/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")));
@@ -233,9 +233,9 @@ Impression.popup.popupSolde = function(code) {
Impression.popup.popupCodes = function(codeList) {
Popup.hide();
- Popup.create({}, "Codes de mes impressions",
+ Popup.create({}, "Codes de mes impressions",
DIV(
- {"id":"printingPopupContent", "style":"background-image:url(./static/dialog-lock.png)"},
+ {"id":"printingPopupContent", "style":"background-image:url(./static/dialog-lock.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)),
@@ -249,7 +249,7 @@ Impression.popup.popupCodes = function(codeList) {
Impression.mesCodes
*****************************/
Impression.mesCodes = {};
-Impression.mesCodes.getCodes = function ()
+Impression.mesCodes.getCodes = function ()
{
Impression.AJAX.call('codeList', this.displayCodes );
}
@@ -268,17 +268,17 @@ Impression.mesCodes.displayCodes = function (result) {
*****************************/
Impression.AJAX = {};
-Impression.AJAX.call = function(url,callback) {
+Impression.AJAX.call = function(url,callback) {
AJAX.call( url, callback, true);
}
-Impression.AJAX.modifPrix = function( text, wheel )
+Impression.AJAX.modifPrix = function( text, wheel )
{
- if (wheel)
+ if (wheel)
{
var image = createDOM("IMG",{'src':'./static/indicator.gif'});
- }
- else
+ }
+ else
{
var image = new DIV({});
}
@@ -299,7 +299,7 @@ Impression.AJAX.usefile = function(filename) {
this.call('useFile?fileName=' + filename,this.analysefini );
}
-Impression.AJAX.analysefini = function(AJAXResp)
+Impression.AJAX.analysefini = function(AJAXResp)
{
logDebug('AJAX terminated (usefile)');
if (AJAXResp.erreur) {
@@ -314,7 +314,7 @@ Impression.AJAX.analysefini = function(AJAXResp)
}
}
-Impression.AJAX.recalcPrix = function()
+Impression.AJAX.recalcPrix = function()
{
settings = Impression.settings;
var url = "changeSettings?copies=" + settings.copies
@@ -334,7 +334,7 @@ Impression.AJAX.changePrix = function(AJAXResp)
Impression.settings.disableForm(true);
logWarning('Erreur distante : ' + AJAXResp.erreur);
} else {
- Impression.AJAX.modifPrix("Coût : " + AJAXResp.nouvPrix + "€", false);
+ Impression.AJAX.modifPrix("Coût : " + AJAXResp.nouvPrix + "€", false);
}
}
diff --git a/intranet/modules/impression/static/popup.js b/intranet/modules/impression/static/popup.js
index be13efbb..d1cb72fa 100644
--- a/intranet/modules/impression/static/popup.js
+++ b/intranet/modules/impression/static/popup.js
@@ -2,7 +2,7 @@ Popup = {};
Popup.popupNode = null;
Popup.visible = false;
-Popup.display = function()
+Popup.display = function()
{
if (this.popupNode == null) {
logError("Popup not created, cannot be displayed");
@@ -10,11 +10,11 @@ Popup.display = function()
}
appendChildNodes("pageContent", this.popupNode);
this.visible = true;
- // logDebug("popup visible");
+ // logDebug("popup visible");
}
Popup.create = function(options, title_popup, content) {
- var inPopup = DIV({"id":"__popupInDivId", "style":"background:white;margin:2px 5px;"}, content);
+ var inPopup = DIV({"id":"__popupInDivId", "style":"background:white;margin:2px 5px;"}, content);
var outPopup = DIV({"id":"__popupOutDivId","style":"background:#AE0F3E;z-index:500;float:left;padding:0;min-width:300px;position:fixed;top:30%;left:30%;right:30%;"}, H1({"style":"font-size:1em;margin:0;text-align:center;color:white;"}, IMG({"src":"/static/images/WindowTitleLogo.png","alt":"icon", "style":"margin:0 5px;"}), title_popup), inPopup );
roundElement(outPopup);
logDebug("Popup \""+ title_popup +"\" created");
@@ -26,7 +26,7 @@ Popup.hide = function() {
removeElement(this.popupNode);
this.visible = false;
}
- // logDebug("popup not visible");
+ // logDebug("popup not visible");
}
Popup.closeLink = function(options, text_link) {
options["href"] = "#";
diff --git a/intranet/modules/impression/templates/impression.tmpl b/intranet/modules/impression/templates/impression.tmpl
index 4cd7040f..4e986818 100644
--- a/intranet/modules/impression/templates/impression.tmpl
+++ b/intranet/modules/impression/templates/impression.tmpl
@@ -15,7 +15,7 @@ Crans.messages.setMessage('$errorMsg.replace("\'","\\\'")', 'errorMessage')
-
+
Type d'impression
@@ -26,9 +26,9 @@ Crans.messages.setMessage('$errorMsg.replace("\'","\\\'")', 'errorMessage')
Noir et blanc
-
+
Copies et papier
-
+
Papier:
#for type_papier in $crans.impression.PAPIER_VALEURS_POSSIBLES
@@ -43,9 +43,9 @@ Crans.messages.setMessage('$errorMsg.replace("\'","\\\'")', 'errorMessage')
#end for
-
+
Copies:
-
+
Disposition
@@ -64,7 +64,7 @@ Crans.messages.setMessage('$errorMsg.replace("\'","\\\'")', 'errorMessage')
aide
-
+
@@ -150,7 +150,7 @@ nounous
Impression.settings.init();
//Impression..AJAX.updateSolde();
Impression.AJAX.usefile('$fileName');
- Impression.settings.preloadAllImages();
+ Impression.settings.preloadAllImages();
//-->
#else
@@ -162,7 +162,7 @@ nounous
//-->
#end if
-#else
+#else
## desactivation de l'interface si l'imprimant a un probleme