appy.gen: improved cleaning and formatting of XHTML content; appy.pod: added some default appy-related table styles for producing cells with text in bold/normal, aligned right/left, etc.

This commit is contained in:
Gaetan Delannay 2012-05-14 17:35:34 +02:00
parent d3a2b85a10
commit 028040351c
11 changed files with 195 additions and 54 deletions

View file

@ -11,8 +11,9 @@ from appy.gen.utils import GroupDescr, Keywords, getClassName, SomeObjects
import appy.pod
from appy.pod.renderer import Renderer
from appy.shared.data import countries
from appy.shared.xml_parser import XhtmlCleaner
from appy.shared.utils import Traceback, getOsTempFolder, formatNumber, \
XhtmlCleaner, FileWrapper, sequenceTypes
FileWrapper, sequenceTypes
# Default Appy permissions -----------------------------------------------------
r, w, d = ('read', 'write', 'delete')
@ -1238,8 +1239,7 @@ class String(Type):
# When image upload is allowed, ckeditor inserts some "style" attrs
# (ie for image size when images are resized). So in this case we
# can't remove style-related information.
keepStyles = self.allowImageUpload or self.richText
value = XhtmlCleaner.clean(value, keepStyles=keepStyles)
value = XhtmlCleaner().clean(value, keepStyles=self.richText)
Type.store(self, obj, value)
def getFormattedValue(self, obj, value):

View file

@ -1,10 +1,14 @@
body { font: 75% Helvetica,Arial,sans-serif; background-color: #EAEAEA;
margin-top: 18px}
pre { font: 100% Helvetica,Arial,sans-serif; margin: 0}
h1 { font-size: 11pt; margin:0;}
h2 { font-size: 10pt; margin:0; font-style: italic; font-weight: normal;
h1 { font-size: 14pt; margin:0;}
h2 { font-size: 13pt; margin:0; font-style: italic; font-weight: normal;
background-color: #d7dee4}
h3 { font-size: 9pt; margin:0; font-weight: bold;}
h3 { font-size: 12pt; margin:0; font-weight: bold;}
h4 { font-size: 11pt; margin:0;}
h5 { font-size: 10pt; margin:0; font-style: italic; font-weight: normal;
background-color: #d7dee4}
h6 { font-size: 9pt; margin:0; font-weight: bold;}
a { text-decoration: none; color: #503737;}
a:visited { color: #503737;}
table { font-size: 100%; border-spacing: 0px; border-collapse:collapse;}
@ -34,10 +38,15 @@ label { font-weight: 600; font-style: italic; line-height: 1.4em;}
legend { padding-bottom: 2px; padding-right: 3px; color: black;}
ul { line-height: 1.2em; margin: 0 0 0.2em 0.6em; padding: 0;
list-style: none outside none;}
li { margin: 0; background-image: url("ui/li.gif"); padding-left: 10px;
background-repeat: no-repeat; background-position: 0 4px;}
ul li { margin: 0; background-image: url("ui/li.gif"); padding-left: 10px;
background-repeat: no-repeat; background-position: 0 4px;}
img {border: 0}
/* Styles that apply when viewing content of XHTML fields, that mimic styles
that ckeditor uses for displaying XHTML content in the edit view. */
.xhtml { margin-top: 10px }
.xhtml img { margin-right: 5px }
.xhtml p { margin: 3px 0 7px 0}
.main { width: 900px; background-color: white; box-shadow: 3px 3px 3px #A9A9A9;
border-style: solid; border-width: 1px; border-color: grey}

View file

@ -30,4 +30,8 @@ CKEDITOR.editorConfig = function( config )
config.format_h2 = { element:'h2', attributes:{'style':'margin:0;padding:0'}};
config.format_h3 = { element:'h3', attributes:{'style':'margin:0;padding:0'}};
config.format_h4 = { element:'h4', attributes:{'style':'margin:0;padding:0'}};
config.entities = false;
config.entities_greek = false;
config.entities_latin = false;
config.fillEmptyBlocks = false;
};

View file

@ -12,3 +12,4 @@ ol,ul,dl {
padding:0 40px;
}
img { margin-right: 5px}
table { border-collapse: collapse; border-spacing: 0 }

View file

@ -149,7 +149,7 @@ class ToolWrapper(AbstractWrapper):
'''Reindex all Appy objects. For some unknown reason, method
catalog.refreshCatalog is not able to recatalog Appy objects.'''
if not startObject:
# This is a global refresh. Clear the catallog completely, and then
# This is a global refresh. Clear the catalog completely, and then
# reindex all Appy-managed objects, ie those in folders "config"
# and "data".
# First, clear the catalog.