appy.pod: bugfix in html2odt: in some situations, while using stylesMappings, some empty tags were present in the result, producing a superflous empty paragraph; bugfix while importing PNG files under Windows; appy.gen: began to implement a new global Appy-specific page template and styles.
This commit is contained in:
parent
ddec7cd62c
commit
7514eb31a9
|
@ -2605,6 +2605,8 @@ class Config:
|
|||
# frontPage = True will replace the Plone front page with a page
|
||||
# whose content will come fron i18n label "front_page_text".
|
||||
self.frontPage = False
|
||||
# You can choose the Plone or Appy main template
|
||||
self.frontPageTemplate = 'plone' # or "appy"
|
||||
# If you don't need the portlet that appy.gen has generated for your
|
||||
# application, set the following parameter to False.
|
||||
self.showPortlet = True
|
||||
|
|
|
@ -159,8 +159,7 @@ class Generator(AbstractGenerator):
|
|||
self.generateTool()
|
||||
self.generateInit()
|
||||
self.generateTests()
|
||||
if self.config.frontPage:
|
||||
self.generateFrontPage()
|
||||
if self.config.frontPage: self.generateFrontPage()
|
||||
self.copyFile('Install.py', self.repls, destFolder='Extensions')
|
||||
self.generateConfigureZcml()
|
||||
self.copyFile('import_steps.xml', self.repls,
|
||||
|
@ -566,6 +565,8 @@ class Generator(AbstractGenerator):
|
|||
def generateFrontPage(self):
|
||||
fp = self.config.frontPage
|
||||
repls = self.repls.copy()
|
||||
template = 'frontPage.pt'
|
||||
if self.config.frontPageTemplate== 'appy': template = 'frontPageAppy.pt'
|
||||
if fp == True:
|
||||
# We need a front page, but no specific one has been given.
|
||||
# So we will create a basic one that will simply display
|
||||
|
@ -582,7 +583,7 @@ class Generator(AbstractGenerator):
|
|||
page, macro = fp.split('/')
|
||||
repls['pageContent'] = '<metal:call use-macro=' \
|
||||
'"context/%s/macros/%s"/>' % (page, macro)
|
||||
self.copyFile('frontPage.pt', repls, destFolder=self.skinsFolder,
|
||||
self.copyFile(template, repls, destFolder=self.skinsFolder,
|
||||
destName='%sFrontPage.pt' % self.applicationName)
|
||||
|
||||
def generateTool(self):
|
||||
|
|
21
gen/plone25/skin/appy.css
Normal file
21
gen/plone25/skin/appy.css
Normal file
|
@ -0,0 +1,21 @@
|
|||
body {
|
||||
font: 75% Lucida,Helvetica,Arial,sans-serif;
|
||||
background-color: #EAEAEA;
|
||||
}
|
||||
|
||||
a {text-decoration: none; color: #747171;}
|
||||
a:visited {color: #840107;}
|
||||
table { font-size: 100%; border-spacing: 0px; }
|
||||
|
||||
.main {
|
||||
width: 900px;
|
||||
background-color: white;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: grey;
|
||||
box-shadow: 3px 3px 3px #A9A9A9;
|
||||
}
|
||||
|
||||
.top { height: 80px; margin-left: 3em; vertical-align: top;}
|
||||
.lang { margin-right: 3px; }
|
||||
.auth { background-color: grey;}
|
BIN
gen/plone25/skin/logo.jpg
Normal file
BIN
gen/plone25/skin/logo.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
78
gen/plone25/skin/template.pt
Normal file
78
gen/plone25/skin/template.pt
Normal file
|
@ -0,0 +1,78 @@
|
|||
<html metal:define-macro="main"
|
||||
tal:define="user context/portal_membership/getAuthenticatedMember;
|
||||
isAnon python: user.getUserName() == 'Anonymous User';
|
||||
app python: tool.getParentNode();
|
||||
appUrl app/absolute_url;
|
||||
_ python: tool.translate;
|
||||
req python: request;
|
||||
resp req/RESPONSE;
|
||||
x python: resp.setHeader('Content-Type', 'text/html;;charset=utf-8');
|
||||
x python: resp.setHeader('Expires', 'Thu, 11 Dec 1975 12:05:00 GMT+2');
|
||||
x python: resp.setHeader('Content-Language', request.get('language', 'en'))">
|
||||
|
||||
<head>
|
||||
<title tal:content="tool/getAppName"></title>
|
||||
<link rel="stylesheet" tal:attributes="href string:$appUrl/skyn/appy.css" type="text/css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table class="main" align="center">
|
||||
<tal:comment replace="nothing">Top banner</tal:comment>
|
||||
<tr class="top" metal:define-slot="top">
|
||||
<td>
|
||||
<table width="100%">
|
||||
<tr valign="top">
|
||||
<tal:comment replace="nothing">Logo</tal:comment>
|
||||
<td><img src="skyn/logo.jpg"/></td>
|
||||
<tal:comment replace="nothing">Language selector (links or listbox)</tal:comment>
|
||||
<td align="right"
|
||||
tal:define="appLangs app/portal_languages/listSupportedLanguages;
|
||||
defLang python: app.portal_languages.getLanguageBindings()[0];
|
||||
suffix python: req.get('ACTUAL_URL').split('/')[-1];
|
||||
asLinks python: len(appLangs) <= 5"
|
||||
tal:condition="python: len(appLangs) >= 2 and (suffix not in ('edit', 'query', 'search'))">
|
||||
<table tal:condition="asLinks">
|
||||
<tr>
|
||||
<td tal:repeat="lang appLangs">
|
||||
<a class="lang"
|
||||
tal:attributes="href python: req.get('ACTUAL_URL')+'/switchLanguage?set_language=%s' % lang[0];
|
||||
title python: app.portal_languages.getNameForLanguageCode(lang[1])"
|
||||
tal:content="python: lang[0]"></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<select tal:condition="not: asLinks"
|
||||
tal:attributes="onchange string:window.location='${context/absolute_url}/switchLanguage?set_language=' + this.options[this.selectedIndex].value">
|
||||
<option tal:repeat="lang appLangs"
|
||||
tal:content="python:app.portal_languages.getNameForLanguageCode(lang[0]) or lang[1]"
|
||||
tal:attributes="selected python:defLanguage == lang[0];
|
||||
value python:lang[0]">
|
||||
</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tal:comment replace="nothing">The login strip</tal:comment>
|
||||
<tr class="auth">
|
||||
<td>
|
||||
<table witdh="100%">
|
||||
<tr>
|
||||
<td>a </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><span metal:define-slot="content"><span tal:content="isAnon"></span></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<h1>Appy</h1>
|
||||
<h2>Sub appy</h2>
|
||||
<h3>Sub sub appy</h3>
|
||||
<p>Hello</p>
|
||||
</body>
|
||||
</html>
|
5
gen/plone25/templates/frontPageAppy.pt
Normal file
5
gen/plone25/templates/frontPageAppy.pt
Normal file
|
@ -0,0 +1,5 @@
|
|||
<tal:main define="tool python: context.<!toolInstanceName!>">
|
||||
<html metal:use-macro="context/skyn/template/macros/main">
|
||||
<div metal:fill-slot="content"><!pageContent!></div>
|
||||
</html>
|
||||
</tal:main>
|
17
gen/utils.py
17
gen/utils.py
|
@ -213,23 +213,6 @@ class Keywords:
|
|||
return op.join(self.keywords)+'*'
|
||||
return ''
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
class FakeBrain:
|
||||
'''This class behaves like a brain retrieved from a query to a ZCatalog. It
|
||||
is used for representing a fake brain that was generated from a search in
|
||||
a distant portal_catalog.'''
|
||||
Creator = None
|
||||
created = None
|
||||
modified = None
|
||||
review_state = None
|
||||
def has_key(self, key): return hasattr(self, key)
|
||||
def getPath(self): return self.path
|
||||
def getURL(self, relative=0): return self.url
|
||||
def _unrestrictedGetObject(self): return self
|
||||
def pretty_title_or_id(self): return self.Title
|
||||
def getObject(self, REQUEST=None): return self
|
||||
def getRID(self): return self.url
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
CONVERSION_ERROR = 'An error occurred while executing command "%s". %s'
|
||||
class FileWrapper:
|
||||
|
|
|
@ -145,7 +145,7 @@ pxToCm = 44.173513561
|
|||
def getSize(filePath, fileType):
|
||||
'''Gets the size of an image by reading first bytes.'''
|
||||
x, y = (None, None)
|
||||
f = file(filePath)
|
||||
f = file(filePath, 'rb')
|
||||
if fileType in jpgTypes:
|
||||
# Dummy read to skip header ID
|
||||
f.read(2)
|
||||
|
|
|
@ -454,6 +454,9 @@ class XhtmlParser(XmlParser):
|
|||
currentElem, elemsToReopen = e.onElementEnd(elem)
|
||||
# Determine the tag to dump
|
||||
startTag, endTag = currentElem.getOdfTags(e)
|
||||
if currentElem.isConflictual:
|
||||
# Compute the start tag, with potential styles applied
|
||||
startTag = e.getTags((currentElem,), start=True)
|
||||
if currentElem.isConflictual and e.res.endswith(startTag):
|
||||
# We will not dump it, it would constitute a silly empty tag.
|
||||
e.res = e.res[:-len(startTag)]
|
||||
|
|
Loading…
Reference in a new issue